Simple as it is, it caches the positions serverside and writes it in the database every few seconds (you can change the iteration speed in the server.lua file)
Uses less performance than other scripts and saves more locations at the same time :)!
No need for ESX, you can use it with every framework you like.
Dependency is MySQL-Async.
If you do not use ESX, you might need to change the MySQL queries.
I actually did not know that, so I can just “use” the Ped Serversided with GetPlayerPed()?
And yeah, well the command is clientsided because it just triggers the event, if i’d do it serverside i would need to use TriggerClient -> Triggerserver. correct me if im wrong
but thank you for the onesync tip!
Is there a kind of documentation of onesync natives?
RegisterCommand('savepos', function(source, args, raw)
steamId = GetPlayerIdentifier(source, 0)
if(steamId ~= nil) then
x, y, z = table.unpack(positions[steamId])
encoded = '{' .. x .. ', ' .. y .. ', ' .. z .. '}'
MySQL.Async.execute('UPDATE users SET lastpos = "' .. encoded .. '" WHERE identifier = "' .. steamId .. '";', {}, function(success)
if(success == 0) then
print("MySQL failure")
end
end)
else
print("Failed to save position for " .. steamId)
end
end)