I have the following code which opens the user's MOTD after two deaths. I need to open the user's MOTD after two deaths and then open it again to a different URL after x seconds. I don't have much experience with SourceMod.
PHP Code:
#pragma semicolon 1
#define PLUGIN_VERSION "1.0"
#include <sourcemod>
public Plugin:myinfo = {
name = "URL on death",
author = "Fuzzah",
description = "--",
version = PLUGIN_VERSION,
url = "http://google.com"
};
new playerdeath[MAXPLAYERS + 1];
new Handle:g_firsturl;
public OnPluginStart()
{
g_firsturl = CreateConVar("sm_firsturl", "www.google.com", "MOTD URL to be used");
HookEvent("player_death", OnDeath);
}
public OnClientPutInServer(client)
{
playerdeath[client] = 0;
}
public Action:OnDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
decl String:url[128];
GetConVarString(g_firsturl, url, sizeof(url));
new client = GetClientOfUserId(GetEventInt(event, "userid"));
playerdeath[client] += 1;
if(playerdeath[client] == 2)
{
new Handle:setup = CreateKeyValues("data");
KvSetString(setup, "title", "You died!");
KvSetNum(setup, "type", MOTDPANEL_TYPE_URL);
KvSetString(setup, "msg", url);
ShowVGUIPanel(client, "info", setup, false);
CloseHandle(setup);
playerdeath[client] = 0;
return Plugin_Handled;
}
}