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

Execute CVAR with 1min timeleft


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
csjesse
Junior Member
Join Date: Jun 2011
Old 05-08-2012 , 18:00   Execute CVAR with 1min timeleft
Reply With Quote #1

Trying to write a very simple plugin

When the timeleft=1, OR when a round ends, I would like a certain cvar (sm_psay perhaps) to run.


I imagine this should be no more than 3-4 lines...

Any help is appreciated!
csjesse is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 05-08-2012 , 18:34   Re: Execute CVAR with 1min timeleft
Reply With Quote #2

I think it will be a bit more than 3-4 lines.

You have to setup a timer OnMapStart for mp_timeleft * 60.0.
Then you also have to react on when the cvar mp_timeleft changes.
You can use the forward OnMapTimeLeftChanged. Kill the timer and start it with the new value.

sm_psay is a command afaik, not a cvar. It's a bad thing to call commands from plugins. I think you can use PrintToChat() instead.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
Reply


Thread Tools
Display Modes

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 06:07.


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