Help with this timer
#1

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.
Reply
#2

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
Reply
#3

OnPlayerUpdate u mad?Epic lag will cause
Reply
#4

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;

Reply
#5

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.
Reply
#6

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 ?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)