23 lines
		
	
	
	
		
			664 B
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
	
		
			664 B
		
	
	
	
		
			Lua
		
	
	
	
	
	
| local savedLocations = {}
 | |
| 
 | |
| local QBCore = exports['qb-core']:GetCoreObject()
 | |
| 
 | |
| RegisterNetEvent("qb-relogsave:server:saveLocation", function(cid, coords, heading)
 | |
|     savedLocations[cid] = {
 | |
|         pos = coords,
 | |
|         heading = heading
 | |
|     }
 | |
| end)
 | |
| 
 | |
| AddEventHandler('QBCore:Server:PlayerLoaded', function(Player)
 | |
|     local cid = Player.PlayerData.citizenid
 | |
| 
 | |
|     if savedLocations[cid] then
 | |
|         local pos = savedLocations[cid].pos
 | |
|         local heading = savedLocations[cid].heading
 | |
| 
 | |
|         TriggerClientEvent("qb-relogsave:client:restoreLocation", Player.PlayerData.source, pos, heading)
 | |
| 
 | |
|         savedLocations[cid] = nil
 | |
|     end
 | |
| end)
 | 
