SA-MP Forums Archive
[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(playeridparams[])
{
    new 
color1;
    new 
color2;
    new 
string[200];
    new 
vehicleid;
    if(
sscanf(params"ii"color1color2)) return SendClientMessage(playeridCOLOR_ORANGE"Usage: /carcolor [color1] [color2]");
    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_RED"ERROR: You Are not in a vehicle!");
    if(
color1 || color1 20) return  SendClientMessage(playeridCOLOR_RED"ERROR: Invalid Color! (0-20)");
    if(
color2 || color2 20) return  SendClientMessage(playeridCOLOR_RED"ERROR: Invalid Color! (0-20)");
    
ChangeVehicleColor(vehicleidcolor1color2);
    
format(stringsizeof(string), "[SYSTEM]: %s Has Changed Color Of His Vehicle To %d | %d!"GetName(playerid), color1color2);
    
SendClientMessageToAll(COLOR_DARKGREENstring);
    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