SA-MP Forums Archive
About saving position - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: About saving position (/showthread.php?tid=87890)



About saving position - pierhs - 22.07.2009

If I want to use a position saving system should i delete SetPlayerSpawn?Thanks


Re: About saving position - James_Alex - 22.07.2009

no lol !
juste use "OnPlayerRequestClass"


Re: About saving position - pierhs - 22.07.2009

Can u explain this better?I mean OnPlayerRequestClass.Thanks again James



Re: About saving position - James_Alex - 22.07.2009

no it's no "OnPLayerRequestClass"
juste "OnPlayerRequestSpawn"

and put there the saved postions


Re: About saving position - pierhs - 22.07.2009

You didnt understand what I mean.When I talk about saving position I mean the last position of a player before disconnect.



Re: About saving position - James_Alex - 22.07.2009

ah you want a saving position function ?
try this
use dini include
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
  new str[256], plname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, plname, sizeof(plname));
  format(str, sizeof(str), "%s.ini", plname);  
  new Float:X, Y, Z;
  GetPlayerPos(playerid, X, Y, Z);
  dini_FloatSet(str, "X", X);
  dini_FloatSet(str, "Y", Y);
  dini_FloatSet(str, "Z", Z);
  return 1;
}

public OnPlayerRequestSpawn(playerid)
{
  new str[256], plname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, plname, sizeof(plname));
  format(str, sizeof(str), "%s.ini", plname);    
  SetPlayerPos(playerid, dini_Float(str, "X"), dini_Float(str, "Y"), dini_Float(str, "Z"));
  return 1;
}



Re: About saving position - _ASUS_ - 23.07.2009

Quote:
Originally Posted by James_Alex(Coder)
ah you want a saving position function ?
try this
use dini include
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
  new str[256], plname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, plname, sizeof(plname));
  format(str, sizeof(str), "%s.ini", plname);  
  new Float:X, Y, Z;
  GetPlayerPos(playerid, X, Y, Z);
  dini_FloatSet(str, "X", X);
  dini_FloatSet(str, "Y", Y);
  dini_FloatSet(str, "Z", Z);
  return 1;
}

public OnPlayerRequestSpawn(playerid)
{
  new str[256], plname[MAX_PLAYER_NAME];
  GetPlayerName(playerid, plname, sizeof(plname));
  format(str, sizeof(str), "%s.ini", plname);    
  SetPlayerPos(playerid, dini_Float(str, "X"), dini_Float(str, "Y"), dini_Float(str, "Z"));
  return 1;
}
Does it work??


Re: About saving position - Joe Staff - 23.07.2009

If you have the dini include it should work marvelously.

But I'm just gonna go ahead and assume you don't.


Re: About saving position - _ASUS_ - 23.07.2009

Quote:
Originally Posted by SilentHuntR
If you have the dini include it should work marvelously.

But I'm just gonna go ahead and assume you don't.
No it doesnt work!!! I tryed it and nope


Re: About saving position - pierhs - 23.07.2009

I searched in wiki about saving position and it has an example code that used fopen,fwrite,fclose etc.should it work?