Raised This Month: $ Target: $400
 0% 

Open MOTD On Timer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fuzzah
Junior Member
Join Date: Jul 2014
Old 07-07-2014 , 16:00   Open MOTD On Timer
Reply With Quote #1

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_firsturlurlsizeof(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"setupfalse);
                
CloseHandle(setup);
                
playerdeath[client] = 0;
                return 
Plugin_Handled;
        }

Fuzzah is offline
Fuzzah
Junior Member
Join Date: Jul 2014
Old 07-09-2014 , 15:37   Re: Open MOTD On Timer
Reply With Quote #2

Any help?
Fuzzah is offline
blaacky
Senior Member
Join Date: Oct 2012
Old 07-09-2014 , 20:45   Re: Open MOTD On Timer
Reply With Quote #3

I think this is what you want

PHP Code:
public Action:OnDeath(Handle:event, const String:name[], bool:dontBroadcast

    
decl String:url[128];
    
GetConVarString(g_firsturlurlsizeof(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); 
        
ShowMOTDPanel(client"You died!"urlMOTDPANEL_TYPE_URL);
        
playerdeath[client] = 0;
        
        
CreateTimer(3.0Timer_MotdGetEventInt(event"userid"));
        
        return 
Plugin_Handled;
    } 
}  

public 
Action:Timer_Motd(Handle:timerany:data)
{
    new 
client GetClientOfUserId(data);
    
    if(
client != 0)
    {
        
// Show new url here
    
}

blaacky is offline
Fuzzah
Junior Member
Join Date: Jul 2014
Old 07-10-2014 , 18:34   Re: Open MOTD On Timer
Reply With Quote #4

Quote:
Originally Posted by blaacky View Post
I think this is what you want
That's exactly it. Thanks!
Fuzzah is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode