how to saving last position after logout,crash,disconect
#3

From the page Unte99 gave you you will notice that GetPlayerPos doesnt work in OnPlayerDisconnect callback so you'll have to use a timer to get player's position every X amount of time,and when he disconnects for any reason,you'll have to store his position in some file,then on his next connect to server to load it from the file and use it to SetPlayerPos for him,if thats what you wanna do.
pawn Код:
public OnPlayerConnect(playerid){
 SetTimerEx("SavePlayerPos",1000,true,"d",playerid);
 return 1;}

forward SavePlayerPos(playerid);
public SavePlayerPos(playerid){
 new Float:x,Float:y,Float:z;
 GetPlayerPos(playerid,x,y,z);
 return 1;}

public OnPlayerDisconnect(playerid,reason){
//here you put the stuff where you store x,y and z into a file so you can load it the next time when the player connects
return 1;}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)