SA-MP Forums Archive
What is the easiest way? - 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: What is the easiest way? (/showthread.php?tid=151397)



What is the easiest way? - ViruZZzZ_ChiLLL - 30.05.2010

What is the easiest way to have the other player take the effect.

For example I want to kick the other player not me, or SendClientMessage to
the specific player id.

What are you talking about?

How to do a /command [player id]


Re: What is the easiest way? - cessil - 30.05.2010

zcmd + sscanf


Re: What is the easiest way? - Conroy - 30.05.2010

I personally prefer using strtok to get the command parameters.


Re: What is the easiest way? - DJDhan - 30.05.2010

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.


Re: What is the easiest way? - aircombat - 30.05.2010

Its Zcmd + SScanf , but i prefer using dcmd+sscanf cause I've been using it for alot of time


Re: What is the easiest way? - azzerking - 30.05.2010

Its Easier strtok Its Basic For Pawno But Its Not Complicated As Much as zcmd or sscanf

Hope This Helped You