This is my car colour command:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128], idx;
cmd = strtok(cmdtext, idx);
if (strcmp("/carcolour", cmd, true) == 0)
{
new Colour1[128];
new Colour2[128];
new currentveh;
Colour1 = strtok(cmdtext, idx);
Colour2 = strrest(cmdtext, idx);
currentveh = GetPlayerVehicleID(playerid);
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,RED,"You're not in a car.");
if(IsPlayerInAnyVehicle(playerid))
{
if (!strval(Colour1) || strval(Colour1)> 255)
{
SendClientMessage(playerid, YELLOW, "Invalid colour1.");
return 1;
}
else if (!strval(Colour2) || strval(Colour2) > 255)
{
SendClientMessage(playerid, YELLOW, "Invalid colour2.");
return 1;
}
else {
ChangeVehicleColor(currentveh, strval(Colour1), strval(Colour2));
}
}
}
return 0;
}
+ When I'm in a car and tape /carcolour and need to give for player USAGE: /carcolour id1 id2
because now, if I tape /carcolour it give me Invalid ID1 ?!
and when I write the full form Ex: /carcolour 3 6 it change my car's colour and give an Error msg: UNKNOWN COMMAND !
Please