errors "undefined symbol"
#1

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
Reply
#2

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

But i still suggest Foreach.
Reply
#3

Why vehicles?
Reply
#4

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;
}
Reply
#5

Thanks iMonkey, what did you change?
Reply
#6

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

Marricio, didn't work. But thanks

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

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 )
Reply
#9

Ok thanks

Yes I will ^^
Reply
#10

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)