[Ajuda] Pintar [ID] [ID]
#1

Aeeee gente voltei dnv :c

alguem ai tem um FS de /Pintar [id da cor 1] [id da cor2] ? os que eu achei tгo bugando ou nгo funciona :/

Procurei no search mais sу achei um gringo q nem soube programar ele direito.
Reply
#2

Strcmp
pawn Код:
if (!strcmp(cmd, "/pintarcarro") ) {

    if ( !IsPlayerInAnyVehicle(playerid))
        return SendClientMessage(playerid, -1, "Vocк nгo esta em nenhum veнculo!");
       
    tmp = strtok(cmdtext, idx);
   
    if ( !strlen(tmp) )
        return SendClientMessage(playerid, -1, "Use /pintarcarro [cor 1] [cor 2]");

    new cor1 = strval(tmp);
   
    tmp = strtok(cmdtext, idx);

    if ( !strlen(tmp) )
        return SendClientMessage(playerid, -1, "Use /pintarcarro [cor 1] [cor 2]");
       
    new cor2 = strval(tmp);
   
    if ( cor1 > 241 || cor1 < 0 || cor2 > 241 || cor2 < 0)
        return SendClientMessage(playerid, -1, "Cor invбlida! Use valores entre 0 e 241!");
       
   
    ChangeVehicleColor(GetPlayerVehicleID(playerid), cor1 , cor2 );
    format (tmp, sizeof tmp, "Cores do veнculo alteradas! Cor 1 agora й %d e cor 2 й %d", cor1, cor2);
    SendClientMessage(playerid, -1, tmp);
   
    return 1;
}
ZCMD
pawn Код:
CMD:pintarcarro(playerid, params[]) {

    if ( !IsPlayerInAnyVehicle(playerid))
        return SendClientMessage(playerid, -1, "Vocк nгo esta em nenhum veнculo!");

    new cor1, cor2;

    if ( sscanf(params, "dd", cor1, cor2) )
        return SendClientMessage(playerid, -1, "Use /pintarcarro [cor 1] [cor 2]");

    if ( cor1 > 241 || cor1 < 0 || cor2 > 241 || cor2 < 0)
        return SendClientMessage(playerid, -1, "Cor invбlida! Use valores entre 0 e 241!");

    new info[60];
    ChangeVehicleColor(GetPlayerVehicleID(playerid), cor1 , cor2 );
    format (info, sizeof info, "Cores do veнculo alteradas! Cor 1 agora й %d e cor 2 й %d", cor1, cor2);
    SendClientMessage(playerid, -1, info);

    return 1;
}
Reply
#3

Quote:
Originally Posted by iCasTiel
Посмотреть сообщение
Strcmp
pawn Код:
if (!strcmp(cmd, "/pintarcarro") ) {

    if ( !IsPlayerInAnyVehicle(playerid))
        return SendClientMessage(playerid, -1, "Vocк nгo esta em nenhum veнculo!");
       
    tmp = strtok(cmdtext, idx);
   
    if ( !strlen(tmp) )
        return SendClientMessage(playerid, -1, "Use /pintarcarro [cor 1] [cor 2]");

    new cor1 = strval(tmp);
   
    tmp = strtok(cmdtext, idx);

    if ( !strlen(tmp) )
        return SendClientMessage(playerid, -1, "Use /pintarcarro [cor 1] [cor 2]");
       
    new cor2 = strval(tmp);
   
    if ( cor1 > 241 || cor1 < 0 || cor2 > 241 || cor2 < 0)
        return SendClientMessage(playerid, -1, "Cor invбlida! Use valores entre 0 e 241!");
       
   
    ChangeVehicleColor(GetPlayerVehicleID(playerid), cor1 , cor2 );
    format (tmp, sizeof tmp, "Cores do veнculo alteradas! Cor 1 agora й %d e cor 2 й %d", cor1, cor2);
    SendClientMessage(playerid, -1, tmp);
   
    return 1;
}
ZCMD
pawn Код:
CMD:pintarcarro(playerid, params[]) {

    if ( !IsPlayerInAnyVehicle(playerid))
        return SendClientMessage(playerid, -1, "Vocк nгo esta em nenhum veнculo!");

    new cor1, cor2;

    if ( sscanf(params, "dd", cor1, cor2) )
        return SendClientMessage(playerid, -1, "Use /pintarcarro [cor 1] [cor 2]");

    if ( cor1 > 241 || cor1 < 0 || cor2 > 241 || cor2 < 0)
        return SendClientMessage(playerid, -1, "Cor invбlida! Use valores entre 0 e 241!");

    new info[60];
    ChangeVehicleColor(GetPlayerVehicleID(playerid), cor1 , cor2 );
    format (info, sizeof info, "Cores do veнculo alteradas! Cor 1 agora й %d e cor 2 й %d", cor1, cor2);
    SendClientMessage(playerid, -1, info);

    return 1;
}
pawn Код:
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(627) : error 017: undefined symbol "cmd"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(632) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(632) : error 017: undefined symbol "idx"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(634) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(637) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(639) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(639) : error 017: undefined symbol "idx"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(641) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(644) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(651) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(651) : error 017: undefined symbol "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(652) : error 017: undefined symbol "tmp"
Reply
#4

Crie essas variбveis.

pawn Код:
new cmd
new tmp
new idx
e compila. Acho que й isto.
Reply
#5

Quote:
Originally Posted by GodsAndMonsters
Посмотреть сообщение
Crie essas variбveis.

pawn Код:
new cmd
new tmp
new idx
e compila. Acho que й isto.
pawn Код:
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(628) : error 017: undefined symbol "cmd"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(635) : error 006: must be assigned to an array
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(637) : error 035: argument type mismatch (argument 1)
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(640) : error 035: argument type mismatch (argument 1)
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(642) : error 006: must be assigned to an array
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(644) : error 035: argument type mismatch (argument 1)
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(647) : error 035: argument type mismatch (argument 1)
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(654) : error 035: argument type mismatch (argument 1)
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(654) : error 035: argument type mismatch (argument 1)
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(655) : error 035: argument type mismatch (argument 3)
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(642) : warning 204: symbol is assigned a value that is never used: "tmp"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(629) : warning 203: symbol is never used: "cmd"
Acho q tem que ter algum valor mais nгo sei qual :/
Reply
#6

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) {

    new cmd[128], idx;
    new tmp[128];
   
    cmd = strtok(cmdtext, idx);

    if (!strcmp(cmd, "/pintarcarro") ) {

        if ( !IsPlayerInAnyVehicle(playerid))
            return SendClientMessage(playerid, -1, "Vocк nгo esta em nenhum veнculo!");

        tmp = strtok(cmdtext, idx);

        if ( !strlen(tmp) )
            return SendClientMessage(playerid, -1, "Use /pintarcarro [cor 1] [cor 2]");

        new cor1 = strval(tmp);

        tmp = strtok(cmdtext, idx);

        if ( !strlen(tmp) )
            return SendClientMessage(playerid, -1, "Use /pintarcarro [cor 1] [cor 2]");

        new cor2 = strval(tmp);

        if ( cor1 > 241 || cor1 < 0 || cor2 > 241 || cor2 < 0)
            return SendClientMessage(playerid, -1, "Cor invбlida! Use valores entre 0 e 241!");


        ChangeVehicleColor(GetPlayerVehicleID (playerid), cor1 , cor2 );
        format (tmp, sizeof tmp, "Cores do veнculo alteradas! Cor 1 agora й %d e cor 2 й %d", cor1, cor2);
        SendClientMessage(playerid, -1, tmp);

        return 1;
    }

    return 0;
}

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;
}
Somente redefina o nъmero de cйlulas!
Reply
#7

pawn Код:
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(628) : error 017: undefined symbol "cmd"
C:\Downloads\samp03x_svr_R2_win32\gamemodes\AKD.pwn(629) : warning 204: symbol is assigned a value that is never used: "cmd"
Reply
#8

to tentano aki, mais tб f0da :c
Reply
#9

pawn Код:
if (!strcmp(cmdtext, "/pintarcarro") ) {
com o sistema cmd da erro, com cmdtext nгo da erro, e nem pintar no serve da :/
Reply
#10

pawn Код:
new cmd[64],idx;
    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/pintar", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new
                string[128],
                tmp[64];
            tmp = strtok(cmdtext, idx);
            new
                tmp2 = strval(tmp);
            ChangeVehicleColor(GetPlayerVehicleID(playerid),tmp2,tmp2);
            format(string, sizeof(string),"Cor do seu carro foi mudada para: %i",tmp2);
            SendClientMessage(playerid, 0xF60000AA, string);
        }
        else return SendClientMessage(playerid, 0xF60000AA, "Erro: Vocк nгo ta em nenhum veнculo man!");
        return 1;
    }
Pronto, deixei esse ai mesmo ^^
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)