SA-MP Forums Archive
[Pedido] /pintar [Cor ID] [Cor 2 ID] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Pedido] /pintar [Cor ID] [Cor 2 ID] (/showthread.php?tid=297789)



[Pedido] /pintar [Cor ID] [Cor 2 ID] - Gustavo_Samp - 17.11.2011

Olб pessoal, gostaria de pidir a vocкs um sistema de /pintar [Cor ID] [Cor 2 ID]

obrigado



Re: Ajude-Me - ViniBorn - 17.11.2011

pawn Код:
if(!strcmp("/pintar",cmdtext))
{
    new tmp[24], idx; tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
        return SendClientMessage(playerid, -1, "/pintar [cor 1] [cor 2]");

    new color1 = strval(tmp);
    if(color1 < 0 || color1 > 300)
        return SendClientMessage(playerid, -1, "Cores de 0/300.");

    new color2;
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
        color2 = color1;
    else
        color2 = strval(tmp);

    if(color2 < 0 || color2 > 300)
        return SendClientMessage(playerid, -1, "Cores de 0/300.");

    ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
}



Re: Ajude-Me - Gustavo_Samp - 17.11.2011

Vini: error C:\Users\Gustavo 2\Desktop\Server 0.3a r8\gamemodes\Bw_World.pwn(2820) : error 017: undefined symbol "CarColor"
C:\Users\Gustavo 2\Desktop\Server 0.3a r8\gamemodes\Bw_World.pwn(2820) : warning 215: expression has no effect
C:\Users\Gustavo 2\Desktop\Server 0.3a r8\gamemodes\Bw_World.pwn(2820) : error 001: expected token: ";", but found "]"
C:\Users\Gustavo 2\Desktop\Server 0.3a r8\gamemodes\Bw_World.pwn(2820) : error 029: invalid expression, assumed zero
C:\Users\Gustavo 2\Desktop\Server 0.3a r8\gamemodes\Bw_World.pwn(2820) : fatal error 107: too many error messages on one line

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


4 Errors.


linha:

pawn Код:
CarColor[playerid][0] = color1;



Re: Ajude-Me - [KoS]Izaac - 17.11.2011

Tenta esse mais simplisinho

pawn Код:
pawn Code:
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 teu carro foi mudada para: %i",tmp2);
            SendClientMessage(playerid, 0xF60000AA, string);
        }
        else return SendClientMessage(playerid, 0xF60000AA, "Erro: Ce nao ta em nenhum veнculo negao!");
        return 1;
    }
Offtopic: profissional e com 2 "S" amigo...


Re: Ajude-Me - [R] ousenber [K] - 17.11.2011

Se quiser :

ZCMD + sscanf

PHP код:
CMD:pintar(playeridparams[])
{
    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1"Antes vocк precisa de um veiculo.");
    new 
Corez[2];
    if(
sscanf(params"ii"Corez[0], Corez[1])) return SendClientMessage(playerid, -1" [Erro] Use /pintar [Cor1][Cor2]");
    if(
Corez[0] < || Corez[0] > 126) return SendClientMessage(playerid, -1"Cores de 0 a 126!");
    if(
Corez[1] < || Corez[1] > 126) return SendClientMessage(playerid, -1"Cores de 0 a 126!");
    
ChangeVehicleColor(GetPlayerVehicleID(playerid), Corez[0], Corez[1]);
    
SendClientMessage(playerid, -1"Cores do carros modificadas!");
    return 
true;




Re: Ajude-Me - Gustavo_Samp - 17.11.2011

Quote:

Offtopic: profissional e com 2 "S" amigo...

Ki Bon'


Re: Ajude-Me - dPlaYer_ - 17.11.2011

Ou entгo tenta este:

pawn Код:
if(strcmp(cmd, "/pintar", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
new tmp[256];
new cor1,cor2;
new veiculo;
tmp = strtok(cmdtext,idx);
cor1 = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, 0x33AA33A, "/pintar [cor1] [cor2]");
return 1;
}

cor2 = strval(tmp);
veiculo = GetPlayerVehicleID(playerid);
if(IsPlayerInVehicle(playerid,veiculo)){
ChangeVehicleColor(veiculo,cor1,cor2);
format(string, sizeof(string), "(~) Cores Alteradas para [%d] e [%d].", aname, playerid, cor1, cor2);
SendClientMessage(playerid, 0xFF2F2FAA, string);
return 1;
}
}
}
Tu pode botar /cor 999999999 99999999999 q vai >_< so q vai sair preto cores acima de 300