Three errors:P
#1

C:\Users\Karja\Desktop\BPRP\gamemodes\newrp.pwn(22 7) : error 017: undefined symbol "ReturnUser"
C:\Users\Karja\Desktop\BPRP\gamemodes\newrp.pwn(72 0) : error 021: symbol already defined: "strtok"
C:\Users\Karja\Desktop\BPRP\gamemodes\newrp.pwn(73 5) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.


And Error Codes:


pawn Код:
if(strcmp(cmd, "/kick", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Juhis: /kick [ID/Nimi] [Pхhjus]");
                return 1;
            }
            [COLOR="Red"]giveplayerid = ReturnUser(tmp);[/COLOR] <<< This line is 227
            if (GetAdminLevel(playerid) >=1)
            {
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SendClientMessage(playerid, COLOR_GRAD2, "Juhis: /kick [ID/Nimi] [Pхhjus]");
                            return 1;
                        }
                        new year, month,day;
                        getdate(year, month, day);
                        format(string, sizeof(string), "Teade: %s kickiti administraator %s poolt! Pхhjus: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
                        KickiLogi(string);
                        format(string, sizeof(string), "Teade: %s kickiti administraator %s poolt! Pхhjus: %s", giveplayer, sendername, (result));
                        SendClientMessageToAll(COLOR_LIGHTRED, string);
                        Kick(giveplayerid);
                        return 1;
                    }
                }
            }
            else
            {
                format(string, sizeof(string), "   %d pole vхrgus.", giveplayerid);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
        }
        return 1;
    }
Next:

pawn Код:
strtok(const string[], &index)
[COLOR="Red"]{[/COLOR] << This line is 720
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[64];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    [COLOR="Red"]return result;[/COLOR] << This line is 735
}
Reply
#2

1) Get rid of the first IsPlayerConnected(playerid) check in that command. A command can not be executed by an unconnected player.
2) Do you have the ReturnUser function?
3) Is the strtok function present only once?
4) I'd recommend using ZCMD with sscanf. Here's a tutorial of mine.

Vхi siis:
1) Kustuta esimene IsPlayerConnected(playerid) tsьkkel. Seda pole vaja sest kasutaja, kes pole serveris, ei saa ьhtegi commandi kasutada.
2) Kas ReturnUser funktsioon eksisteerib?
3) Kas strtok funktsiooni esineb vaid 1 kord?
4) Ьldiselt soovitaksin kasutada ZCMD-d koos sscanfiga. Siit leiad ьhe minu хpetuse.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)