01.03.2013, 15:23
I made a small anti cheat with the variables pCash.
Now I use this command to check the system.
Basically the system works but something stupid is happening.
But after i'm using this method like killing myself, it gives me -500 cash
and when I use /checkhackers it shows that i'm a hacker.
That's my stocks for giving cash... everything seems OKAY, i've been trying to fix this problem for weeks!!
And when i'm using for example /givemoney with the givecash stock it works..
Now I use this command to check the system.
Basically the system works but something stupid is happening.
pawn Код:
CMD:checkhackers(playerid, params[])
{
new str[128];
if(!CheckAdmin(playerid, ADMIN_LEVEL_1)) return NotAuthMSG(playerid);
foreach(Player, i)
{
new money = GetPlayerMoney(i);
if(money != PlayerInfo[i][pCash])
{
format(str, sizeof(str), "WARNING: [ID:%d]%s is hacking money.", i, GetName(i));
SCM(playerid, COLOR_LIGHTRED, str);
}
if (GetPlayerWeapon(i) != 0 && !Weapons[i][GetPlayerWeapon(i)] && GetPlayerWeapon(i) != 46)
{
format(str, sizeof(str), "WARNING: [ID:%d]%s is hacking weapons.", i, GetName(i));
SCM(playerid, COLOR_LIGHTRED, str);
}
}
return 1;
}
and when I use /checkhackers it shows that i'm a hacker.
pawn Код:
public OnPlayerSpawn(playerid)
{
if(GetIntVar(playerid, "gLogged") != 1)
{
KickEx(playerid, "[SERVER]: You must be logged in to spawn!");
return 1;
}
if(PlayerInfo[playerid][pJailed] < 1) LoadPlayerToys(playerid);
if(GetIntVar(playerid, "JustDied") == 1)
{
PutPlayer(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
SetInterior(playerid, PlayerInfo[playerid][pInt]);
SetWorld(playerid, PlayerInfo[playerid][pWorld]);
SetPlayerCameraPos(playerid,PlayerInfo[playerid][pPosX]+6,PlayerInfo[playerid][pPosY]+3,PlayerInfo[playerid][pPosZ]+3);
SetPlayerCameraLookAt(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
FreezePlayer(playerid);
SetPlayerHealth(playerid, 1000.0);
SetTimerEx("DeadAnim", 100, 0, "i", playerid);
SCM(playerid, COLOR_YELLOW, "You've lost $500 when you died.");
GiveCash(playerid, -500);
SCM(playerid, COLOR_YELLOWG, "You are brutally wounded, you may wait for a medic or '/acceptdeath'.");
}
return 1;
}
That's my stocks for giving cash... everything seems OKAY, i've been trying to fix this problem for weeks!!
pawn Код:
///////////////////////////Cash///////////////////////////////////
stock GiveCash(playerid, cash)
{
GivePlayerMoney(playerid, cash);
return PlayerInfo[playerid][pCash] += cash;
}
stock ResetCash(playerid)
{
PlayerInfo[playerid][pCash] = 0;
ResetPlayerMoney(playerid);
return 1;
}
stock SetCash(playerid, cash)
{
PlayerInfo[playerid][pCash] = cash;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, cash);
return 1;
}
stock GetCash(playerid) return PlayerInfo[playerid][pCash];
///////////////////////////Cash///////////////////////////////////