|
BANNED
|
01-01-2014
, 13:15
Re: Advanced ShowMOTDPanel
|
#4
|
Thanks to this excellent native, I was able to FINALLY create a working "Big MOTD on connect" plugin. It uses some code from MasteroftheXP's Block MOTD plugin which is why there seems to be an issue where using this causes players to not be able to select a class or a team.
Here's the code
Spoiler
PHP Code:
#include <sourcemod> #include <advanced_motd>
#pragma semicolon 1
#define PLUGIN_VERSION "1.0"
new bool:ClientMOTDBlocked[MAXPLAYERS + 1];
public OnPluginStart() { HookUserMessage(GetUserMessageId("Train"), UserMessageHook, true); for (new i = 1; i <= MaxClients; i++) ClientMOTDBlocked[i] = IsClientInGame(i); }
public OnClientDisconnect(client) ClientMOTDBlocked[client] = false;
public Action:UserMessageHook(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init) { if (playersNum == 1) { if (IsClientConnected(players[0])) { if (!ClientMOTDBlocked[players[0]] && !IsFakeClient(players[0])) { ClientMOTDBlocked[players[0]] = true; CreateTimer(0.0, KillMOTD, GetClientUserId(players[0]), TIMER_FLAG_NO_MAPCHANGE); } } } }
public Action:KillMOTD(Handle:timer, any:uid) { new client = GetClientOfUserId(uid); if (!client) return; AdvMOTD_ShowMOTDPanel(client, "MOTD", "http://www.google.com", MOTDPANEL_TYPE_URL, true, true, true, OnMOTDFailure); }
public OnMOTDFailure(client, MOTDFailureReason:reason) { if (reason == MOTDFailure_Disabled) { PrintToChat(client, "[SM] You have HTML MOTDs disabled."); } else if (reason == MOTDFailure_Matchmaking) { PrintToChat(client, "[SM] You cannot view HTML MOTDs because you joined via Quickplay."); } else if (reason == MOTDFailure_QueryFailed) { PrintToChat(client, "[SM] Unable to verify that you can view HTML MOTDs."); } else { PrintToChat(client, "[SM] Unable to verify that you can view HTML MOTDs for an unknown reason."); } }
Last edited by 404UserNotFound; 01-01-2014 at 13:16.
|
|
|
|