Anti Heal/Armor hacking compiler get warning , please help me fix
#1

This is my anti HH
Код:
/*
	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;
}
When i complete pawn compiler . it said

Код:
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 ================
Help me fix this please
Reply
#2

Search for VendMachines and delete it if it's never used in any part.
Reply
#3

thank you
Reply
#4

It means you have defined the function but it is never used, so rather letting it consuming space in your script better delete it.
Reply
#5

Quote:
Originally Posted by jesdynguyen
Посмотреть сообщение
pawn Код:
enum VendMachinesEnum
{
    ModelID,
    Float:PosX,
    Float:PosY,
    Float:PosZ,
    Float:RotZ
}

new VendMachines[20][VendMachinesEnum] = {
};
I guess you copied this part as you don't really need it. That's why the compiler gives you a warning but compiles the script anyways and it won't create any errors since the compiler just informs you that you created a multi dimensional array which takes up unnecessary memory since you don't use it anywhere.

Quote:
Originally Posted by jesdynguyen
Посмотреть сообщение
pawn Код:
RemoveBuildingForPlayer(playerid, 955, 0, 0, 0, 25000); // Remove all sprunk machines
RemoveBuildingForPlayer(playerid, 956, 0, 0, 0, 25000); // Remove all vending machines
And this is why. You remove all the existing machines and don't create custom ones anywhere (which the enum and array might be used for as well).

So the solution would be to just remove the lines with the enum and the allocation of memory for the array.
That is if you do not intent to use them in any way of course.

I hope this helps.
Reply
#6

thanks you all guys for helping me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)