Quote:
Originally Posted by MP2
Best to set vehicle color 2 to what color 1 is if it's left out, plus you don't check if they're actually in a vehicle.
pawn Code:
CMD:vcolor(playerid, params[]) { if(GetPlayerState(playerid) != 2) return SendClientMessage(playerid, 0xFF0000FF, "You are not driving a vehicle."); new color[2]; if(sscanf(params, "iI(-1)", color[0], color[1])) { return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /colorcar [color1] <color2>"); } if(color[1] == -1) color[1] = color[0]; // If color2 was left out, set it the same as color 1 new szSuccess[44]; format(string, sizeof(string), "Vehicle colors changed to: {FFFFFF}%i and %i.", color[0], color[1]); SendClientMessage(playerid, 0x00FF00FF, szSuccess); ChangeVehicleColor(GetPlayerVehicleID(playerid), color[0], color[1]); return 1; }
|
That code is such a fail. For one, you defined szSuccess, not string, so it would be:
Then
pawn Code:
SendClientMessage(playerid, 0x00FF00FF, string);
Or:
pawn Code:
format(szSuccess, sizeof(szSuccess), "Vehicle colors changed to: {FFFFFF}%i and %i.", color[0], color[1]);
and, the command is /vcolor, but you have the message saying the command is /colorcar.
.... /facepalm