SA-MP Forums Archive
"i" error - 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: "i" error (/showthread.php?tid=486358)



"i" error - Acres - 08.01.2014

hi guys i need to fix my error would be nice if i get it fixed

Line:
Код:
format(string, sizeof(string), "%s %s", level, GetPlayerName(i));
error:
Код:
error 017: undefined symbol "i"
Thanks!


Re: "i" error - rakshith122 - 08.01.2014

Try
pawn Код:
format(string, sizeof(string), "%s %s", level, GetPlayerName(pName));



Re: "i" error - newbie scripter - 08.01.2014

SHow us the loop code.

EDIT:
GetPlayerName has 3 arguments,
playerid
str
sizeof str
so it should be
new str[32];
GetPlayerName(playerid, str, sizeof str);


Re: "i" error - PowerPC603 - 08.01.2014

Код:
new pName[24];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "%s %s", level, pName);
GetPlayerName returns the length of the name, not the name itself.
https://sampwiki.blast.hk/wiki/GetPlayerName


Re: "i" error - offon - 08.01.2014

EDIT: Too late.


Re: "i" error - Acres - 08.01.2014

i got it working but.... now im admin in there im sure of it as i can use my admin cmds but it dosent show the online administartion...

SS:http://imgur.com/a/BhXFX

Code:
Код:
    if(strcmp(cmdtext, "/admins", true) == 0)
	{
    
    SendClientMessage(playerid, 0x1FFFFFF, "Administrators online:");
    {
        new level[128], string[128];

        if(PlayerInfo[playerid][pAdminLevel] >= 0)
        {
            switch(PlayerInfo[playerid][pAdminLevel])
            {
            case 1: level = ""adminlevel1" (1)";
            case 2: level = ""adminlevel2" (2)";
            case 3: level = ""adminlevel3" (3)";
            case 4: level = ""adminlevel4" (4)";
            case 5: level = ""adminlevel1338" (1338)";
            case 6: level = ""adminlevel1999" (1999)";
            case 7: level = ""adminlevel2000" (2000)";
            case 8: level = ""adminlevel2013" (2013)";
            case 9: level = ""adminlevel2014" (2014)";
            }
            format(string, sizeof(string), "%s", level, GetPlayerName(pName) );
            SendClientMessage(playerid, 0xFFF84FFFF, string);
        }
    }
    return 1;
	}