AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   [TF2] Open motd every X death (https://forums.alliedmods.net/showthread.php?t=189487)

Sumsar 07-07-2012 16:10

[TF2] Open motd every X death
 
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.

ReFlexPoison 07-07-2012 16:45

Re: [REQ][TF2] Open motd every X death
 
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;
    }



Sumsar 07-07-2012 18:06

Re: [REQ][TF2] Open motd every X death
 
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

Dr. McKay 07-07-2012 21:16

Re: [REQ][TF2] Open motd every X death
 
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;
    }



ReFlexPoison 07-07-2012 21:38

Re: [REQ][TF2] Open motd every X death
 
Quote:

Originally Posted by Dr. McKay (Post 1745723)
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 :cry:

Mitchell 07-07-2012 21:59

Re: [REQ][TF2] Open motd every X death
 
playerdeath[client] += 1; ->

playerdeath[client]++;

?


Dr. McKay 07-07-2012 22:12

Re: [REQ][TF2] Open motd every X death
 
Quote:

Originally Posted by Mitchell (Post 1745752)
playerdeath[client] += 1; ->

playerdeath[client]++;

?


*facepalm*

Sumsar 07-08-2012 12:16

Re: [REQ][TF2] Open motd every X death
 
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?

ReFlexPoison 07-08-2012 13:33

Re: [REQ][TF2] Open motd every X death
 
ShowMOTDPanel(client, "Advertisement", "http://mywebsite.com", MOTDPANEL_TYPE_URL);

Mitchell 07-08-2012 14:19

Re: [REQ][TF2] Open motd every X death
 
also im not sure if you put the http part
try mywebsite.com/index.html


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

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