Jump to content

[REZOLVAT] Problema nu ieu damage


gogu
 Share

Recommended Posts

MODEL TOPIC:

  • Username:gogu
  • Problema întălnită:daca dau cu cu pumni sau cu arma nu ieu damage
  • Detalii despre problemă:au cu cu pumni sau cu arma nu ieu damage
  • Ce ai încercat să faci înainte să postezi?:sa pun 0 degeaba
  • Cod sursă (recomandat pastebin.com) :nu stiu ce sa va dau
  • Alte detalii:au cu cu pumni sau cu arma nu ieu damage
Link to comment
Share on other sites

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart) {
	new Float:HP, Float:AP, Float:remainHP;
	if(issuerid != INVALID_PLAYER_ID) {
		if(amount < 0) {
			new string[128],sendername[25];
		    GetPlayerName(issuerid,sendername,sizeof(sendername));
			format(string, sizeof(string), "%s(%d) possible global-kill. (player damage: %.2f)",sendername,issuerid,amount);
			if(GetPVarInt(playerid, "Cover") == 0) SendAdminMessage(COLOR_WHITE, string,1);
			KickEx(issuerid);
			return 1;
		}
		if(weaponid == 54 && GetPlayerState(issuerid) != PLAYER_STATE_DRIVER) {
		    if(playerDeath[issuerid] == 0) {
				
			 	GetPlayerHealthEx(issuerid,HP);
			 	GetPlayerArmourEx(issuerid,AP);
				if( AP >= amount ) {
					SetPlayerArmourEx( issuerid, AP - amount );
					SetPlayerHealthEx( issuerid, HP );
				}
				else if( AP <= 0 ) {
					remainHP = HP - amount;
					SetPlayerHealthEx( issuerid, remainHP );
					if( remainHP <= 0 && playerDeath[issuerid] == 0 ) {
						OnPlayerDeath( playerid, issuerid, weaponid );
						playerDeath[playerid] = 1;
					}
				}
				else {
					remainHP = HP + ( AP - amount );
					SetPlayerArmourEx( issuerid, 0.0 );
					SetPlayerHealthEx( issuerid, remainHP );
					if( remainHP <= 0 && playerDeath[issuerid] == 0 ) {
						OnPlayerDeath( playerid, INVALID_PLAYER_ID, weaponid );
						playerDeath[issuerid] = 1;
					}
				}
			}
		}
		if(weaponid == 49 || weaponid == 50 || weaponid == 51 || weaponid == 52 || weaponid == 53 || weaponid == 54 || GetPlayerState(issuerid) == PLAYER_STATE_DRIVER) {
			if(playerDeath[playerid] == 0) {
				GetPlayerHealthEx(playerid,HP);
				GetPlayerArmourEx(playerid,AP);
				if(AP >= amount ) {
					SetPlayerArmourEx(playerid, AP - amount);
					SetPlayerHealthEx(playerid, HP);
				}
				else if(AP <= 0) {
					remainHP = HP - amount;
					SetPlayerHealthEx(playerid, remainHP);
					if(remainHP <= 0 && playerDeath[playerid] == 0) {
						OnPlayerDeath(playerid, issuerid, weaponid);
						playerDeath[playerid] = 1;
					}
				}
				else {
					remainHP = HP + (AP - amount);
					SetPlayerArmourEx(playerid, 0.0);
					SetPlayerHealthEx(playerid, remainHP);
					if( remainHP <= 0 && playerDeath[playerid] == 0) {
						OnPlayerDeath(playerid, issuerid, weaponid );
						playerDeath[playerid] = 1;
					}
				}
			}
		}		
	}
	else {
		if(playerDeath[playerid] == 0) {
			GetPlayerHealthEx(playerid,HP);
			GetPlayerArmourEx(playerid,AP);
			if(AP >= amount ) {
				SetPlayerArmourEx(playerid, AP - amount);
				SetPlayerHealthEx(playerid, HP);
			}
			else if(AP <= 0) {
				remainHP = HP - amount;
				SetPlayerHealthEx(playerid, remainHP);
				if(remainHP <= 0 && playerDeath[playerid] == 0) {
					OnPlayerDeath(playerid, INVALID_PLAYER_ID, weaponid);
					playerDeath[playerid] = 1;
				}
			}
			else {
				remainHP = HP + (AP - amount);
				SetPlayerArmourEx(playerid, 0.0);
				SetPlayerHealthEx(playerid, remainHP);
				if( remainHP <= 0 && playerDeath[playerid] == 0) {
					OnPlayerDeath(playerid, INVALID_PLAYER_ID, weaponid );
					playerDeath[playerid] = 1;
				}
			}
		}	
	}
	return 1;
}

 

Edited by Wildo
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...