/* Server sided HP/Armour for 0.3d Created by Scott - scottreed36@gmail.com DO NOT DISTRIBUTE, LET'S KEEP UPPER HAND ON HACKERS BY KEEPING THIS METHOD SECRET Works because in 0.3d you can set everyone on server to same team, and they won't receive normal damage client side However, OnPlayerDamage is still called, so can use SetHP to create server sided armour/HP Another perk: Car parking and heliblading is now impossible, they just get stuck under car! */ #include <a_samp> #include <streamer> #undef MAX_PLAYERS #define MAX_PLAYERS 600 #define SetPlayerHealthEx(%0,%1) pHealth[%0] = (%1); SetPlayerHealth(%0,%1) #define SetPlayerArmourEx(%0,%1) pArmour[%0] = (%1); SetPlayerArmour(%0,%1) new Float:pHealth[MAX_PLAYERS]; new Float:pArmour[MAX_PLAYERS]; enum VendMachinesEnum { ModelID, Float:PosX, Float:PosY, Float:PosZ, Float:RotZ } new VendMachines[20][VendMachinesEnum] = { }; public OnPlayerConnect(playerid) { RemoveBuildingForPlayer(playerid, 955, 0, 0, 0, 25000); // Remove all sprunk machines RemoveBuildingForPlayer(playerid, 956, 0, 0, 0, 25000); // Remove all vending machines } public OnPlayerSpawn(playerid) { SetPlayerTeam(playerid, 4); } public OnPlayerText(playerid, text[]) // THIS IS FOR DEBUGGING { SetPlayerHealthEx(playerid, 100); SetPlayerArmourEx(playerid, 100); return 1; } 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; } stock GetPlayerNameEx(playerid) { new sz_playerName[MAX_PLAYER_NAME], i_pos; GetPlayerName(playerid, sz_playerName, MAX_PLAYER_NAME); while ((i_pos = strfind(sz_playerName, "_", false, i_pos)) != -1) sz_playerName[i_pos] = ' '; return sz_playerName; }
Process started >>> AntiHH.pwn(146) : warning 203: symbol is never used: "VendMachines" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Warning. <<< Process finished. (Exit code 0) ================ READY ================
pawn Код:
|
pawn Код:
|