10.11.2011, 12:54
Quote:
The command is working but it doesnt change the paintjob colors...
|
For color use another command, like with ZCMD
pawn Код:
CMD:carcolor(playerid, params[])
{
new vehicleid, color1, color2;
if((vehicleid = GetPlayerVehicleID(playerid)))
{
if(sscanf(params, "dd", color1, color2)) return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}Usage: /carcolor [color 1] [color 2]");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You' re not driver!");
ChangeVehicleColor(vehicleid, color1, color2);
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, "[ERROR] {FFFFFF}You are not in a vehicle!");
}
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128];
new idx;
new tmp[256];
if(strcmp(cmd, "/carcolor", true) == 0) {
new color1, color2;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /carcolor [color1] [color2]");
color1 = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /carcolor [color1] [color2]");
color2 = strval(tmp);
ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
return 1;
}
//More of your code
pawn Код:
stock 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;
}