View Single Post
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 01-06-2017 , 19:37   Re: Ham_Touch spam issue
Reply With Quote #7

@Craxor what is the purpose of using rounded time? Rounded time in your code gives not 10 secs, but from 9.5 to 10.5 secs.
So:
PHP Code:
#define GetCurrentGameTime get_gametime

new Float:g_nextNotificationTime[MAX_PLAYERS 1];

public 
PlayerTouch(touchedPlayertoucher)
{
    if (
GetCurrentGameTime() >= g_nextNotificationTime[touchedPlayer])
    {
        
// Notify touched player
        
        
const delaySeconds 10;
        
g_nextNotificationTime[touchedPlayer] = GetCurrentGameTime() + delaySeconds;
    }
    
    
// if you need to count remain seconds you can use this:
    // floatround(g_nextNotificationTime[touchedPlayer] - GetCurrentGameTime(), floatround_ceil)

__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@