View Single Post
Author Message
St00ne
Veteran Member
Join Date: Jan 2011
Location: Annecy - France
Old 05-27-2020 , 21:49   Timers: Wiki misunderstanding
Reply With Quote #1

Hi, I'm using timers very often, and try to avoid handles as far as possible.
But I'm having troubles with the callback of a one-time timer using client serial (or user id) because the English wiki and RU wiki don't say the exact same.

I also searched here: https://sm.alliedmods.net/new-api/timers/Timer
Concerning the callback return, it says "Plugin_Stop to stop a repeating timer, any other value for default behavior."

So I'd like to know what to write at the end of such a timer:
PHP Code:
public void OnClientPutInServer(int client)
{
    
CreateTimer(15.0WelcomePlayerGetClientSerial(client)); // You could also use GetClientUserId(client)
}
 
public 
Action WelcomePlayer(Handle timerint serial)
{
    
int client GetClientFromSerial(serial); // Validate the client serial
 
    
if (client == 0// The serial is no longer valid, the player must have disconnected
    
{
        return 
Plugin_Stop;
    }
 
    
PrintToConsole(client"Welcome to the server!");
 
    return 
Plugin_Continue// <- ??? I am pretty sure I used to read return Plugin_Handled in that wiki and they changed it. Are they both working?

Thx for your advice.
St00ne
__________________

*** *** ***
-My plugins-

Last edited by St00ne; 05-27-2020 at 21:52.
St00ne is offline