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)
+--- Thread: anti cheat (
/showthread.php?tid=599077)
anti cheat -
GeneralAref - 20.01.2016
i have this but given 10 massage in 1 sec!! how to fix it?
PHP код:
stock SendMoneyWarn(playerid){
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
for(new i = 0; i < MAX_PLAYERS; i++){
if(PlayerInfo[i][pAdmin] >=1 || IsPlayerAdmin(i)){
new tmp2[50],str[128];
GetPlayerIp(playerid,tmp2,sizeof(tmp2));
format(str,sizeof(str),"%s-%s(%d) maby used money cheat.check him",tmp2,name,playerid);
SendClientMessage(i,COLOR_RED,str);}}
return 1;}
public OnPlayerUpdate(playerid)
{
if(GetPlayerMoney(playerid) > PlayerInfo[playerid][pMoney]){
moneyanticheattimer[playerid] = SetTimerEx("moneyanticheat", 5000, false, "i", playerid);}
return 1;
}
forward moneyanticheat(playerid);
public moneyanticheat(playerid)
{
if(AOptions[amoney] == 0)return 1;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pAdmin] >=1 || IsPlayerAdmin(i))
{
SendMoneyWarn(i);
}
}
return 1;
}
Re: anti cheat -
DeathCore - 20.01.2016
Delete all of this and make a timer which repeats himself every 1000 - 1500ms and then add in it a new function:
PHP код:
SetPlayerMoney(playerid,PlayerInfo[playerid][pMoney]);
if you didn't have the stock:
PHP код:
stock SetPlayerMoney(playerid,howmuch)
{
PRIVATE_Last_Money[playerid]=howmuch;
return GivePlayerMoney(playerid,howmuch-GetPlayerMoney(playerid));
}
Re: anti cheat -
Sjn - 20.01.2016
With your moneyanticheat function, why are you using a loop? There is playerid parameter with the function already, your code makes no sense at all. Also, why do you have to use a timer inside OnPlayerUpdate callback? That's extremely stupid cause OnPlayerUpdate callback gets called constantly for the player.
I would recommend you to read this thread once and learn something about making anti cheat yourself;
https://sampforum.blast.hk/showthread.php?tid=220089
Re: anti cheat -
Pottus - 20.01.2016
Why not just do away with the shitty GetPlayerMoney() and SetPlayerMoney() functions and do it all server sided.