SA-MP Forums Archive
Help: /colorcar [zcmd] - 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: /colorcar [zcmd] (/showthread.php?tid=575251)



Help: /colorcar [zcmd] - Tarif - 25.05.2015

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;
}


Re: Help: /colorcar [zcmd] - Yashas - 25.05.2015

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


Re: Help: /colorcar [zcmd] - Tarif - 25.05.2015

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