[Help]Anti Hack
#1

Код:
ExecuteHackerAction( playerid, weaponid )
{
	if(!gPlayerLogged{playerid}) { return 1; }
	if(PlayerInfo[playerid][pTut] == 0) { return 1; }
	if(playerTabbed[playerid] == 1) { return 1; }
	if(GetPVarInt(playerid, "IsInArena") >= 0) { return 1; }

	new String[ 128 ], WeaponName[ 128 ];
	GetWeaponName( weaponid, WeaponName, sizeof( WeaponName ) );

	format( String, sizeof( String ), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) may possibly be weapon hacking (%s).", GetPlayerName(playerid), playerid, WeaponName);
	ABroadCast( COLOR_YELLOW, String, 2 );
	format(String, sizeof(String), "%s (ID %d) may possibly be weapon hacking (%s)", GetPlayerName(playerid), playerid, WeaponName);
	new logstring[256];
	BanLog(logstring);
	return 1;
}
I copied it from another similar GM to mine and kept fixing it till i got no errors but 97 warnings of arguments that doesn't match, all of them at GetPlayerName, it was originally GetPlayerNameEx, but it kept saying undefined symbol GetPlayerNameEx, even though the GM where I took it from didn't define it

The Code is just a part of the anti cheat, 2 warning at it, the 2 GetPlayerName.

HELP PLEASE!!
Reply
#2

pawn Код:
ExecuteHackerAction( playerid, weaponid )
{
    if(!gPlayerLogged{playerid}) { return 1; }
    if(PlayerInfo[playerid][pTut] == 0) { return 1; }
    if(playerTabbed[playerid] == 1) { return 1; }
    if(GetPVarInt(playerid, "IsInArena") >= 0) { return 1; }

    new String[ 128 ], WeaponName[ 128 ], UserName[24];
    GetWeaponName( weaponid, WeaponName, sizeof( WeaponName ) );
    GetPlayerName(playerid,UserName,24);

    format( String, sizeof( String ), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) may possibly be weapon hacking (%s).", UserName, playerid, WeaponName);
    ABroadCast( COLOR_YELLOW, String, 2 );
    format(String, sizeof(String), "%s (ID %d) may possibly be weapon hacking (%s)", UserName, playerid, WeaponName);
    new logstring[256];
    BanLog(logstring);
    return 1;
}
Reply
#3

Ok it worked for that part, now I tried doing it for the rest. Here's an example, didn't work.

Код:
public OnPlayerChangeWeapon(playerid, oldweapon, newweapon)
{
	if( PlayerInfo[playerid][pGun][1] != 2 && GetPlayerWeapon( playerid ) == 2)
		{
		    // Don't really care about golf club hacking do we?
			//ExecuteHackerAction( playerid, newweapon );
		}
		else if( PlayerInfo[playerid][pGun][1] != 3 && GetPlayerWeapon( playerid ) == 3)
		{
			ExecuteHackerAction( playerid, newweapon );
		}
		else if( PlayerInfo[playerid][pGun][1] != 4 && GetPlayerWeapon( playerid ) == 4)
		{
		    if(PlayerInfo[playerid][pConnectTime] < 2 || PlayerInfo[playerid][pMember] != 8)
		    {
			    new WeaponName[32];
			    new logstring[256];
				GetWeaponName(newweapon, WeaponName, sizeof(WeaponName));
				GetPlayerName(playerid,UserName,24);
				new String[128];
	            format( String, sizeof( String ), "AdmCmd: %s has been banned, reason: Weapon hacking (%s).", UserName, playerid, WeaponName);
				SendClientMessageToAll( COLOR_LIGHTRED, String );
				SetPVarInt(playerid, "_HACK_WARNINGS", 0 );
				//RemovePlayerWeapon(playerid, weaponid);
				new year, month,day;
				getdate(year, month, day);
				new playerip[32];
				GetPlayerIp(playerid, playerip, sizeof(playerip));
				format( String, sizeof( String ), "AdmCmd: %s (IP:%s) was banned, reason: Weapon hacking (%s) (%d-%d-%d)", UserName, playerip, WeaponName ,month,day,year);
				BanLog(logstring);
                new ip[32];
				GetPlayerIp(playerid,ip,sizeof(ip));
				Kick(playerid);
				BanEx(playerid, "Banned By: Autoban Reason: Weapon Hacking");
			}
			ExecuteHackerAction( playerid, newweapon );
		}
Код:
C:\Users\Chaccour\Desktop\EURP\gamemodes\c4.pwn(2804) : error 017: undefined symbol "UserName"
C:\Users\Chaccour\Desktop\EURP\gamemodes\c4.pwn(2806) : error 017: undefined symbol "UserName"
Reply
#4

Don't forget: "new UserName[24];"

pawn Код:
public OnPlayerChangeWeapon(playerid, oldweapon, newweapon)
{
    new UserName[24];
    if( PlayerInfo[playerid][pGun][1] != 2 && GetPlayerWeapon( playerid ) == 2)
        {
            // Don't really care about golf club hacking do we?
            //ExecuteHackerAction( playerid, newweapon );
        }
        else if( PlayerInfo[playerid][pGun][1] != 3 && GetPlayerWeapon( playerid ) == 3)
        {
            ExecuteHackerAction( playerid, newweapon );
        }
        else if( PlayerInfo[playerid][pGun][1] != 4 && GetPlayerWeapon( playerid ) == 4)
        {
            if(PlayerInfo[playerid][pConnectTime] < 2 || PlayerInfo[playerid][pMember] != 8)
            {
                new WeaponName[32];
                new logstring[256];
                GetWeaponName(newweapon, WeaponName, sizeof(WeaponName));
                GetPlayerName(playerid,UserName,24);
                new String[128];
                format( String, sizeof( String ), "AdmCmd: %s has been banned, reason: Weapon hacking (%s).", UserName, playerid, WeaponName);
                SendClientMessageToAll( COLOR_LIGHTRED, String );
                SetPVarInt(playerid, "_HACK_WARNINGS", 0 );
                //RemovePlayerWeapon(playerid, weaponid);
                new year, month,day;
                getdate(year, month, day);
                new playerip[32];
                GetPlayerIp(playerid, playerip, sizeof(playerip));
                format( String, sizeof( String ), "AdmCmd: %s (IP:%s) was banned, reason: Weapon hacking (%s) (%d-%d-%d)", UserName, playerip, WeaponName ,month,day,year);
                BanLog(logstring);
                new ip[32];
                GetPlayerIp(playerid,ip,sizeof(ip));
                Kick(playerid);
                BanEx(playerid, "Banned By: Autoban Reason: Weapon Hacking");
            }
            ExecuteHackerAction( playerid, newweapon );
        }
Reply
#5

Thanks a lot man.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)