28.03.2014, 22:01
So im trying to make an anti health hack for my server and this is what I have so far:
OnPlayerTakeDamage
OnPlayerSpawn
So could anyone tell me is this code good or I need to improve it? I don't need the anti-armour hack.
EDIT: I added the self inflicted damage.
Код:
new Float:pHealth[MAX_PLAYERS] // Variable to store the player's health
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart) { if(issuerid != INVALID_PLAYER_ID) // If not self-inflicted { if(GetPlayerTeam(issuerid) != GetPlayerTeam(playerid)) // If the players are not in the same team { GetPlayerHealth(playerid,pHealth[playerid]); SetPlayerHealth(playerid,pHealth[playerid]-amount); } } if(issuerid == INVALID_PLAYER_ID) // If self-inflicted { GetPlayerHealth(playerid,pHealth[playerid]); SetPlayerHealth(playerid,pHealth[playerid]-amount); } return 0; }
Код:
OnPlayerSpawn(playerid) { pHealth[playerid] = 100.0; return 1; }
EDIT: I added the self inflicted damage.