SA-MP Forums Archive
Looking for a function to check if a player is new - 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)
+--- Thread: Looking for a function to check if a player is new (/showthread.php?tid=426242)



Looking for a function to check if a player is new - Jamcraftadam - 28.03.2013

Hello, I wanted to make an rp server, but im only stuck on one thing, making new players spawn at a position, if there is, what can i do to make new players spawn at a specified position.


Re: Looking for a function to check if a player is new - pasha97 - 28.03.2013

Quote:
Originally Posted by Jamcraftadam
Посмотреть сообщение
Hello, I wanted to make an rp server, but im only stuck on one thing, making new players spawn at a position, if there is, what can i do to make new players spawn at a specified position.
DO you mean new players, whohave just entered the server? Or who entered it the first time in their life?

In case of first occation:
1.Create a player variable, for example:
Код:
 NewPlayer[MAX_PLAYERS];
2.To OnPlayerConnect put:
Код:
 NewPlayer[playerid]=1;
3.To OnPlayerDisconnect put:
Код:
 NewPlayer[playerid]=0;
4.In OnPlayerSpawn put:
pawn Код:
if(NewPlayer[playerid] == 1) SetPlayerPos(/*set position for new player*/);
else SetPlayerPos(/*Set position for old players*/);
In case of second occation: You need to use registration system


AW: Re: Looking for a function to check if a player is new - Jamcraftadam - 28.03.2013

Quote:
Originally Posted by pasha97
Посмотреть сообщение
DO you mean new players, whohave just entered the server? Or who entered it the first time in their life?

In case of first occation:
1.Create a player variable, for example:
Код:
 NewPlayer[MAX_PLAYERS];
2.To OnPlayerConnect put:
Код:
 NewPlayer[playerid]=1;
3.To OnPlayerDisconnect put:
Код:
 NewPlayer[playerid]=0;
4.In OnPlayerSpawn put:
pawn Код:
if(NewPlayer[playerid] == 1) SetPlayerPos(/*set position for new player*/);
else SetPlayerPos(/*Set position for old players*/);
In case of second occation: You need to use registration system
Im using YINI, Ive got the saving done, i dont know how i can load it, It says undefined symbol X ect


Re: Looking for a function to check if a player is new - Da_Noob - 28.03.2013

use fexist.

I suppose you're saving them by the users name?

Then do something like this:

pawn Код:
new file[32], name[24];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"Users/%s.ini", name);
if(!fexist(file)) { /* Set the player pos when he's not registered */ }
else if(fexist(file)) { /* Set the player pos when he's registered */ }



AW: Re: Looking for a function to check if a player is new - Jamcraftadam - 28.03.2013

Im already done my login system using YINI, just not defining X Y Or Z, they are all in my enums and ini_write/float


AW: Re: Looking for a function to check if a player is new - Jamcraftadam - 30.03.2013

Quote:
Originally Posted by pasha97
Посмотреть сообщение
DO you mean new players, whohave just entered the server? Or who entered it the first time in their life?

In case of first occation:
1.Create a player variable, for example:
Код:
 NewPlayer[MAX_PLAYERS];
2.To OnPlayerConnect put:
Код:
 NewPlayer[playerid]=1;
3.To OnPlayerDisconnect put:
Код:
 NewPlayer[playerid]=0;
4.In OnPlayerSpawn put:
pawn Код:
if(NewPlayer[playerid] == 1) SetPlayerPos(/*set position for new player*/);
else SetPlayerPos(/*Set position for old players*/);
In case of second occation: You need to use registration system
Thank you soo much, il try this, sorry for late reply