"already defined"
#8

Okay I just moved the code to OnPlayerDamage, however

What I'm trying to accomplish here is set player color by his hp by value, but the color doesn't change.

maybe I've done something wrong?

Код:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
	new str[150],target, name1[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name2,sizeof(name2));
	GetPlayerName(target, name1,sizeof(name1));
	if(issuerid != INVALID_PLAYER_ID && weapon == 34 && bodypart == 9)
	{
		format(str, sizeof(str), "{c3c33}* %s has just landed a {FFFFFF}head-shot {BCA9F5}on %s's head !", name1, name2);
		SendClientMessageToAll(-1,str);
		SendClientMessage(target, -1, "{BCA9F5}* You got +2 points for headshot");
		GameTextForPlayer(target,"~y~+2", 300,4);
		pInfo[playerid][Points] += 2;
 	}
    new Float:phealth;
    GetPlayerHealth(playerid);
    if(phealth > 100)
    {
	  SetPlayerColor(playerid, COLOR_GREEN);
    }
    if(phealth > 65)
    {
      SetPlayerColor(playerid, COLOR_YELLOW);
    }
    if(phealth > 50)
    {
      SetPlayerColor(playerid, COLOR_ORANGE);
    }
    if(phealth > 40)
    {
      SetPlayerColor(playerid, COLOR_RED);
    }
    new string[50], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
	new Float:health;
	GetPlayerHealth(playerid, health);
    if(playerid != INVALID_PLAYER_ID && issuerid != INVALID_PLAYER_ID)
    {
	  SetTimerEx("Damage", 4000, false, "i", issuerid);
	  format(string, sizeof(string), "{7FFFD4}%.0f damage by %s\n{7FFFD4}%.0f HP left", amount, name, health);
	  SetPlayerChatBubble(playerid, string, -1, 60.0, 3000);
    }
 	return 1;
}
Reply


Messages In This Thread
"already defined" - by ivndosos - 08.02.2018, 14:27
Re: "already defined" - by ISmokezU - 08.02.2018, 14:32
Re: "already defined" - by ivndosos - 08.02.2018, 14:34
Re: "already defined" - by ISmokezU - 08.02.2018, 14:36
Re: "already defined" - by ivndosos - 08.02.2018, 14:37
Re: "already defined" - by PepsiCola23 - 08.02.2018, 14:57
Re: "already defined" - by Mugala - 08.02.2018, 15:03
Re: "already defined" - by ivndosos - 08.02.2018, 15:10
Re: "already defined" - by Mugala - 08.02.2018, 15:14

Forum Jump:


Users browsing this thread: 1 Guest(s)