#1

I'm wondering how can i create in this function when i shoot the player he wont loose any health ?


Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
	if (playerid != INVALID_PLAYER_ID && damagedid != INVALID_PLAYER_ID)
	{
		if (weaponid == 23 && TazerHand[playerid] == 1)
		{
		    if(ReloadingTazer[playerid] > 0)
		    {
		        SCM(playerid, TOMATO, " (info) {FFFFFF}Reloading!");
		        return 1;
			}
		    if(!PlayerTazed[damagedid])
		    {
		    	new string[128];
				PlayerPlaySoundInArea(playerid, 6003);

				PlayerTazed[damagedid] = 1;
				TogglePlayerControllable(damagedid, 0);
				TazerTimer[damagedid] = 10;

				for (new i = 0; i < 3; i ++)
				{
     				ApplyAnimation(damagedid, "PED", "FLOOR_hit_f", 4.0, 1, 0, 0, 0, 0);
				}

				ReloadingTazer[playerid] = 1;
			}
		}
	}
	return 1;
}
Reply
#2

You can't prevent that the player looses health, you can just give the health back. You can also set the players in the same team beforehand and handle the complete damage-management yourself.
Reply
#3

You can, Add Get Player health on top of OnPlayerGiveDamage and Add Setplayerhealth after if (weaponid == 23 && TazerHand[playerid] == 1)
Reply
#4

Quote:
Originally Posted by GeekSiMo
Посмотреть сообщение
You can, Add Get Player health on top of OnPlayerGiveDamage and Add Setplayerhealth after if (weaponid == 23 && TazerHand[playerid] == 1)
Seems like you didn't finish reading my post.
Reply
#5

Yeah! i read it Now !
Reply
#6

Quote:
Originally Posted by GeekSiMo
Посмотреть сообщение
You can, Add Get Player health on top of OnPlayerGiveDamage and Add Setplayerhealth after if (weaponid == 23 && TazerHand[playerid] == 1)
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    if (playerid != INVALID_PLAYER_ID && damagedid != INVALID_PLAYER_ID)
    {
        if (weaponid == 23 && TazerHand[playerid] == 1)
        {
            new Float:health;
            GetPlayerHealth(damagedid, health);
            if(ReloadingTazer[playerid] > 0)
            {
                SCM(playerid, TOMATO, " (info) {FFFFFF}Reloading!");
                return 1;
            }
            if(!PlayerTazed[damagedid])
            {
                new string[128];

                SetPlayerHealth(damagedid, health);
                PlayerPlaySoundInArea(playerid, 6003);

                PlayerTazed[damagedid] = 1;
                TogglePlayerControllable(damagedid, 0);
                TazerTimer[damagedid] = 10;

                for (new i = 0; i < 3; i ++)
                {
                    ApplyAnimation(damagedid, "PED", "FLOOR_hit_f", 4.0, 1, 0, 0, 0, 0);
                }

                ReloadingTazer[playerid] = 1;
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: