Players not taking damage.
#1

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    new ammo = GetPlayerAmmo(issuerid);
    
	if(PlayerInfo[playerid][pAdminDuty] && PlayerInfo[playerid][pAdmin] > SUPPORTER)return 1;
	if(weaponid == 51 || weaponid == 49 || weaponid == 54)return 1;
	if(issuerid != INVALID_PLAYER_ID && !AC_PlayerHasWeapon(issuerid, weaponid, ammo) && !PlayerInfo[playerid][pAdmin])return 1;

    Damages_Add(playerid, (issuerid != INVALID_PLAYER_ID) ? ReturnRoleplayName(issuerid) : "Nessuno", weaponid, amount, bodypart);

	if(PlayerInfo[playerid][pDeath])return AC_SetPlayerHealth(playerid, 0);

	new Float:weapon_damage;
	new Float:hp; AC_GetPlayerHealth(playerid, hp);
	new Float:ap; AC_GetPlayerArmour(playerid, ap);

	if(issuerid != INVALID_PLAYER_ID)
	{
	    new strength = PlayerInfo[issuerid][pStrength];
	    
		if(Faction_GetType(PlayerInfo[issuerid][pFaction]) == POLICE && PlayerInfo[issuerid][pFactionDuty] && (PlayerInfo[issuerid][pTaser]  || PlayerInfo[issuerid][pBeanBag]) && !PlayerInfo[playerid][pDeath])
		{
			if(ProxDetectorS(10.0, issuerid, playerid) && PlayerInfo[issuerid][pTaser] && weaponid == 23)
   			{
				SendFormattedMessage(playerid, COLOR_YELLOW, "You've been tased by%s (%d).", ReturnRoleplayName(issuerid), issuerid);
				SendFormattedMessage(issuerid, COLOR_YELLOW, "You have tased %s (%d).", ReturnRoleplayName(playerid), playerid);

				PlayerInfo[playerid][pStunned] = 10;
			}
			else if(ProxDetectorS(30.0, issuerid, playerid) && PlayerInfo[issuerid][pBeanBag] && weaponid == 25)
			{
				SendFormattedMessage(playerid, COLOR_YELLOW, "You've been beanbagged by %s (%d).", ReturnRoleplayName(issuerid), issuerid);
				SendFormattedMessage(issuerid, COLOR_YELLOW, "You beenbagged %s (%d).", ReturnRoleplayName(playerid), playerid);

				PlayerInfo[playerid][pStunned] = 15;
			}

            if(IsPlayerInAnyVehicle(playerid))RemovePlayerFromVehicle(playerid);

            ApplyAnimation(playerid, "CRACK", "crckdeth4", 4.0, 0, 0, 0, 1, 0, 1);
			
			weapon_damage = (weaponid == 23) ? 2 : 4;
		}

		if(!weapon_damage) switch(weaponid)
		{
		    case 0: weapon_damage = (strength >= 0 && strength < 6) ? 1 : (strength >= 6 && strength < 12) ? 2 : (strength >= 12 && strength < 24) ? 3 : 4;
  			case 4, 28, 32: weapon_damage = 20;
	    	case 22: weapon_damage = 25;
	    	case 33: weapon_damage = 55;
	    	case 34: weapon_damage = 300;
		}
		
		if(weaponid && (weaponid == 23 && !PlayerInfo[issuerid][pTaser]) && (weaponid == 25 && !PlayerInfo[issuerid][pBeanBag]) && bodypart == 7 || bodypart == 8) PlayerInfo[playerid][pLegHit] = 1;
	}

	if(weapon_damage)
	{
		if(ap >= weapon_damage) AC_SetPlayerArmour(playerid, ap - weapon_damage);
		else if(ap && ap < weapon_damage)
		{
  			AC_SetPlayerArmour(playerid, 0);
			AC_SetPlayerHealth(playerid, (weapon_damage - ap) - hp);
		}
		else AC_SetPlayerHealth(playerid, hp - weapon_damage);
	}

    return 1;
}
This is the OnPlayerTakeDamage. Hope it helps.
Reply
#2

BUMP
Reply
#3

maybe show us your AC_SetPlayerHealth functions?
Reply
#4

Код:
AC_SetPlayerHealth(playerid, Float:hp)
{
	PlayerInfo[playerid][pServerHealth] = hp;
	SetPlayerHealth(playerid, hp); return 1;
}
Reply
#5

BUMP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)