help with /sethealth
#1

can somebody tell me what is wrong with this, wheni try it in game if i type /sethealth 0 100, it only reads it like im saying /sethealth 0 and it sets my health to 0 heres the code

Код:
if(strcmp(cmd,"/sethealth",true) == 0)
{
	new tmp[256];
	new otherplayer = strval(tmp);
	tmp = strtok(cmdtext, idx);
	new health = strval(tmp);
	new name[MAX_PLAYER_NAME], nname[MAX_PLAYER_NAME];
	new string[128];
	GetPlayerName(playerid, name, sizeof(name));
	GetPlayerName(otherplayer, nname, sizeof(nname));
	if(!strlen(tmp)) return SendClientMessage(playerid,ORANGE,"USAGE: /sethealth id health");
	if(health < 0 || health > 100) return SendClientMessage(playerid,ORANGE,"Invalid Health");
 	if(PlayerInfo[playerid][Level] > 2)
  	{
	        if(IsPlayerConnected(otherplayer))
	        {
	            SetPlayerHealth(otherplayer,health);
	            format(string,sizeof(string),"You have set %s's health to %d",nname,health);
	            SendClientMessage(playerid,ORANGE,string);
	            format(string,sizeof(string),"Admin %s has set your health to %d",name,health);
	            SendClientMessage(otherplayer,ORANGE,string);
			}
			else
			{
			    SendClientMessage(playerid,ORANGE,"Invalid ID");
			    return 1;
			}
	}
	else
	{
	    SendClientMessage(playerid,ORANGE,"You have to be level 3 to use this command");
	    return 1;
	}
Reply


Messages In This Thread
help with /sethealth - by mrcoolballs - 22.08.2010, 15:44
Re: help with /sethealth - by ZeRo_HUN - 22.08.2010, 15:49
Re: help with /sethealth - by Sky4D - 22.08.2010, 16:35

Forum Jump:


Users browsing this thread: 1 Guest(s)