Help: /colorcar [zcmd]
#1

I made this /colorcar cmd and it works fine. But the problem is I said in the script that if the colorID is smaller than 0 or greater than 2, It will not work. But even though I type /colorcar 1111112 11111112. It works. It doesn't give the error that I want it to.

Here's the script:

CMD:colorcar(playerid, params[])
{
new ColorID, ColorID2, vehicleid, str[75];
if(sscanf(params, "dd", ColorID,ColorID2)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /carcolor [1/126] [1/126]");
else if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle!");
else if(ColorID < 0 && ColorID > 126) return SendClientMessage(playerid, COLOR_RED, "CarColor cannot be above 126 or below 0!");
else if(ColorID2 < 0 && ColorID2 > 126) return SendClientMessage(playerid, COLOR_RED, "CarColor2 cannot be above 126 or below 0!");
else
{
vehicleid = GetPlayerVehicleID(playerid);
ChangeVehicleColor(vehicleid, ColorID, ColorID2);
format(str, sizeof(str),">> CarColor 1 changed to %d and CarColor 2 changed to %d <<",ColorID, ColorID2);
SendClientMessage(playerid, COLOR_RED, str);
}
return 1;
}
Reply
#2

Change this and this to that and that

(ColorID < 0 && ColorID > 126) to (ColorID < 0 || ColorID > 126)

(ColorID2 < 0 && ColorID2 > 126) to (ColorID2 < 0 || ColorID2 > 126)

https://sampforum.blast.hk/showthread.php?pid=3468663#pid3468663 - Improved-ZCMD
Reply
#3

Man, You're a genius! Thanks alot! Rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)