2 attributes cmd
#5

I prefer strtok.

Eg: The sethealth command in dcmd

Код:
dcmd_sethealth(playerid,params[])
{
  if(!IsPlayerAdmin(playerid) return SendClientMessage(playerid,oxffffffaa, "You are not authorised to use this command");

  new tmp[128],tmp2[128],health,targetid,Index;
  tmp=strtok(params,Index);
  tmp2=strtok(params,Index);
  if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, oxffffffaa, " Usage: /sethealth playerid health");
  if(strval(tmp2)>100) return SendClientMessage(playerid, oxffffffaa, " Invalid health amount.");

  targetid=strval(tmp);
  health=strval(tmp2);

  SetPlayerHealth(targetid,health);
  
  return 1;
}
Above is a very basic sethealth command using dcmd and strtok.

Reply


Messages In This Thread
2 attributes cmd - by whitedragon - 06.06.2010, 08:47
Re: 2 attributes cmd - by Sergei - 06.06.2010, 08:58
Re: 2 attributes cmd - by MadeMan - 06.06.2010, 09:02
Re: 2 attributes cmd - by whitedragon - 06.06.2010, 09:03
Re: 2 attributes cmd - by DJDhan - 06.06.2010, 09:10

Forum Jump:


Users browsing this thread: 1 Guest(s)