[Help]: /carcolor.
#1

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
Reply
#2

Helps if you ..... vehicleid = GetPlayerVehicleID(playerid);
Reply
#3

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);
Reply
#4

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Helps if you ..... vehicleid = GetPlayerVehicleID(playerid);
Thank you Rep+
Reply
#5

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
Reply
#6

Yup!!All the colors I used above 127 shine a lot making car realistic
The actual color limit is more than 200!!!
Reply
#7

Thanks guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)