SA-MP Forums Archive
help with my anti cheat - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help with my anti cheat (/showthread.php?tid=249391)



help with my anti cheat - peterRook - 18.04.2011

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.




Re: help with my anti cheat - xir - 18.04.2011

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;
}



Re: help with my anti cheat - Joe Staff - 18.04.2011

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



Re: help with my anti cheat - peterRook - 18.04.2011

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;
}




Re: help with my anti cheat - xir - 18.04.2011

lol,

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



Re: help with my anti cheat - Stigg - 18.04.2011

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



Re: help with my anti cheat - peterRook - 18.04.2011

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


Re: help with my anti cheat - xir - 18.04.2011

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


Re: help with my anti cheat - peterRook - 18.04.2011

well its done now sorry and thanks for the help


Re: help with my anti cheat - CrazyBlob - 18.04.2011

sorry its already been fixed <removed>