Only ID 0
#1

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.
Reply
#2

Post your command.
Reply
#3

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

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.
Reply
#5

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.
Reply
#6

Код:
	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;
	}
Reply
#7

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
Reply
#8

Код:
	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.
Reply
#9

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

use

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


Forum Jump:


Users browsing this thread: 1 Guest(s)