How to set a cars color - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to set a cars color (
/showthread.php?tid=252577)
How to set a cars color -
John_Cooper - 02.05.2011
Whats a good way to set a cars color (function built into samp)
Re: How to set a cars color -
Tee - 02.05.2011
pawn Код:
ChangeVehicleColor(vehicleid,color1,color2);
Next time try searching.
https://sampwiki.blast.hk/wiki/Function:ChangeVehicleColor
Re: How to set a cars color -
John_Cooper - 02.05.2011
What should i do like new color1 then what
Re: How to set a cars color -
admantis - 02.05.2011
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
Re: How to set a cars color -
Kitten - 02.05.2011
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.
Re: How to set a cars color -
Tee - 02.05.2011
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;
}
Re: How to set a cars color -
dr.pepper - 02.05.2011
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;
}