SA-MP Forums Archive
errors "undefined symbol" - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: errors "undefined symbol" (/showthread.php?tid=229503)



errors "undefined symbol" - xir - 21.02.2011

Hi I have this command, while I compile I get the "undefined symbol [i]" which I dont know how to define.

Here is the code

http://pastebin.com/8m7EBUbB

errors

pawn Код:
E:\GTA San Andreas\DM\gamemodes\zcmd.pwn(2885) : error 017: undefined symbol "i"
E:\GTA San Andreas\DM\gamemodes\zcmd.pwn(2885) : warning 215: expression has no effect
E:\GTA San Andreas\DM\gamemodes\zcmd.pwn(2889) : error 017: undefined symbol "i"
E:\GTA San Andreas\DM\gamemodes\zcmd.pwn(2890) : error 017: undefined symbol "i"
E:\GTA San Andreas\DM\gamemodes\zcmd.pwn(2892) : error 017: undefined symbol "i"
E:\GTA San Andreas\DM\gamemodes\zcmd.pwn(2903) : error 017: undefined symbol "i"
E:\GTA San Andreas\DM\gamemodes\zcmd.pwn(2903) : warning 215: expression has no effect
E:\GTA San Andreas\DM\gamemodes\zcmd.pwn(2907) : error 017: undefined symbol "i"
E:\GTA San Andreas\DM\gamemodes\zcmd.pwn(2908) : error 017: undefined symbol "i"
E:\GTA San Andreas\DM\gamemodes\zcmd.pwn(2910) : error 017: undefined symbol "i"
Please help


Re: errors "undefined symbol" - Marricio - 21.02.2011

for(new i; i<MAX_VEHICLES; i++)

But i still suggest Foreach.


Re: errors "undefined symbol" - xir - 21.02.2011

Why vehicles?


Re: errors "undefined symbol" - iMonk3y - 21.02.2011

I (hopefully) have fixed your code.

pawn Код:
COMMAND:createclan(playerid, params[])
{
    new tag[32], type, sendername[MAX_PLAYER_NAME], string[128], result[128];
    if(KeyInfo[playerid][pRank] > 0) return SendClientMessage(playerid,Red,"You are already in a clan !");
    if (sscanf(params, "is[32]", type, tag)) return SendClientMessage(playerid, Yellow, "Usage: /createclan [1 (start) / 2 (end)] [tag], Do not include [ or ] in the tag");
    new Clann = KeyInfo[playerid][pClan];
    for(new i = 0; i < sizeof(Clans); i++) {
        if(Clann != 255) {
            SendClientMessage(playerid,Red,"You are in a clan !");
            return 1;
        }
        if(strmatch(Clans[i][cName],result)) return SendClientMessage(playerid,Red,"Clan name already exists !");
        switch (type) {
            case 1:
            {
                i = lastclan;
                KeyInfo[playerid][pClan] = lastclan;
                KeyInfo[playerid][pRank] = 3;
                GetPlayerName(playerid,sendername,sizeof(sendername));
                strmid(Clans[i][clOwner], sendername, 0, strlen(sendername), 255);
                strmid(Clans[i][cName], result, 0, strlen(result), 255);
                Clans[i][Front] = 1;
                format(string,sizeof(string),"You have created the clan [%s], at the front of your name.",result);
                SendClientMessage(playerid,Green,string);
                lastclan++;
                SaveClans();
                OnPlayerDataSave(playerid);
                return 1;
            }
            case 2:
            {
                i = lastclan;
                KeyInfo[playerid][pClan] = lastclan;
                KeyInfo[playerid][pRank] = 3;
                GetPlayerName(playerid,sendername,sizeof(sendername));
                strmid(Clans[i][clOwner], sendername, 0, strlen(sendername), 255);
                strmid(Clans[i][cName], result, 0, strlen(result), 255);
                Clans[i][Back] = 1;
                format(string,sizeof(string),"You have created the clan [%s], at the back of your name.",result);
                SendClientMessage(playerid,Green,string);
                lastclan++;
                SaveClans();
                OnPlayerDataSave(playerid);
                return 1;
            }
            default:
            {
                SendClientMessage(playerid, Green, "Test");
            }
        }
    }
    return 1;
}



Re: errors "undefined symbol" - xir - 21.02.2011

Thanks iMonkey, what did you change?


Re: errors "undefined symbol" - Marricio - 21.02.2011

Quote:
Originally Posted by xir
Посмотреть сообщение
Why vehicles?
Ahh... Sry im sleepy put CLANS :S


Re: errors "undefined symbol" - xir - 21.02.2011

Marricio, didn't work. But thanks

iMonkey's code worked fine, I just wait for what he did


Re: errors "undefined symbol" - iMonk3y - 21.02.2011

Quote:
Originally Posted by xir
Посмотреть сообщение
Thanks iMonkey, what did you change?
Braces... not a big deal ( but you can still add me in credits ;P )


Re: errors "undefined symbol" - xir - 21.02.2011

Ok thanks

Yes I will ^^


Re: errors "undefined symbol" - xir - 21.02.2011

I've got another problem, theres gotta be a problem with this line, it says "Clan name already exitst" when I try to write a name that doesnt exit, no matter what I write :S

heres the line

pawn Код:
if(strmatch(Clans[i][cName],result)) return SendClientMessage(playerid,Red,"Clan name already exists !");
whats wrong?