SA-MP Forums Archive
Help with this timer - 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: Help with this timer (/showthread.php?tid=307390)



Help with this timer - Face9000 - 30.12.2011

Hello guys,i've a scripted a small anticheat for health/armour spawns and i've this timer:

pawn Код:
SetTimer("HealthArmourCheat", 5000, true);
How i can set it will run ONLY when a players spawns health or armour? Instead of adding on OnGameModeInit and check every 5 seconds.


AW: Help with this timer - jack3 - 30.12.2011

pawn Код:
public OnPlayerUpdate(playerid)
{
return 1;
}
Quote:

This callback is called everytime a client/player updates the server with their status.

this is from the samp wiki


Re: Help with this timer - Face9000 - 30.12.2011

OnPlayerUpdate u mad?Epic lag will cause


Re: Help with this timer - Al3xutZzZzZu - 30.12.2011

forward the timers
PHP код:
forward HealthArmourCheat(playerid);
forward HealthArmourCheat2(playerid); 
at gamemodeint

PHP код:
SetTimer("HealthArmourCheat"100true);
SetTimer("HealthArmourCheat2"101true); 
PHP код:
public HealthArmourCheat(playerid)
{
    
GetPlayerArmour(playerid,armour);
    return 
1;
}
public 
HealthArmourCheat2(playerid)
{
    new 
Float:newarmour;
    if(
GetPlayerArmour(playerid,newarmour))
    {
         if (
newarmour armour)
                   {
                      
Kick(playerid);
         }
        return 
1;
    }
    return 
1;




Re: Help with this timer - Face9000 - 30.12.2011

Emh...i've a unique code for Health and Armour spawn,unique timer,i don't need to separate in 2 timers,2 publics and 2 forwards.I just need to run the timer ONLY when the player HP or Armour is more than 99.


Re: Help with this timer - Al3xutZzZzZu - 30.12.2011

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
Emh...i've a unique code for Health and Armour spawn,unique timer,i don't need to separate in 2 timers,2 publics and 2 forwards.I just need to run the timer ONLY when the player HP or Armour is more than 99.
you want to make your timer start when player health/armour is much thaan 99 try to use a new timer that checks that

something like

PHP код:
forward HealthArmourverification(playerid)
SetTimer("HealthArmourverification"5000true);
public 
HealthArmourverification(playerid)
{
    new 
Float:checkarmour;
    if(
GetPlayerArmour(playerid,checkarmour))
    {
        if (
checkarmour 99)
        {
        
//your anticheat timer
        
}
        return 
1;
    }
    else if(
GetPlayerHealth(playerid,checkarmour))
    {
        new 
Float:checkhealth;
        if (
checkhealth 99)
        {
        
//your anticheat timer
        
}
        return 
1;
    }
    return 
1;

something like that you say ?