SA-MP Forums Archive
How 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: How to check if a player is new? (/showthread.php?tid=457373)



How to check if a player is new? - Jamcraftadam - 11.08.2013

Hello, I have created my login system, and I want to check if a player is new to the server, after registering. How is that done? (I prefer OnPlayerSpawn if possible ), I have searched but I cannot find a topic like the situation I am after. Thank you in advance


Re: How to check if a player is new? - DobbysGamertag - 11.08.2013

Add a boolean to your script

pawn Код:
new bool:IsNew[MAX_PLAYERS];

//somewhere you check if they've registered. EG, showing a register dialog.

IsNew[playerid]=true;

//Actually adding the account, or making them "not new".

IsNew[playerid]=false;

//example
public OnPlayerSpawn(playerid)
{
    if(IsNew[playerid]==true)
    {
        SendClientMessage(playerid,-1,"Welcome.");
        IsNew[playerid]=false;
    }
    return 1;
}
Hope it helped


Re: How to check if a player is new? - Misiur - 11.08.2013

Well, if you have login system, this means that you already implemented some kind of storage system. Check if file for this user exists and based on that you can tell that he already registered.

#e: Oh, after registering - you need to store this information in file/database then load it and check it


Re: How to check if a player is new? - RajatPawar - 11.08.2013

If a player is new - that means he's just registered. Add whatever you want to do after that!
pawn Код:
public OnPlayerRegister(playerid)
{
         register_player_account(playerid..);
         Do_Whatever_with_him_because_he's_new( playerid );
}
Because obviously - a player registers only once! (Unless, a faulty login system)


Re: How to check if a player is new? - Jamcraftadam - 11.08.2013

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
Add a boolean to your script

pawn Код:
new bool:IsNew[MAX_PLAYERS];

//somewhere you check if they've registered. EG, showing a register dialog.

IsNew[playerid]=true;

//Actually adding the account, or making them "not new".

IsNew[playerid]=false;

//example
public OnPlayerSpawn(playerid)
{
    if(IsNew[playerid]==true)
    {
        SendClientMessage(playerid,-1,"Welcome.");
        IsNew[playerid]=false;
    }
    return 1;
}
Hope it helped
Alrighty, I'll give this one try, Thanks