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.0, WelcomePlayer, GetClientSerial(client)); // You could also use GetClientUserId(client)
}
public Action WelcomePlayer(Handle timer, int 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
__________________