help with my anti cheat
#1

So i decided to start making an anticheat fs for my mates server but i got an error already im fairly new to coding but still i think im generally knowledgeable about it

heres the code
Quote:

#define FILTERSCRIPT
#define COLOR_RED 0xAA3333AA
#include <a_samp>


public OnFilterScriptInit()

forward OnPlayerDeath(playerid, killerid, reason);
public OnPlayerDeath(playerid, killerid, reason);
{
if(GetPlayerweapon(killerid) == 36);
Ban(Killerid);
SendClientMessageToAll(playerid, COLOR_RED, "Weapon Hacks: Rocket Launcher");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

And heres the erros
Quote:

C:\Users\pedro\Desktop\pawno\filterscript.pwn( : error 029: invalid expression, assumed zero
C:\Users\pedro\Desktop\pawno\filterscript.pwn(10) : error 055: start of function body without function header
C:\Users\pedro\Desktop\pawno\filterscript.pwn(11) : error 010: invalid function or declaration
C:\Users\pedro\Desktop\pawno\filterscript.pwn(14) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Reply
#2

pawn Код:
public OnFilterScriptInit()
{
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(GetPlayerWeapon(killerid) == 36)
    {
        BanEx(killerid, "Weapon Hacks");
        SendClientMessageToAll(COLOR_RED, "Weapon Hacks: Rocket Launcher");
    }
    return 1;
}
Reply
#3

You issues are here:
pawn Код:
forward OnPlayerDeath(playerid, killerid, reason);
public OnPlayerDeath(playerid, killerid, reason);
Because OnPlayerDeath is a native callback (meaning it already exists), you don't have to declare(forward) it. Also you have a misplaced semicolon (';') after this line
pawn Код:
public OnPlayerDeath(playerid, killerid, reason);//This semicolon should not exist
Reply
#4

done now i got more errors xD

Quote:

C:\Users\pedro\Desktop\pawno\filterscript.pwn( : error 029: invalid expression, assumed zero
C:\Users\pedro\Desktop\pawno\filterscript.pwn( : error 010: invalid function or declaration
C:\Users\pedro\Desktop\pawno\filterscript.pwn(20) : warning 203: symbol is never used: "OnPlayerDeath"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

Quote:

#define FILTERSCRIPT
#define COLOR_RED 0xAA3333AA
#include <a_samp>


public OnFilterScriptInit()

public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerweapon(killerid) == 36);
BanEx(Killerid, "Weapon Hacks: Rocket Launcher");
}
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

Reply
#5

lol,

pawn Код:
public OnFilterScriptInit()
{
    return 1;
}
Reply
#6

Also change:
pawn Код:
if(GetPlayerweapon(killerid) == 36);
To:
pawn Код:
if(GetPlayerweapon(killerid) == 36)
Reply
#7

Quote:

C:\Users\pedro\Desktop\pawno\filterscript.pwn(13) : error 017: undefined symbol "GetPlayerweapon"
C:\Users\pedro\Desktop\pawno\filterscript.pwn(14) : error 017: undefined symbol "Killerid"
C:\Users\pedro\Desktop\pawno\filterscript.pwn(16) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Quote:

#define FILTERSCRIPT
#define COLOR_RED 0xAA3333AA
#include <a_samp>


public OnFilterScriptInit()
{
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerweapon(killerid) == 36)
BanEx(Killerid, "Weapon Hacks: Rocket Launcher");
}
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

This is it urm some more erros
Reply
#8

Why couldn't you just copy the first post I made, it fixed all your errors

pawn Код:
if(GetPlayerWeapon(killerid) == 36)
BanEx(killerid, "Weapon Hacks: Rocket Launcher");
Fixed now
Reply
#9

well its done now sorry and thanks for the help
Reply
#10

sorry its already been fixed <removed>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)