Car Colour Changing
#4

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:
Код:
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
and then your command will be:
Код:
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;
}
Reply


Messages In This Thread
Car Colour Changing - by Abyss - 31.03.2009, 18:40
Re: Car Colour Changing - by Sandra18[NL] - 31.03.2009, 18:44
Re: Car Colour Changing - by Abyss - 31.03.2009, 18:45
Re: Car Colour Changing - by Sandra18[NL] - 31.03.2009, 18:55
Re: Car Colour Changing - by LarzI - 31.03.2009, 19:07
Re: Car Colour Changing - by Danut - 31.03.2009, 19:11
Re: Car Colour Changing - by Abyss - 31.03.2009, 19:11
Re: Car Colour Changing - by LarzI - 31.03.2009, 19:30
Re: Car Colour Changing - by Sandra18[NL] - 31.03.2009, 20:01
Re: Car Colour Changing - by Nero_3D - 31.03.2009, 20:38

Forum Jump:


Users browsing this thread: 3 Guest(s)