Raised This Month: $32 Target: $400
 8% 

Solved Cvar to enable/disable Hook round_start PrintToChatAll


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-19-2018 , 04:06   Cvar to enable/disable Hook round_start PrintToChatAll
Reply With Quote #1

Hey, can someone help me with this Code, to enable and disable with sm_roundtext 1/0

(this Code will be a example for me, how to Code with Cvar, need to learn it ^^)
PHP Code:
public void OnPluginStart()
{
    
HookEvent("round_start"Event_RoundStartEventHookMode_Pre);
}
 
public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    
PrintToChatAll("New Round Start");

Thanks.

Last edited by iskenderkebab33; 11-03-2018 at 17:33.
iskenderkebab33 is offline
Facksy
Senior Member
Join Date: Apr 2017
Location: +2+2
Old 07-19-2018 , 05:00   Re: Cvar to enable/disable Hook round_start PrintToChatAll
Reply With Quote #2

PHP Code:
#include <sourcemod>

ConVar g_hCvarDisplayText;

public 
void OnPluginStart() 

    
HookEvent("round_start"Event_RoundStartEventHookMode_Pre);
    
g_hCvarDisplayText CreateConVar("sm_roundtext""1""Display text 1/0");

  
public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast
{
    if(
g_hCvarDisplayText.BoolValue)
        
PrintToServer("New Round Start"); 

It should works
__________________
My Steam I take private requests if related with TF2
My Plugins
Facksy is offline
iskenderkebab33
Senior Member
Join Date: Jun 2018
Old 07-19-2018 , 05:03   Re: Cvar to enable/disable Hook round_start PrintToChatAll
Reply With Quote #3

Quote:
Originally Posted by Facksy View Post
PHP Code:
#include <sourcemod>

ConVar g_hCvarDisplayText;

public 
void OnPluginStart() 

    
HookEvent("round_start"Event_RoundStartEventHookMode_Pre);
    
g_hCvarDisplayText CreateConVar("sm_roundtext""1""Display text 1/0");

  
public 
Action Event_RoundStart(Event event, const char[] namebool dontBroadcast
{
    if(
g_hCvarDisplayText.BoolValue)
        
PrintToServer("New Round Start"); 

It should works
thanks!
iskenderkebab33 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 12:22.


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