Target is not loosing health
#1

Fixed!
Reply
#2

Deleted, see next reply
Reply
#3

Код:
CMD:emo(playerid, params[])
{
    new target;
    new Float:x, Float:y, Float:z;
    new EmoBubble[MAX_CHATBUBBLE_LENGTH+1];
    if(sscanf(params, "u", target)) return SendClientMessage(playerid, LIGHTBLUE,"[ USAGE: /emo (name/id) ]");
    //if(target == playerid) return SendClientMessage(playerid, red, "[ ERROR: You cannot use this command on yourself! ]");
    if(!IsPlayerConnected(target)) return SendClientMessage(playerid, red, "[ ERROR: Player is not connected! ]");
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, red, "[ ERROR: You cannot use this command while you are in a vehicle! ]");
    GetPlayerPos(target, x, y, z);
    if(!IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z)) return SendClientMessage(playerid, red, "[ ERROR: Player is not close to you! ]");
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerInRangeOfPoint(i, 30.0, x, y, z))
        {
   	        new Float:health;
	        GetPlayerHealth(target, health);
		if(health > 20)
		{
	            new string[256], EmoName[MAX_PLAYER_NAME], TargetName[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, EmoName, sizeof(EmoName));
                    GetPlayerName(target, TargetName, sizeof(TargetName));
                    GetPlayerHealth(target,health);
                    SetPlayerHealth(target, health-3);
                    format(string,sizeof(string), "%s(%d) has cut %s(%d)'s wrists with a rusty fishing knife.", EmoName, playerid, TargetName, target);
                    SendClientMessage(i, white, string);
                    format(EmoBubble, MAX_CHATBUBBLE_LENGTH, "%s(%d)  has cut %s(%d)'s wrists with a rusty fishing knife.", EmoName, playerid, TargetName, target);
                    SetPlayerChatBubble(playerid, EmoBubble, grey, 30.0, 5000);
                    return 1;
               }
	      else if(health <= 20)
	      {
		  new string[256], EmoName[MAX_PLAYER_NAME], TargetName[MAX_PLAYER_NAME];
                  GetPlayerName(playerid, EmoName, sizeof(EmoName));
                  GetPlayerName(target, TargetName, sizeof(TargetName));
                  SetPlayerHealth(target, 0);
                  format(string,sizeof(string), "%s(%d) has died due to excessive of bleeding.", TargetName, target);
                  SendClientMessageToAll(white, string);
                  return 1;
              }
	  }
      }
      return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)