SA-MP Forums Archive
GetPlayerID help - 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: GetPlayerID help (/showthread.php?tid=391123)



GetPlayerID help - Sam5513 - 09.11.2012

Hey guys. Got a question. Im declared a global variable restrict which allows me to set other people admins. I want to set restric to 0 when player successfully connects as admin, but I can't seem to find out how to get the playerid of the player. Thanks in advance

Код:
public OnRconLoginAttempt(ip[], password[], success)
{
	if(success)
	{
		  restrict(playerid)=0;
		  return 1;
    }
	return 1;
}
gives me an error about the playerid.


Re: GetPlayerID help - Kyle - 09.11.2012

wiki.sa-mp.com/wiki/OnRconLoginAttempt


Re: GetPlayerID help - tyler12 - 09.11.2012

PHP код:
public OnRconLoginAttempt(ip[], password[], success)
{
    if(
success)
    {
          
restrict[playerid]=0;
          return 
1;
    }
    return 
1;




Re: GetPlayerID help - Konstantinos - 09.11.2012

You can only via IP. If the player with the IP logged in successfully, it passes from a loop to find that ip, if it matches, it sets the restrict to that person with that IP.
pawn Код:
public OnRconLoginAttempt( ip[ ], password[ ], success )
{
    if( success )
    {
        new
            pip[ 16 ]
        ;
        for( new i = 0; i < MAX_PLAYERS; i++ )
        {
            GetPlayerIp( i, pip, sizeof( pip ) );
            if( !strcmp( ip, pip, true ) )
            {
                restrict[ i ] = 0;
            }
        }
    }
    return 1;
}



Re: GetPlayerID help - Sam5513 - 09.11.2012

Thank you very much. Great help