How to set a cars color
#1

Whats a good way to set a cars color (function built into samp)
Reply
#2

pawn Код:
ChangeVehicleColor(vehicleid,color1,color2);
Next time try searching. https://sampwiki.blast.hk/wiki/Function:ChangeVehicleColor
Reply
#3

What should i do like new color1 then what
Reply
#4

No, you need to put the color ID.
For example, to set a vehicle to red do this:
pawn Код:
ChangeVehicleColor(vehicleid, 3, 3);
For colors go here https://sampwiki.blast.hk/wiki/Color_ID
Reply
#5

search next time again.
https://sampwiki.blast.hk/wiki/Color_ID


vehicleid The vehicle ID of which you want to change the colors.
color1 The new vehicle's primary Color ID.
color2 The new vehicle's secondary Color ID.

EDIT: dammit. admantis beat me to it.
Reply
#6

Here is a command (You can use it if you have zcmd and sscanf)

pawn Код:
COMMAND:ccolor(playerid, params[])
{
    new color1,color2;
    if(sscanf(params, "ii", color1, color2)) return SendClientMessage(playerid, COLOR_RED, "Usage: /ccolor [color1] [color2]");
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, Grey, "You are not in a vehicle.");
    ChangeVehicleColor(GetPlayerVehicleID(playerid),color1,color2);
    SendClientMessage(playerid,orange,"You have changed your vehicle's color.");
    return 1;
}
Reply
#7

And this:
pawn Код:
if(strcmp(cmd, "/ccolor", true) == 0)
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    new color1, color2;
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /ccolor >color1< >color2<");
    color1 = strval(tmp);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /ccolor >color1< >color2<");
    color2 = strval(tmp);
    ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
    }
    else
    {
    SendClientMessage(playerid,0xF60000AA,"You're not in any Vehicle!");
    }
    return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)