Carcolor
#1

I want to make a /carcolor command but I got some errors.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256], tmp[256], idx;
    if(strcmp(cmd, "/carcolor", true) == 0) {
        new color1, color2;
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /carcolor [color1] [color2]");
        color1 = strval(tmp);
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /carcolor [color1] [color2]");
        color2 = strval(tmp);
        ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
        return 1;
    }
//More
pawn Код:
stock 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;
}
Errors:
pawn Код:
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5574) : error 035: argument type mismatch (argument 3)
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5582) : error 035: argument type mismatch (argument 3)
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5643) : error 021: symbol already defined: "cmd"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5644) : error 021: symbol already defined: "idx"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5648) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(6937) : error 001: expected token: ")", but found "&"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(6937) : error 029: invalid expression, assumed zero
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(6937) : error 010: invalid function or declaration
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(6937 -- 6941) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


8 Errors.
Reply
#2

For "Argument Type Mismatch" it would be that you used the wrong format.

For the Symbol already defined, it means that it is already declared / used in other places
( Use another name for it instead )
Invalid expression = Wrong use of your way of using your declared object.

The rest is harder to explain.
Reply
#3

Delete: new cmd[256], tmp[256], idx;
Wich line is 5582 and 6937?
Reply
#4

I delete
pawn Код:
new cmd[256], tmp[256], idx;
and now i got these
pawn Код:
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5653) : error 017: undefined symbol "tmp"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5654) : error 017: undefined symbol "tmp"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5655) : error 017: undefined symbol "tmp"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5656) : error 017: undefined symbol "tmp"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5657) : error 017: undefined symbol "tmp"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5658) : error 017: undefined symbol "tmp"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


6 Errors.
Reply
#5

Quote:
Originally Posted by Kostas'
Посмотреть сообщение
I delete
pawn Код:
new cmd[256], tmp[256], idx;
and now i got these
pawn Код:
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5653) : error 017: undefined symbol "tmp"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5654) : error 017: undefined symbol "tmp"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5655) : error 017: undefined symbol "tmp"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5656) : error 017: undefined symbol "tmp"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5657) : error 017: undefined symbol "tmp"
C:\Documents and Settings\orion\Фб ЭггсбцЬ мпх\Downloads\samp03csvr_R2-2_win32 (2)\gamemodes\Xtreamgaming.pwn(5658) : error 017: undefined symbol "tmp"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


6 Errors.
Probably looking at the errors you need to put
pawn Код:
new tmp[256]
back into the script so it will be defined.
Just me talking.

7 second wait. /Ragequit


And im new, so its just me THINKING.
So dont u be trolling me.
Reply
#6

Quote:
Originally Posted by MichaelNerd
Посмотреть сообщение
Probably looking at the errors you need to put
pawn Код:
new tmp[256]
back into the script so it will be defined.
Just me talking.

7 second wait. /Ragequit


And im new, so its just me THINKING.
So dont u be trolling me.
Also, this
pawn Код:
new tmp[256]
it needs

pawn Код:
new tmp[256];
Thank you for the help, it works!
Reply
#7

No problem. ^^

Pff gotta wait 43 seconds.
Im so damn active when on forums XD.
22 seconds pff.
Reply
#8

xD
Can you help me in something last about colors.
How can I make a /color <red> <green> <blue> command.
I tried a lot of them but I can't compile, i got errors
Reply
#9

Send me a screenshot in private message.
Of the code and the error.
Ill see what i can do.
You might get it in 1 hour if you're lucky and else ill send the solution in a private message.
Im posting between my work :P.
Reply
#10

I deleted them from my gamemode, because I couldn't compile it.
And I don't remember which I had.
Can you make one or suggest me someone else to try it.
If I still get errors I will post it here or I will send you private message.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)