Errors
#1

How can I fix these errors
Код:
C:\Users\Osman Ali\Desktop\Skin.pwn(92) : error 017: undefined symbol "strtok"
C:\Users\Osman Ali\Desktop\Skin.pwn(92) : error 033: array must be indexed (variable "cmd")
C:\Users\Osman Ali\Desktop\Skin.pwn(98) : error 017: undefined symbol "strtok"
C:\Users\Osman Ali\Desktop\Skin.pwn(98) : error 033: array must be indexed (variable "tmp")
C:\Users\Osman Ali\Desktop\Skin.pwn(91) : warning 203: symbol is never used: "idx"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
THis is the script.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128], idx;
    cmd = strtok(cmdtext, idx);
    if(strcmp("/clothes", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,40.0,207.4733,-109.8061,1005.1328))
        {
            new tmp[128];
            tmp = strtok(cmdtext, idx);
            if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /clothes [skinid]");
            if(strval(tmp) >= 0 && strval(tmp) <= 299) SetPlayerSkin(playerid, strval(tmp)); //Checks if valid skinid.  Also, make sure you restrict skins that aren't used, because if there is a skinid with no skin, player crashes.
        }
        else return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in range of whatever");
        return 1;
    }
    return 0;
}
Reply
#2

Add this

pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
 
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply
#3

Any help it dont change my skin
Reply
#4

Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
 
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Add this on the top of your script Over all defines and includes.
Reply
#5

It gives errors then

C:\Users\Osman Ali\Desktop\BC\gamemodes\COS-RP.pwn(4) : error 017: undefined symbol "strlen"
C:\Users\Osman Ali\Desktop\BC\gamemodes\COS-RP.pwn(4) : warning 215: expression has no effect
C:\Users\Osman Ali\Desktop\BC\gamemodes\COS-RP.pwn(4) : error 001: expected token: ";", but found ")"
C:\Users\Osman Ali\Desktop\BC\gamemodes\COS-RP.pwn(4) : error 029: invalid expression, assumed zero
C:\Users\Osman Ali\Desktop\BC\gamemodes\COS-RP.pwn(4) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)