05.03.2013, 15:23
Hey I have a problem if player fall it giving him heal and armor...
Another question how I do that using sprunk machine,firstaid,pot will not think that it health hack?
Another question how I do that using sprunk machine,firstaid,pot will not think that it health hack?
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
new count = GetTickCount();
if(weaponid == 50)
{
SetPlayerArmourEx(playerid, pArmour[playerid]);
SetPlayerHealthEx(playerid, pHealth[playerid]);
return 1;
}
else if(weaponid == 54 || weaponid == 37 || weaponid == 51 || weaponid == 53)
{
SetPlayerArmourEx(playerid, pArmour[playerid]);
SetPlayerHealthEx(playerid, pHealth[playerid]);
}
new Float:armour, Float:HP;
new string[128]; // DEBUG STRING
GetPlayerArmour(playerid, armour);
GetPlayerHealth(playerid, HP);
if(HP <= 0) return 1; // let them die if they are dead!
if((pArmour[playerid] > 0) && (((pArmour[playerid] > armour) && ((pArmour[playerid]-armour) > 1)) || ((pArmour[playerid] < armour) && ((armour-pArmour[playerid]) > 1))))
{
//Kick(playerid); (automatic kick?)
format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) is possibly armour hacking", GetPlayerNameEx(playerid), playerid);
SendClientMessageToAll(0xFFFFFFAA, string);
//ABroadCast( COLOR_YELLOW, string, 2 );
format(string, sizeof(string), "{AA3333}Expected Armour: {AA3333}%f | {AA3333}Armour: {AA3333}%f]", pArmour[playerid], armour);
SendClientMessageToAll(0xFFFFFFAA, string);
//ABroadCast( COLOR_YELLOW, string, 2 );
}
if((pHealth[playerid] > 0) && (((pHealth[playerid] > HP) && ((pHealth[playerid]-HP) > 1)) || ((pHealth[playerid] < HP) && ((HP-pHealth[playerid]) > 1))))
{
//Kick(playerid); (automatic kick?)
format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) is possibly health hacking", GetPlayerNameEx(playerid), playerid);
SendClientMessageToAll(0xFFFFFFAA, string);
//ABroadCast( COLOR_YELLOW, string, 2 );
format(string, sizeof(string), "{AA3333}Expected HP: {AA3333}%f | {AA3333}HP: {AA3333}%f]", pHealth[playerid], HP);
SendClientMessageToAll(0xFFFFFFAA, string);
//ABroadCast( COLOR_YELLOW, string, 2 );
}
if(armour > 0)
{
if(armour >= amount)
{
//Don't set double damage for drowning, splat, fire
if(weaponid == 54 || weaponid == 53 || weaponid == 37) pArmour[playerid] = (armour-amount);
else SetPlayerArmourEx(playerid, armour-amount);
}
else
{
if(weaponid == 54 || weaponid == 53 || weaponid == 37)
{
pArmour[playerid] = 0;
pHealth[playerid] = (HP-(amount-armour));
}
else
{
SetPlayerArmourEx(playerid, 0);
SetPlayerHealthEx(playerid, HP-(amount-armour));
}
}
}
else
{
if(weaponid == 54 || weaponid == 53 || weaponid == 37) pHealth[playerid] = (HP-amount);
else SetPlayerHealthEx(playerid, HP-amount);
}
format(string, sizeof(string), "%d shot by %d with %f damage using WEP %d | %d", playerid, issuerid, amount, weaponid, GetTickCount() - count); //DEBUG
SendClientMessageToAll(0xFFFFFFAA, string); //DEBUG
return 1;
}

