SA-MP Forums Archive
Only ID 0 - 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: Only ID 0 (/showthread.php?tid=101027)



Only ID 0 - L30 - 08.10.2009

All my commands such as /example [ID]
Only works with ID 0.
So if I do
/example 1
It will do it to ID 0 instead.
This is with every command.


Re: Only ID 0 - _Vortex - 08.10.2009

Post your command.


Re: Only ID 0 - L30 - 08.10.2009

/example was just a example command, its with all the commands the require a ID


Re: Only ID 0 - shady91 - 08.10.2009

Quote:
Originally Posted by L30
/example was just a example command, its with all the commands the require a ID
well post how your making these commands.


Re: Only ID 0 - _Vortex - 08.10.2009

Quote:
Originally Posted by L30
/example was just a example command, its with all the commands the require a ID
I understand that, I'd like to take a look at one of your commands which uses an id, so I can help you. I can't help without a code.


Re: Only ID 0 - L30 - 08.10.2009

Код:
	if(strcmp(cmd, "/hp", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
		  SendClientMessage(playerid, COLOR_LIGHTRED, "/hp [playerid/PartOfName] [health]");
		  return 1;
		}
		new health;
		health = strval(tmp);
		if(IsPlayerConnected(playerid))
		{
		  if(playerid != INVALID_PLAYER_ID)
		  {
			SetPlayerHealth(playerid, health);
		  }
		}
   	  }
	  return 1;
	}



Re: Only ID 0 - _Vortex - 08.10.2009

Quote:
Originally Posted by L30
Код:
	if(strcmp(cmd, "/hp", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
		  SendClientMessage(playerid, COLOR_LIGHTRED, "/hp [playerid/PartOfName] [health]");
		  return 1;
		}
		new health;
		health = strval(tmp);
		if(IsPlayerConnected(playerid))
		{
		  if(playerid != INVALID_PLAYER_ID)
		  {
			SetPlayerHealth(playerid, health);
		  }
		}
   	  }
	  return 1;
	}
That command doesn't have anything for the player given in the command, so it'll set the player who used the command's health


Re: Only ID 0 - Blacklite - 08.10.2009

Код:
	if(strcmp(cmd, "/hp", true) == 0)
	{
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_LIGHTRED, "/hp [playerid/PartOfName] [health]");
			return 1;
		}
		new targetid = strval(tmp);
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_LIGHTRED, "/hp [playerid/PartOfName] [health]");
			return 1;
		}
		new health = strval(tmp);
		if(IsPlayerConnected(targetid))
		{
			SetPlayerHealth(playerid, health);
		}
	  return 1;
	}
Although I would highly recommend you switched to dcmd + sscanf.


Re: Only ID 0 - UsaBoy91 - 08.10.2009

this will work for a player just if you use it on his ID , not on his partofname & id

use

pawn Код:
targetid = ReturnUser(tmp);