Raised This Month: $ Target: $400
 0% 

Message center


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MBf
Member
Join Date: Aug 2016
Old 06-14-2017 , 05:54   Message center
Reply With Quote #1

Hi

I have this plugin and I want 3-5 messages to change every round
Can someone help me ?

Code:
#include <sourcemod>  

#include <cstrike>  



public Plugin myinfo =  

{  

    name = "HUD",  

    author = "Nevvy",  

    description = "",  

    version = "",  

    url = "Nevvy.pl"  

};  



public OnPluginStart()  

{  

    CreateTimer(5.0, HUD, _, TIMER_REPEAT);  

}  



public Action HUD(Handle timer)  

{  

    for (new i = 1; i <= MaxClients; i++)  

    {  

        if (IsClientInGame(i))  

        {  

            SetHudTextParams(-1.0, 0.1, 5.0, 255, 255, 255, 255, 0, 0.1, 0.1, 0.1);  

            ShowHudText(i, 5, "Concurs VIP activ, !concurs pentru detalii");  

        }  

    }  

}
Thank you in advance
__________________
PLAY.ACEARENA.RO
WWW.ACEARENA.RO
MBf is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 06-14-2017 , 08:22   Re: Message center
Reply With Quote #2

Here you are.

PHP Code:
#pragma semicolon 1

#include <sourcemod>  
#include <cstrike>

#pragma newdecls required

// Count of messages
#define MessageCount    5

// Messages to show every 5 second after round start - Edit and add more if you want
char sMessages[MessageCount][256] =  

    
"Hello World!",
    
"Message 1",
    
"Message 2",
    
"Message 3",
    
"Message 4"
};

int j 0;


public 
void OnPluginStart()
{
    
HookEvent("round_start"OnRoundStart);
}

public 
Action OnRoundStart(Handle event, const char[] namebool dontBroadcast)
{
    
SetHudTextParams(-1.00.15.025525525525500.10.10.1); 
    
CreateTimer(5.0ShowHUD_TIMER_REPEAT);
    
0;
}


public 
Action ShowHUD(Handle timer)  
{
    if(
>= MessageCount
        return 
Plugin_Stop;
    
    for (
int i 1<= MaxClientsi++) 
    {
        if (
IsClientInGame(i) && !IsFakeClient(i))  
        {
            
ShowHudText(i5sMessages[j]);
        }
    }  
    
j++;
    return 
Plugin_Continue;


Last edited by WatchDogs; 06-14-2017 at 08:23.
WatchDogs is offline
sHoC
Senior Member
Join Date: Nov 2015
Location: Italy
Old 06-14-2017 , 12:22   Re: Message center
Reply With Quote #3

Quote:
Originally Posted by WatchDogs View Post
Here you are.

PHP Code:
#pragma semicolon 1

#include <sourcemod>  
#include <cstrike>

#pragma newdecls required

// Count of messages
#define MessageCount    5

// Messages to show every 5 second after round start - Edit and add more if you want
char sMessages[MessageCount][256] =  

    
"Hello World!",
    
"Message 1",
    
"Message 2",
    
"Message 3",
    
"Message 4"
};

int j 0;


public 
void OnPluginStart()
{
    
HookEvent("round_start"OnRoundStart);
}

public 
Action OnRoundStart(Handle event, const char[] namebool dontBroadcast)
{
    
SetHudTextParams(-1.00.15.025525525525500.10.10.1); 
    
CreateTimer(5.0ShowHUD_TIMER_REPEAT);
    
0;
}


public 
Action ShowHUD(Handle timer)  
{
    if(
>= MessageCount
        return 
Plugin_Stop;
    
    for (
int i 1<= MaxClientsi++) 
    {
        if (
IsClientInGame(i) && !IsFakeClient(i))  
        {
            
ShowHudText(i5sMessages[j]);
        }
    }  
    
j++;
    return 
Plugin_Continue;

If I want a message every 30 seconds? or 60 seconds?
__________________
sHoC is offline
WatchDogs
Senior Member
Join Date: Oct 2015
Location: Iran
Old 06-14-2017 , 12:29   Re: Message center
Reply With Quote #4

Just change line 32:

PHP Code:
CreateTimer(5.0ShowHUD_TIMER_REPEAT); 
To
PHP Code:
CreateTimer(Seconds.0ShowHUD_TIMER_REPEAT); 

Examples:

Every 30 Seconds:
PHP Code:
CreateTimer(30.0ShowHUD_TIMER_REPEAT); 

Or Every 60 Seconds:

PHP Code:
CreateTimer(60.0ShowHUD_TIMER_REPEAT); 
WatchDogs is offline
sHoC
Senior Member
Join Date: Nov 2015
Location: Italy
Old 06-14-2017 , 15:19   Re: Message center
Reply With Quote #5

Quote:
Originally Posted by WatchDogs View Post
Just change line 32:

PHP Code:
CreateTimer(5.0ShowHUD_TIMER_REPEAT); 
To
PHP Code:
CreateTimer(Seconds.0ShowHUD_TIMER_REPEAT); 

Examples:

Every 30 Seconds:
PHP Code:
CreateTimer(30.0ShowHUD_TIMER_REPEAT); 

Or Every 60 Seconds:

PHP Code:
CreateTimer(60.0ShowHUD_TIMER_REPEAT); 
RESPECT. ty man
__________________
sHoC is offline
MBf
Member
Join Date: Aug 2016
Old 06-15-2017 , 02:36   Re: Message center
Reply With Quote #6

thank you
Quote:
Originally Posted by WatchDogs View Post
Here you are.

PHP Code:
#pragma semicolon 1

#include <sourcemod>  
#include <cstrike>

#pragma newdecls required

// Count of messages
#define MessageCount    5

// Messages to show every 5 second after round start - Edit and add more if you want
char sMessages[MessageCount][256] =  

    
"Hello World!",
    
"Message 1",
    
"Message 2",
    
"Message 3",
    
"Message 4"
};

int j 0;


public 
void OnPluginStart()
{
    
HookEvent("round_start"OnRoundStart);
}

public 
Action OnRoundStart(Handle event, const char[] namebool dontBroadcast)
{
    
SetHudTextParams(-1.00.15.025525525525500.10.10.1); 
    
CreateTimer(5.0ShowHUD_TIMER_REPEAT);
    
0;
}


public 
Action ShowHUD(Handle timer)  
{
    if(
>= MessageCount
        return 
Plugin_Stop;
    
    for (
int i 1<= MaxClientsi++) 
    {
        if (
IsClientInGame(i) && !IsFakeClient(i))  
        {
            
ShowHudText(i5sMessages[j]);
        }
    }  
    
j++;
    return 
Plugin_Continue;

__________________
PLAY.ACEARENA.RO
WWW.ACEARENA.RO
MBf 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 10:20.


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