SA-MP Forums Archive
2 attributes cmd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: 2 attributes cmd (/showthread.php?tid=152893)



2 attributes cmd - whitedragon - 06.06.2010

How to make 2 attributes cmd? (No LARP edit)
cmd will like /cmdtext 1attr 2attr


Re: 2 attributes cmd - Sergei - 06.06.2010

Use sscanf.


Re: 2 attributes cmd - MadeMan - 06.06.2010

https://sampwiki.blast.hk/wiki/Fast_Commands



Re: 2 attributes cmd - whitedragon - 06.06.2010

hmm can you give me sample? i dont sleep last night so it's hard to think


Re: 2 attributes cmd - DJDhan - 06.06.2010

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.