Here's a simple plugin that will send a message 60 seconds after a player spawns. If the player respawns, the old timer will be stopped and a new timer will be started.
PHP Code:
#pragma semicolon 1
#include <sourcemod>
new Handle:g_hSpawnTimers[MAXPLAYERS+1] = {INVALID_HANDLE};
public OnPluginStart()
{
HookEvent("player_spawn", Event_PlayerSpawn);
}
public OnClientDisconnect(client)
{
if (g_hSpawnTimers[client] != INVALID_HANDLE)
{
KillTimer(g_hSpawnTimers[client]);
g_hSpawnTimers[client] = INVALID_HANDLE;
}
}
public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (client > 0 && g_hSpawnTimers[client] != INVALID_HANDLE)
{
KillTimer(g_hSpawnTimers[client]);
g_hSpawnTimers[client] = INVALID_HANDLE;
}
g_hSpawnTimers[client] = CreateTimer(60.0, Timer_Callback, GetClientUserId(client));
}
public Action:Timer_Callback(Handle:timer, any:userid)
{
new client = GetClientOfUserId(userid);
if (client > 0)
{
PrintToChatAll("Player \"%N\" spawned 60 seconds ago!", client);
g_hSpawnTimers[client] = INVALID_HANDLE;
}
return Plugin_Continue;
}
I hope this is a good enough example to give you an idea of where to start.