// l4d2-welcome-message.sp — Left 4 Dead 2 SourceMod plugin // // Greets joining players with a staggered series of chat messages so the // info doesn't all blast at once (and scroll past in two seconds). // // Build: // spcomp l4d2-welcome-message.sp -o l4d2-welcome-message.smx // Drop the .smx into addons/sourcemod/plugins/ on the server. // // Schedule (per-player, fired on OnClientPostAdminCheck): // t=3s greeting + server name // t=8s link to stats site // t=15s commands cheat-sheet // t=25s rules + closing line // // Each timer carries the client's UserID rather than their slot number, // so if the player disconnects between timer-creation and timer-fire the // callback safely no-ops via GetClientOfUserId() returning 0. // // Bots (IsFakeClient) are skipped — only humans get the welcome. // // Author: magikh0e // License: GPL-3.0-or-later #include #pragma semicolon 1 #pragma newdecls required public Plugin myinfo = { name = "Welcome Message", author = "magikh0e", description = "Greets players on join with staggered server info", version = "2.0", url = "" }; public void OnClientPostAdminCheck(int client) { if (IsFakeClient(client)) return; // Stagger messages so chat isn't flooded CreateTimer(3.0, Timer_Welcome1, GetClientUserId(client)); CreateTimer(8.0, Timer_Welcome2, GetClientUserId(client)); CreateTimer(15.0, Timer_Welcome3, GetClientUserId(client)); CreateTimer(25.0, Timer_Welcome4, GetClientUserId(client)); } public Action Timer_Welcome1(Handle timer, any userid) { int client = GetClientOfUserId(userid); if (client == 0 || !IsClientInGame(client)) return Plugin_Stop; PrintToChat(client, "\x04======================================"); PrintToChat(client, "\x04[Server]\x03 Aloha \x05%N\x03!\x01 Welcome to \x04Tropical Roots Maui - L4D2 Servah", client); PrintToChat(client, "\x04======================================"); return Plugin_Stop; } public Action Timer_Welcome2(Handle timer, any userid) { int client = GetClientOfUserId(userid); if (client == 0 || !IsClientInGame(client)) return Plugin_Stop; PrintToChat(client, "\x04[Server]\x01 Stats are tracked across sessions. View at:"); PrintToChat(client, "\x05 https://l4d2.magikh0e.pl"); return Plugin_Stop; } public Action Timer_Welcome3(Handle timer, any userid) { int client = GetClientOfUserId(userid); if (client == 0 || !IsClientInGame(client)) return Plugin_Stop; PrintToChat(client, "\x04[Commands]\x01 \x05!kills\x01 - common kills | \x05!rate\x01 - rate this map"); PrintToChat(client, "\x04[Commands]\x01 \x05!rtv\x01 - vote new map | \x05!nominate\x01 - suggest one | \x05!votekick\x01"); return Plugin_Stop; } public Action Timer_Welcome4(Handle timer, any userid) { int client = GetClientOfUserId(userid); if (client == 0 || !IsClientInGame(client)) return Plugin_Stop; PrintToChat(client, "\x04[Rules]\x01 Be cool. No intentional griefing or team kills."); PrintToChat(client, "\x04[Server]\x01 End-of-map stats are auto-announced. Have fun out there!"); return Plugin_Stop; }