About saving position
#1

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

no lol !
juste use "OnPlayerRequestClass"
Reply
#3

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

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

and put there the saved postions
Reply
#5

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

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;
}
Reply
#7

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??
Reply
#8

If you have the dini include it should work marvelously.

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

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
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)