[Release] Apartment [MySQL & Async](08/17/2017)

yes thanks for help its very good script :slight_smile:

Using EM2.0 and mySQL.

Apartments seem to work but if they purchase nothing happens but it takes the money and nothing is logged in the DB

All config is correct any ideas?

2 Likes

Any errors in the server console or F8 ?

As far as i could see i didnt see no errors,

Ill do a test tomorrow and get people to buy houses see if anything triggers etc

Hello I have a problem with the script when I go to bought a flat nothing happens what should it do?

Could show the values

having issues, Installed the SQL you proveded. When i purchase a house, nothing updates in my database. I input my credentials in the server file… it takes the money just doesnt update the DB, any tips? i am using the MySQL version. But plan on installing Async soon.

Error: http://imgur.com/a/0Q0rD

having the same issue =[

I fixed this issue by converting my server to aSync :slight_smile: Seems he has a error somewere for the SQL part

No work for Mysql Lalife only remove money and nothing happens
and nothing in database

i’m using la_life and it works very well for me

Works perfectly here ! TY :slight_smile:

i have an issue, when i buy the apartments it dosnt say save to my person and i can just rebuy it over and over i can visit them but its not saving anything or letting me sell it when i buy it. and it also take my 100k so that part works.

@GeorgeRios
i’m not sure but it’s might be about your Database, the “user_appartements”, or in the script direclty you might have modified or need to modify a Sql request/call to your database, check it out and tell us :wink:

Receiving an error:

“A client tried to send an event of type apart:buyAppart, but it was not greenlit for client invocation.”

Checked the script, and it does have a RegisterServerEvent. Please advise.

EDIT: Resolved.

Suggestion: Update the Apartments for sale on the map after it’s been bought, with a Home blip. This is a bit confusing.


English update below:

Apartments/apart_server.lua
Lines: 29 - 34

['en'] = {
    ['welcome'] = 'Welcome to your new home!\n',
    ['nocash'] = 'Not enough money!\n', 
    ['estVendu'] = 'Apartment sold!\n'
} }

Variable nocash kept spelling “don’t” as “d’ont” due to the \n in the beginning.


Also changed the following:
Changed “Stephane” to “Real estate agent” - since the picture wasn’t always the same.

Lines 84 - 103

RegisterServerEvent(“apart:buyAppart”)
AddEventHandler(‘apart:buyAppart’, function(name, price)
TriggerEvent(‘es:getPlayerFromId’, source, function(user)
local player = user.identifier
local name = name
local price = price
if (tonumber(user.money) >= tonumber(price)) then
user:removeMoney((price))
if (mode == “Async”) then
MySQL.Async.execute(“INSERT INTO user_appartement (identifier, name, price) VALUES (@username, @name, @price)”, {[’@username’] = player, [’@name’] = name, [’@price’] = price})
elseif mode == “MySQL” then
local executed_query2 = MySQL:executeQuery(“INSERT INTO user_appartement (identifier, name, price) VALUES (@username, @name, @price)”, {[’@username’] = player, [’@name’] = name, [’@price’] = price})
end
TriggerClientEvent(“es_freeroam:notify”, source, “CHAR_SIMEON”, 1, “Real Estate Agent”, false, txt[lang][‘welcome’])
TriggerClientEvent(‘apart:isMine’, source)
else
TriggerClientEvent(“es_freeroam:notify”, source, “CHAR_SIMEON”, 1, “Real Estate Agent”, false, txt[lang][‘nocash’])
end
end)
end)

Script works great ^^
A function to save money or weapons inside the house would be great and the posibillity to let in other people…maybe with keys…this would be greate…is anyonr working on something like that? ^^

1 Like

Hello,
I have a problem, already the menu very quickly because we are tp in the apartment, but when we want to buy, its the money and that’s all …
I’m on LaLife with Async.
Thank you
:baguette_bread:

Hello i use the file LaLifeRP , and when i launch my server with your script i have this error

|ERROR|CitizenMP.Server|Error creating script environment for resource Apartments-master: Object reference not set to an instance of an object
2017-06-16 11:33:25.3353|ERROR|CitizenMP.Server| at [U] Neo.IronLua.LuaChunk.Run(LuaTable env,Object[] callArgs)
2017-06-16 11:33:25.3353|ERROR|CitizenMP.Server| at [U] Neo.IronLua.LuaGlobalPortable.DoChunk(LuaChunk chunk,Object[] callArgs)
2017-06-16 11:33:25.3353|ERROR|CitizenMP.Server| at [U] CitizenMP.Server.Resources.ScriptEnvironment.DoInitFile(Boolean preParse

Ok The apartments charge well, but when I want to buy it in the console it puts me:

2294|WARN|CitizenMP.Server|A client tried to send an event of type apart:buyAppart, but it was not greenlit for client invocation. Y ou may need to call RegisterServerEvent from your script.

There is a conflict with the interrior mode. If you want to disable “-interiors” to citmp-server.yml