31.03.2009, 18:55
If you don't have already, put the strtok-function in your gamemode. (You can find that function in lvdm.pwn which came with serverdownload).
Put (if you don't have already) at the top of your OnPlayerCommandText-callback:
and then your command will be:
Put (if you don't have already) at the top of your OnPlayerCommandText-callback:
Код:
new cmd[256], idx; cmd = strtok(cmdtext, idx);
Код:
if(strcmp(cmd, "/carcolor", true)==0) { if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) { SendClientMessage(playerid, 0xFF0000AA, "You can only use this command while driving a vehicle!"); return 1; } new tmp1[256], tmp2[256]; tmp1= strtok(cmdtext, idx); tmp2= strtok(cmdtext, idx); if(!strlen(tmp1) || !strlen(tmp2)) { SendClientMessage(playerid, 0xFF0000AA, "Use: /carcolor [color1] [color2]"); return 1; } new color1 = strval(tmp1); new color2 = strval(tmp2); ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2); return 1; }