Raised This Month: $51 Target: $400
 12% 

[TF2] Open motd every X death


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sumsar
SourceMod Donor
Join Date: Jan 2012
Old 07-07-2012 , 16:10   [TF2] Open motd every X death
Reply With Quote #1

I am looking for something that would open the MOTD every X deaths (this would be great if it is changeable )
If you know about something like this please send me a link, i have not been able to find anything simillar.

Last edited by Sumsar; 10-30-2014 at 23:16.
Sumsar is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 07-07-2012 , 16:45   Re: [REQ][TF2] Open motd every X death
Reply With Quote #2

Try this, haven't tested it, but just put it together with some floats.

This is for every 3 deaths.
PHP Code:
#pragma semicolon 1

#include <sourcemod>

new Float:playerdeath[MAXPLAYERS 1];

public 
OnPluginStart()
{
    
HookEvent("player_death"OnDeath);
}

public 
OnClientPutInServer(client)
{
    
playerdeath[client] = 0.0;
}

public 
Action:OnDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
playerdeath[client] + 1.0;
    if(
playerdeath[client] == 3.0)
    {
        
ShowMOTDPanel(client"Title""Message");    //You change this.
        
playerdeath[client] = 0.0;
    }


Last edited by ReFlexPoison; 07-07-2012 at 17:42.
ReFlexPoison is offline
Sumsar
SourceMod Donor
Join Date: Jan 2012
Old 07-07-2012 , 18:06   Re: [REQ][TF2] Open motd every X death
Reply With Quote #3

Thanks for the fast reply, I will test this now.
Edit: I will test it tomorrow because my current server is running sm 1.4.3

Last edited by Sumsar; 07-07-2012 at 19:05.
Sumsar is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 07-07-2012 , 21:16   Re: [REQ][TF2] Open motd every X death
Reply With Quote #4

Why on earth would you use a Float for a counter??

Also, to increment a variable, you use +=

PHP Code:
#pragma semicolon 1

#include <sourcemod>

new playerdeath[MAXPLAYERS 1];

public 
OnPluginStart()
{
    
HookEvent("player_death"OnDeath);
}

public 
OnClientPutInServer(client)
{
    
playerdeath[client] = 0;
}

public 
Action:OnDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
playerdeath[client] += 1;
    if(
playerdeath[client] == 3)
    {
        
ShowMOTDPanel(client"Title""Message");    //You change this.
        
playerdeath[client] = 0;
    }

__________________
Dr. McKay is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 07-07-2012 , 21:38   Re: [REQ][TF2] Open motd every X death
Reply With Quote #5

Quote:
Originally Posted by Dr. McKay View Post
Why on earth would you use a Float for a counter??

Also, to increment a variable, you use +=

PHP Code:
#pragma semicolon 1

#include <sourcemod>

new playerdeath[MAXPLAYERS 1];

public 
OnPluginStart()
{
    
HookEvent("player_death"OnDeath);
}

public 
OnClientPutInServer(client)
{
    
playerdeath[client] = 0;
}

public 
Action:OnDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
playerdeath[client] += 1;
    if(
playerdeath[client] == 3)
    {
        
ShowMOTDPanel(client"Title""Message");    //You change this.
        
playerdeath[client] = 0;
    }

because i was tired and didn't know why the integer i tried first wasn't working
ReFlexPoison is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 07-07-2012 , 21:59   Re: [REQ][TF2] Open motd every X death
Reply With Quote #6

playerdeath[client] += 1; ->

playerdeath[client]++;

?

Mitchell is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 07-07-2012 , 22:12   Re: [REQ][TF2] Open motd every X death
Reply With Quote #7

Quote:
Originally Posted by Mitchell View Post
playerdeath[client] += 1; ->

playerdeath[client]++;

?

*facepalm*
__________________
Dr. McKay is offline
Sumsar
SourceMod Donor
Join Date: Jan 2012
Old 07-08-2012 , 12:16   Re: [REQ][TF2] Open motd every X death
Reply With Quote #8

So I compiled it like this
PHP Code:
#pragma semicolon 1

#include <sourcemod>

new playerdeath[MAXPLAYERS 1];

public 
OnPluginStart()
{
    
HookEvent("player_death"OnDeath);
}

public 
OnClientPutInServer(client)
{
    
playerdeath[client] = 0;
}

public 
Action:OnDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    
playerdeath[client] += 1;
    if(
playerdeath[client] == 3)
    {
        
ShowMOTDPanel(client"Advertisement""http://mywebsite.com");    //You change this.
        
playerdeath[client] = 0;
    }

And it shows a MOTD window with the title "Advertisements" but it does not load up the url, it just stays blank. So I guess you need something more to give it url support?

Last edited by Sumsar; 07-08-2012 at 12:16.
Sumsar is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 07-08-2012 , 13:33   Re: [REQ][TF2] Open motd every X death
Reply With Quote #9

ShowMOTDPanel(client, "Advertisement", "http://mywebsite.com", MOTDPANEL_TYPE_URL);
ReFlexPoison is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 07-08-2012 , 14:19   Re: [REQ][TF2] Open motd every X death
Reply With Quote #10

also im not sure if you put the http part
try mywebsite.com/index.html
Mitchell 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 22:56.


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