Hello , lately i was making something like an house system. and i stopped at this warning. which i can't really solve , or my lua experience is too small.
it appears that the code below doesn't seem to get the housemark variable.. and that's why the warning comes , and the script doesn't really work any more , any ideas how to solve it? Thanks
CODE:
function addhouses(thePlayer,command,arg)
local x,y,z = getElementPosition(thePlayer)
local r,g,b = 255,255,0
housemark = createMarker ( x , y, z+1, "arrow", 1.5, r, g, b, 170 )
if (housemark) then outputDebugString("house created")
setElementData(housemark,"mtasa-house",true)
setElementData(housemark,"mtasa-housename",arg)
-- if getElementData(house,"mtasa-housesold") == false
end
end
addCommandHandler("addhouse",addhouses)
function househit(player)
if getElementType( player ) == 'player' and not getPedOccupiedVehicle( player ) then
if not isGuestAccount( getPlayerAccount( player ) ) then
--some stuff happens here
else
outputChatBox( 'You must be logged in', player, 255, 51, 36 );
end;
end;
end
addEventHandler("onMarkerHit",housemark,househit)
ERROR:
WARNING: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil]