OnPlayerTakeDamage +REP
#1

Okay i'm trying to make something epic.. when he shots his chest only the armor get lost not their health okay here's my code

Код:
	if(issuerid != INVALID_PLAYER_ID && weaponid == 22 && bodypart == 4)
    {
  		new Float:ARMOR;
  		GetPlayerArmour(playerid, ARMOR);
  		if(ARMOR > 0)
  		{
			SetPlayerArmour(playerid, -26);
  		}
        if(ARMOR == 0)
        {
        	new Float:HP;
        	RemovePlayerAttachedObject(playerid,1);
        	RemovePlayerAttachedObject(playerid,6);
			HasArmour[playerid] = 0;
    		GetPlayerHealth(playerid, HP);
			SetPlayerHealth(playerid, HP-60);
			SetPlayerDrunkLevel(playerid, 500000);
			TextDrawShowForPlayer(playerid, Danio);
			TT[playerid] = SetTimerEx("Damage", 250, 1, "i", playerid);
			TC[playerid] = SetTimerEx("Blood", 10000, 1, "i", playerid);
		}
	}
i made it for bodypart 3 and 4 only, it works perfect but when the armor's gone to 0 it returns again to 1000 i've tried multipe times to make it but i failed and one more thing i don't want the damage to be -25 can i make it to regular damage, i tried return 1; but it doesn't work i think there's a messing part please answer me as soon as possible
Reply
#2

Use God mod

PHP код:
#define HD (Float:0x7FFFFFFF)
new bool:JustLoseArmor[MAX_PLAYERS] = false;
public 
OnPlayerUpdate(playerid)
{
    switch(
JustLoseArmor[playerid]) {
        case 
false SetPlayerHealth(playerid,100);
        case 
true SetPlayerHealth(playerid,HD);
       }
    return 
1;
}
if(
issuerid != INVALID_PLAYER_ID && weaponid == 22 && bodypart == 4)
    {
          new 
Float:ARMOR;
          
GetPlayerArmour(playeridARMOR);
          if(
ARMOR 0)
          {
            
SetPlayerArmour(playerid, -26);
            
JustLoseArmor[playerid] = true;
          }
        if(
ARMOR == 0)
        {
            new 
Float:HP;
            
JustLoseArmor[playerid] = false;
            
RemovePlayerAttachedObject(playerid,1);
            
RemovePlayerAttachedObject(playerid,6);
            
HasArmour[playerid] = 0;
            
GetPlayerHealth(playeridHP);
            
SetPlayerHealth(playeridHP-60);
            
SetPlayerDrunkLevel(playerid500000);
            
TextDrawShowForPlayer(playeridDanio);
            
TT[playerid] = SetTimerEx("Damage"2501"i"playerid);
            
TC[playerid] = SetTimerEx("Blood"100001"i"playerid);
        }
    } 
Reply
#3

it just fucked everything also i can't see what's new justlostarmor..
Reply
#4

well keep in mind that he might have 10 armor,then you will get him -26 armor and it will be -16 armor,and by the way i think you should make it that if he has less than 26 armor get his armor and set it to 0 and then give him -hp.
by the way try this code to fix ur problem
pawn Код:
if(issuerid != INVALID_PLAYER_ID && weaponid == 22 && bodypart == 4)
        {
        new Float:ARMOR;
        GetPlayerArmour(playerid, ARMOR);
        if(ARMOR > 0 && ARMOR >= 26)
        {
        SetPlayerArmour(playerid, -26);
            }
            if(ARMOR == 0)
            {
                    new Float:HP;
                    RemovePlayerAttachedObject(playerid,1);
                    RemovePlayerAttachedObject(playerid,6);
            HasArmour[playerid] = 0;
                    GetPlayerHealth(playerid, HP);
            SetPlayerHealth(playerid, HP-60);
            SetPlayerDrunkLevel(playerid, 500000);
            TextDrawShowForPlayer(playerid, Danio);
            TT[playerid] = SetTimerEx("Damage", 250, 1, "i", playerid);
            TC[playerid] = SetTimerEx("Blood", 10000, 1, "i", playerid);
        }
    }
Reply
#5

Quote:
Originally Posted by R0
Посмотреть сообщение
well keep in mind that he might have 10 armor,then you will get him -26 armor and it will be -16 armor,and by the way i think you should make it that if he has less than 26 armor get his armor and set it to 0 and then give him -hp.
by the way try this code to fix ur problem
pawn Код:
if(issuerid != INVALID_PLAYER_ID && weaponid == 22 && bodypart == 4)
        {
        new Float:ARMOR;
        GetPlayerArmour(playerid, ARMOR);
        if(ARMOR > 0 && ARMOR >= 26)
        {
        SetPlayerArmour(playerid, -26);
            }
            if(ARMOR == 0)
            {
                    new Float:HP;
                    RemovePlayerAttachedObject(playerid,1);
                    RemovePlayerAttachedObject(playerid,6);
            HasArmour[playerid] = 0;
                    GetPlayerHealth(playerid, HP);
            SetPlayerHealth(playerid, HP-60);
            SetPlayerDrunkLevel(playerid, 500000);
            TextDrawShowForPlayer(playerid, Danio);
            TT[playerid] = SetTimerEx("Damage", 250, 1, "i", playerid);
            TC[playerid] = SetTimerEx("Blood", 10000, 1, "i", playerid);
        }
    }
yeah this might work man, thanks for helping, +RESPECT
Reply
#6

The problem is your relying on the default damage system this needs to be setup with scripted server side damage to work as expected I highly recommend using this include.

https://sampforum.blast.hk/showthread.php?tid=563387
Reply
#7

Quote:
Originally Posted by Pottus
Посмотреть сообщение
The problem is your relying on the default damage system this needs to be setup with scripted server side damage to work as expected I highly recommend using this include.

https://sampforum.blast.hk/showthread.php?tid=563387
this one is not too good is there another thing
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)