Now I have this:
client side:
function fuelRefill()
if not isPedInVehicle(localPlayer) then return end
local state = triggerServerEvent("getPlayerState", resourceRoot, localPlayer)
if state ~= "alive" then return end
for i,marker in ipairs(refill_stations) do
local p_veh = getPedOccupiedVehicle(localPlayer)
if isElementWithinMarker(p_veh, marker) and fuel < 100 thenfuel = fuel + r_rate end
end
end
server side:
function getPlayerState(player)
local state = getElementData(player, "player state")
if state then
return state
end
return false
end
addEvent("getPlayerState", true)
addEventHandler("getPlayerState", resourceRoot, getPlayerState)
meta:
<export function="getPlayerState" type="server"/>
Line 3: local state = triggerServerEvent("getPlayerState", resourceRoot, localPlayer)
Line 3 isn't working yet, how can I make it working?