public OnPlayerUpdate(playerid)
{
//Money hack checker
if(IsPlayerConnected(playerid))
{
if(GetPlayerMoney(playerid) >= MAX_MONEY)
{
if(Check[playerid] == 0)
{
SetTimerEx("MoneyHackTimer", 60000, 1, "i", playerid);
KillTimer(MoneyHackTimer(playerid));
Check[playerid] = 1;
}
}
if(GetPlayerSpeed(playerid) >= MAX_SPEED)
{
if(Check1[playerid] == 0)
{
SetTimerEx("SpeedHackTimer", 30000, 1, "i", playerid);
KillTimer(SpeedHackTimer(playerid));
Check1[playerid] = 1;
}
}
if(GetPlayerWeapon(playerid) == 38)
{
if(Check2[playerid] == 0)
{
SetTimerEx("WeaponHackTimer", 30000, 1, "i", playerid);
KillTimer(WeaponHackTimer(playerid));
Check2[playerid] = 1;
}
}
}
return 1;
}
forward MoneyHackTimer(playerid);
public MoneyHackTimer(playerid)
{
new string[256], string2[256];
format(string, sizeof(string), " %s (ID: %d) is a possible money hacker!", GetName(playerid), playerid);
format(string2, sizeof(string2),"Money: $%d!", GetPlayerMoney(playerid));
printf(string);
printf(string2);
return 1;
}
forward SpeedHackTimer(playerid);
public SpeedHackTimer(playerid)
{
new string[256], string2[256];
format(string, sizeof(string), "%s (ID: %d) is a possible speed hacker!", GetName(playerid), playerid);
format(string2, sizeof(string2),"Speed: %d KMH!", GetPlayerSpeed(playerid));
printf(string);
printf(string2);
return 1;
}
forward WeaponHackTimer(playerid);
public WeaponHackTimer(playerid)
{
new string[256], string2[256];
format(string, sizeof(string), "%s (ID: %d) is a possible Minigun hacker!", GetName(playerid), playerid);
format(string2, sizeof(string2),"Ammo: %d bullets!", GetPlayerAmmo(playerid));
printf(string);
printf(string2);
return 1;
}
stock GetName(playerid)
{
new pnameid[24];
GetPlayerName(playerid,pnameid,24);
return pnameid;
}
stock GetPlayerSpeed(playerid)
{
new Float:ST[4];
if(IsPlayerInAnyVehicle(playerid))
GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625;
return floatround(ST[3]);
}
KillTimer(MoneyHackTimer(playerid));
new timerMoneyHack[MAX_PLAYERS] = {INVALID_PLAYER_ID, ...};
KillTimer(timerMoneyHack[playerid]); // Make sure you kill the timer first ( If it was already set )
timerMoneyHack[playerid] = SetTimer(...);
SetTimerEx("MoneyHackTimer", 60000, 1, "i", playerid);
// my timer
SetTimerEx("MoneyHackTimer", 1000, 0, "i", playerid);
I'm sorry, I'm not really following here..
So what exactly should I edit to fix BOTH of my problems? ((Kinda sleepy so ain't really functioning right xD)) I did repeat 1 so it keeps sending it every minute to the console.. Was on purpose(Gonna change it now though). Would fix the problem to change it to 0? And about the KillTimer, if I remove all the KillTimers, wouldn't there be ALOT of timers running after some time, which cause lag? |
My system is already bugged, even if you stop the speed hacking, it shows you're hacking.
So if you hacked at 350KMH, it will later show, if you've stopped: Player1 is hacking, speed: 0.. And when you /q, if you were detected as hacking, it keeps showing: ID 0 is hacking, etc.. But if you weren't hacking, doesn't show anything. |
No, that was before the fix, let me try the new one with 1000 time and 0 for repeat.
I will edit my post for results. EDIT: Well it worked, sends a message that a guy is hacking, then no spam.. But won't that cause many timers to be running at a same time and cause lag? That's the last question. |