What is the easiest way?
#4

Quote:
Originally Posted by Conroy
I personally prefer using strtok to get the command parameters.
As Conroy said, using strtok is the easiest for me too.

Example:

Код:
dcmd_sethealth(playerid,params)
{
 If(IsPlayerAdmin(playerid)
 {
  new Index;
	  new tmp[256]; tmp = strtok(params,Index);
	  new tmp2[256]; tmp2 = strtok(params,Index);
	  if(!strlen(tmp) || !strlen(tmp2) || !IsNumeric(tmp2)) return
	  SendClientMessage(playerid, LIGHTBLUE2, "Usage: /sethealth [PlayerID] [Value]") &&
		

		if(strval(tmp2) < 0 || strval(tmp2) > 100 && AccInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return
		SendClientMessage(playerid, red, "ERROR: Invaild Health amount!");
		new player1 = strval(tmp);
		new health = strval(tmp2);
		new string[128];
  //and blablbla
So basically tmp take in the playerid you want to set the health of and tmp2 take in the health amount you want to set.
Reply


Messages In This Thread
What is the easiest way? - by ViruZZzZ_ChiLLL - 30.05.2010, 11:37
Re: What is the easiest way? - by cessil - 30.05.2010, 11:40
Re: What is the easiest way? - by Conroy - 30.05.2010, 12:54
Re: What is the easiest way? - by DJDhan - 30.05.2010, 13:54
Re: What is the easiest way? - by aircombat - 30.05.2010, 14:18
Re: What is the easiest way? - by azzerking - 30.05.2010, 14:27

Forum Jump:


Users browsing this thread: 2 Guest(s)