[Help]: /carcolor. - 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)
+--- Thread: [Help]: /carcolor. (
/showthread.php?tid=434640)
[Help]: /carcolor. -
Areax - 03.05.2013
Hello!
It's me again..Now I have another problem...I made a command /carcolor [color1] [color2], but doesn't work. I get no errors or warnings...
Code:
PHP код:
CMD:carcolor(playerid, params[])
{
new color1;
new color2;
new string[200];
new vehicleid;
if(sscanf(params, "ii", color1, color2)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /carcolor [color1] [color2]");
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You Are not in a vehicle!");
if(color1 < 0 || color1 > 20) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Color! (0-20)");
if(color2 < 0 || color2 > 20) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Color! (0-20)");
ChangeVehicleColor(vehicleid, color1, color2);
format(string, sizeof(string), "[SYSTEM]: %s Has Changed Color Of His Vehicle To %d | %d!", GetName(playerid), color1, color2);
SendClientMessageToAll(COLOR_DARKGREEN, string);
return 1;
}
Thanks
Re: [Help]: /carcolor. -
Pottus - 03.05.2013
Helps if you ..... vehicleid = GetPlayerVehicleID(playerid);
Re: [Help]: /carcolor. -
Yashas - 03.05.2013
You have an
INVALID VEHICLE ID in vehicleid variable.You never initialized it!!
Use
GetPlayerVehicleID(playerid) to get
vehicle id
https://sampwiki.blast.hk/wiki/GetPlayerVehicleID
Код:
vehicleid = GetVehicleID(playerid);
Re: [Help]: /carcolor. -
Areax - 03.05.2013
Quote:
Originally Posted by [uL]Pottus
Helps if you ..... vehicleid = GetPlayerVehicleID(playerid);
|
Thank you

Rep+
Re: [Help]: /carcolor. -
Babul - 03.05.2013
may i suggest you to use the optional parameters for integers, so a player can use the command with ONE color only? like
pawn Код:
if(sscanf(params, "iI(126)", color1, color2))
if you make the second color -1 as default, you can later check for that, and then assign the first color to it:
pawn Код:
if(sscanf(params, "iI(-1)", color1, color2))
if(color2==-1)color2=color1;
btw, the really good colors start @ 127 now
Re: [Help]: /carcolor. -
Yashas - 03.05.2013
Yup!!All the colors I used above 127 shine a lot making car realistic

The actual color limit is more than 200!!!
Re: [Help]: /carcolor. -
Areax - 03.05.2013
Thanks guys