02.08.2014, 13:37
Hello, i tried to make my own little anti-money hack script, but it keeps banning even the money were legit.
I noticed it does so when giving it negative values (to take money from the player) so i tried to modify it a bit, however it's still bugged...
A little help please?![Cheesy](images/smilies/biggrin.png)
This is the SafeGivePlayerMoney function
And this is the script that checks if pMoney is equal to the player's money
Thanks
I noticed it does so when giving it negative values (to take money from the player) so i tried to modify it a bit, however it's still bugged...
A little help please?
![Cheesy](images/smilies/biggrin.png)
This is the SafeGivePlayerMoney function
pawn Код:
stock abs( value )
{
return ( ( value < 0 ) ? ( value * -1 ) : ( value ) );
}
stock SafeGivePlayerMoney(playerid, money)
{
if(money > 0)
{
pMoney[playerid] += money;
}
else
{
pMoney[playerid] -= abs(money);
}
GivePlayerMoney(playerid, money);
}
pawn Код:
public OnPlayerUpdate(playerid)
{
if(!IsPlayerConnected(playerid)) return 0;
if(GetPlayerMoney(playerid) != pMoney[playerid])
{
new playername[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),"Server: {FF0000}%s {FFFFFF}was banned, reason: {FF0000}Money Hack{FFFFFF}",playername);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(pInfo[i][Admin] >= 1)
{
SCM(i,COLOR_LIGHTRED,string);
}
}
}
new logstring[256],d,m,y,h,mi,s;
gettime(h,mi,s);
getdate(y,m,d);
new plrIP[16];
GetPlayerIp(playerid, plrIP, sizeof(plrIP));
format(logstring,sizeof(logstring),"%d/%d/%d %d:%d:%d Server: %s[%s] was banned, reason: Money Hack",d,m,y,h,mi,s,playername,plrIP);
Log(logstring);
SafeResetPlayerMoney(playerid);
new banstring[128];
format(banstring,sizeof(banstring),"banip %s",plrIP);
SendRconCommand(banstring);
SendRconCommand("reloadbans");
pInfo[playerid][Banned]=1;
SetTimerEx("TimeKick",500,false,"i",playerid);
}
return 1;
}
![Cheesy](images/smilies/biggrin.png)