C++ plugin error - 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)
+--- Thread: C++ plugin error (
/showthread.php?tid=360458)
C++ plugin error -
xxmitsu - 17.07.2012
Hello Community,
Recently I've tried porting some of my anticheat functions to c++, but somehow I ran into a problem without any solution at least for the moment.
I have this code in my plugin which should communicate with the gamemode and report cheats detections:
pawn Код:
int eGACReport(int playerid,int violation, int extrainfo)
{
int amx_idx = 0;
for(list <AMX *>::iterator i = amx_list.begin(); i != amx_list.end(); ++i)
{
if(amx_FindPublic(*i, "EG_Detected", &amx_idx) == AMX_ERR_NONE)
{
amx_Push(* i, extrainfo);
amx_Push(* i, violation);
amx_Push(* i, playerid);
amx_Exec(* i, NULL, amx_idx);
logprintf("EG_Detected plyd: %d, violation: %d , extrainfo: %d!", playerid, violation, extrainfo);
return 1;
}
else logprintf("EG_Detected Error, function not found?");
}
return 0;
}
C code that triggers cheat detection
pawn Код:
if (weaponid == 46) continue; // parasuta
else if (WeaponSlot(weaponid) == 7 || WeaponSlot(weaponid) == 11 || GetPlayerSpecialAction(playerid) == 2) //SPECIAL_ACTION_USEJETPACK
{
eGACReport(playerid, eGAC_FORBIDDEN_WEAPON, weaponid);
break;
}
here is my pawn callback code
pawn Код:
forward EG_Detected(playerid,violation,extrainfo);
public EG_Detected(playerid,violation,extrainfo)
{
new string[MAXO_TEXT];
switch(violation)
{
case eGAC_FORBIDDEN_WEAPON:
{
format(string, sizeof(string), "[AdmWarn] %s has been kicked by eG-ACheat, armainterzisa: %d ", PlayerName[playerid], extrainfo);
ABroadCast(0xFFFF00AA,string,1);
}
}
return 1;
}
When a weapon cheat is detected, I only get one warning sent to the admins in game, afther that, nothing.
This is what is printed in server_log:
Код:
[23:14:48] EG_Detected Error, function not found?
[23:14:48] EG_Detected Error, function not found?
[23:14:48] EG_Detected plyd: 14, violation: 3 , extrainfo: 25!
[23:14:53] EG_Detected Error, function not found?
[23:14:53] EG_Detected Error, function not found?
[23:14:53] EG_Detected plyd: 14, violation: 3 , extrainfo: 25!
[23:14:58] EG_Detected Error, function not found?
[23:14:58] EG_Detected Error, function not found?
[23:14:58] EG_Detected plyd: 14, violation: 3 , extrainfo: 25!
playerid 14, violation 3 = weapon cheat, extrainfo 25 = weaponid 25.
Any idea why does this have a problem with passing data to the pawn public ?
Thank you in advance,
Mike.