Quote from: PSL on Mar 09, 2024, 08:11 AMThe following code may help youCode SelectDiePos<-{}; //Create a table where you can store coordinates
function onPlayerSpawn(player)
{
if(DiePos.rawin(player.ID)) //If an ID exists in the table
{
player.Pos=DiePos.rawget(player.ID); //Restores the player to death point
DiePos.rawdelete(player.ID); //Delete coordinates after recovery
}
}
function onPlayerDeath(player,reason)
{
DiePos.rawset(player.ID,player.Pos); //After the player dies, the ID is used as the search object, and the death coordinates are stored in the table
}
You should also remove the player data once the player disconnects.
Code Select
function onPlayerPart(player, reason) {
if (DiePos.rawin(player.ID))
DiePos.rawdelete(player.ID);
}