22.12.2012, 15:28
This is the right code:
Add this in last of your script:
pawn Код:
CMD:changecolor(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
new color1, color2, tmp[128];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /carcolor >color1< >color2<");
color1 = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /carcolor >color1< >color2<");
color2 = strval(tmp);
ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
}
else
{
SendClientMessage(playerid,COLOR_ORANGE,"You aren't in any Vehicle!");
}
return 1;
}
pawn Код:
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}

