SA-MP Forums Archive
Easy question; GetPlayerID [REP+] - 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: Easy question; GetPlayerID [REP+] (/showthread.php?tid=581691)



Easy question; GetPlayerID [REP+] - MarcGonzales - 14.07.2015

Here's the code
PHP код:
stock GetPlayerID(Name[])
{
    new 
pName[24];
    for(new 
0MAX_PLAYERSi++)
    {
        
GetPlayerName(ipNamesizeof(pName));
        if(
strcmp(NamepNametrue)==0)
        {
            return 
i;
        }
    }
    return 
1;

Errors

PHP код:
C:\Users\zero\Downloads\samp037_svr_R1_win32 (1)aa\gamemodes\FAKE.pwn(527) : warning 219local variable "Name" shadows a variable at a preceding level
C
:\Users\zero\Downloads\samp037_svr_R1_win32 (1)aa\gamemodes\FAKE.pwn(533) : error 035argument type mismatch (argument 1
The first error line
PHP код:
stock GetPlayerID(Name[]) 
Second error
PHP код:
if(strcmp(NamepNametrue)==0



Re: Easy question; GetPlayerID [REP+] - Lajko1 - 14.07.2015

Try change Name into NAME


Re: Easy question; GetPlayerID [REP+] - Vince - 14.07.2015

https://sampforum.blast.hk/showthread.php?tid=570927


Re: Easy question; GetPlayerID [REP+] - MarcGonzales - 15.07.2015

Quote:
Originally Posted by Vince
Посмотреть сообщение
Can you do it in sscanf for me?


Re: Easy question; GetPlayerID [REP+] - fuckingcruse - 15.07.2015

It says that the word " Name " is already use , chane it to something else like name1 , name2 ..
. So on


Re: Easy question; GetPlayerID [REP+] - Abagail - 15.07.2015

pawn Код:
GetPlayerID(Name[])
{
       new giveplayerid;
       sscanf(Name, "u", giveplayerid);
       return giveplayerid;
}
Or as a macro:

pawn Код:
#define GetPlayerID(%0) \
        sscanf(%0, "u", %0); \
           return %0