OrbTanT Posted July 28, 2014 Share Posted July 28, 2014 Good,help me is occurring the following errors when trying to buy my property, I have tried to fix more still persists the error. error: WARNING: propriedades\server.lua:10: Bad argument @ 'getPlayerMoney' WARNING: propriedades\server.lua:11: Bad argument @ 'getElementData' [Expected element at argument 1, got nil] server- local infoz = createPickup(2181.8864746094,1115.2287597656,12.34375,3,1273,0) local prop = createBlip(2181.8864746094,1115.2287597656,12.34375,31) addCommandHandler("comprar", function() local money = getPlayerMoney(player) local dono = getElementData(player,"donoCasa") if money == 200000 and dono ~= true then --- ~= siginifica diferente takePlayerMoney ( player, 200000 ) outputChatBox("Você comprou a propriedade Come a Lot",player) timer = setTimer ( function() setElementData(resourceRoot,"precoCasa",getElementData(resourceRoot,"precoCasa") + 25000) triggerClientEvent("reajustarPreco",resourceRoot,getElementData(resourceRoot,"precoCasa")) end, 60*1000, 0 ) setElementData(resourceRoot,"donoCasa",player) createBlip(2181.8864746094,1115.2287597656,12.34375,32) end end) addEventHandler("onPickupHit", infoz, function(player,dim) local dono = getElementData(resourceRoot,"donoCasa") if getElementType(player) == "player" and dim then if dono == false then outputChatBox("Não existe dono, você pode comprar esta casa",player) else outputChatBox("Você é o dono desta casa pode vende-la",player) end end end) addCommandHandler("lucrar", function(player) local dono = getElementData(resourceRoot,"donoCasa") if dono ~= false and dono == player then givePlayerMoney(player,Preco_casa1) if outputChatBox("Você recebeu " .. getElementData(resourceRoot,"precoCasa") .. " de lucro.",player) then setElementData(resourceRoot,"precoCasa",0) triggerClientEvent("reajustarPreco",root,getElementData(resourceRoot,"precoCasa")) end end end) addCommandHandler("vender", function(player) local dono = getElementData(resourceRoot,"donoCasa") if dono ~= false and dono == player then setElementData(resourceRoot,"timer",0) setElementData(resourceRoot,"precoCasa",0) killTimer( timer ) givePlayerMoney(player,200000) createBlip(2181.8864746094,1115.2287597656,12.34375,31) triggerClientEvent("reajustarPreco",root,Preco_casa1) outputChatBox("Você vendeu a propriedade Come a Lot",player) end end) Link to comment
Karuzo Posted July 28, 2014 Share Posted July 28, 2014 local infoz = createPickup(2181.8864746094,1115.2287597656,12.34375,3,1273,0) local prop = createBlip(2181.8864746094,1115.2287597656,12.34375,31) addCommandHandler("comprar", function(player) local money = getPlayerMoney(player) local dono = getElementData(player,"donoCasa") if money == 200000 and dono ~= true then --- ~= siginifica diferente takePlayerMoney ( player, 200000 ) outputChatBox("Você comprou a propriedade Come a Lot",player) timer = setTimer ( function() setElementData(resourceRoot,"precoCasa",getElementData(resourceRoot,"precoCasa") + 25000) triggerClientEvent("reajustarPreco",resourceRoot,getElementData(resourceRoot,"precoCasa")) end, 60*1000, 0 ) setElementData(resourceRoot,"donoCasa",player) createBlip(2181.8864746094,1115.2287597656,12.34375,32) end end) addEventHandler("onPickupHit", infoz, function(player,dim) local dono = getElementData(resourceRoot,"donoCasa") if getElementType(player) == "player" and dim then if dono == false then outputChatBox("Não existe dono, você pode comprar esta casa",player) else outputChatBox("Você é o dono desta casa pode vende-la",player) end end end) addCommandHandler("lucrar", function(player) local dono = getElementData(resourceRoot,"donoCasa") if dono ~= false and dono == player then givePlayerMoney(player,Preco_casa1) if outputChatBox("Você recebeu " .. getElementData(resourceRoot,"precoCasa") .. " de lucro.",player) then setElementData(resourceRoot,"precoCasa",0) triggerClientEvent("reajustarPreco",root,getElementData(resourceRoot,"precoCasa")) end end end) addCommandHandler("vender", function(player) local dono = getElementData(resourceRoot,"donoCasa") if dono ~= false and dono == player then setElementData(resourceRoot,"timer",0) setElementData(resourceRoot,"precoCasa",0) killTimer( timer ) givePlayerMoney(player,200000) createBlip(2181.8864746094,1115.2287597656,12.34375,31) triggerClientEvent("reajustarPreco",root,Preco_casa1) outputChatBox("Você vendeu a propriedade Come a Lot",player) end end) Link to comment
OrbTanT Posted July 28, 2014 Author Share Posted July 28, 2014 Thank you is now working, error so easy to be solved and not realized =/ Link to comment
OrbTanT Posted July 28, 2014 Author Share Posted July 28, 2014 Now that is working, is presenting the following error, I can't solve because I do not know exactly where it is the cause of the problem, this error occurs when I was to return the profit to the DxDrawRectangle. erro: ERROR: propriedades\server.lua:16: attempt to perform arithmetic on a boolean value client: local x,y = guiGetScreenSize() setElementData(resourceRoot,"reaPreco",0) addEvent("reajustarPreco",true) addEventHandler("reajustarPreco",root, function(p) setElementData(resourceRoot,"reaPreco",p) end) local Text= "Nome: Come a lot" local Text2= "Lucro:" local Text3= "Dono:" addEventHandler("onClientRender",root, function() local Px,Py,Pz = getCameraMatrix( ) local x,y,z = 2181.8864746094,1115.2287597656,12.34375 local dis = getDistanceBetweenPoints3D(Px, Py, Pz, x, y, z) if dis <= 20 then local preco = getElementData(resourceRoot,"reaPreco") dxDrawRectangle ( 60, 320, 250, 175, tocolor(0, 0, 0, 175), false) dxDrawText ( "INFORMAÇÃO", 130, 330, 319, 426, tocolor(255, 255, 255, 255), 1.3, "default-bold" ) dxDrawText ( Text, 80, 360, 319, 426, tocolor(255, 255, 255, 255), 1.3, "default" ) dxDrawText ( Text2, 80, 450, 319, 426, tocolor(255, 255, 255, 255), 1.3, "default" ) dxDrawText ( Text3, 80, 405, 319, 426, tocolor(255, 255, 255, 255), 1.3, "default" ) dxDrawText ( tostring(preco), 130, 450, 319, 426, tocolor(255, 255, 255, 255), 1.3, "default" ) end end) server: local infoz = createPickup(2181.8864746094,1115.2287597656,12.34375,3,1273,0) local prop = createBlip(2181.8864746094,1115.2287597656,12.34375,31) addCommandHandler("comprar", function(player) local money = getPlayerMoney(player) local dono = getElementData(player,"donoCasa") if money == 200000 and dono ~= true then --- ~= siginifica diferente takePlayerMoney ( player, 200000 ) outputChatBox("Você comprou a propriedade Come a Lot",player) timer = setTimer ( function() setElementData(resourceRoot,"precoCasa",getElementData(resourceRoot,"precoCasa") + 25000) triggerClientEvent("reajustarPreco",resourceRoot,getElementData(resourceRoot,"precoCasa")) end, 60*1000, 0 ) setElementData(resourceRoot,"donoCasa",player) createBlip(2181.8864746094,1115.2287597656,12.34375,32) end end) addEventHandler("onPickupHit", infoz, function(player,dim) local dono = getElementData(resourceRoot,"donoCasa") if getElementType(player) == "player" and dim then if dono == false then outputChatBox("Não existe dono, você pode comprar esta casa",player) else outputChatBox("Você é o dono desta casa pode vende-la",player) end end end) addCommandHandler("lucrar", function(player) local dono = getElementData(resourceRoot,"donoCasa") if dono ~= false and dono == player then givePlayerMoney(player,Preco_casa1) if outputChatBox("Você recebeu " .. getElementData(resourceRoot,"precoCasa") .. " de lucro.",player) then setElementData(resourceRoot,"precoCasa",0) triggerClientEvent("reajustarPreco",root,getElementData(resourceRoot,"precoCasa")) end end end) addCommandHandler("vender", function(player) local dono = getElementData(resourceRoot,"donoCasa") if dono ~= false and dono == player then setElementData(resourceRoot,"timer",0) setElementData(resourceRoot,"precoCasa",0) killTimer( timer ) givePlayerMoney(player,200000) createBlip(2181.8864746094,1115.2287597656,12.34375,31) triggerClientEvent("reajustarPreco",root,Preco_casa1) outputChatBox("Você vendeu a propriedade Come a Lot",player) end end) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now