Raised This Month: $60 Target: $400
 15% 

Simple Knife Warmup


Post New Thread Reply   
 
Thread Tools Display Modes
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 10-22-2009 , 12:15   Re: Simple Knife Warmup
Reply With Quote #11

Quote:
This should be done whenever needed and you should use pcvars when you set it later.
Why ? In this case, I need to create two variables: one pointer and one for value. I want to get cvar value only one time, because warmup round should run only one per map / I never seen changes mp_freezetime while server is running.
__________________
Join US - custom Zombie Server - Custom Addons:



Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-22-2009 , 18:23   Re: Simple Knife Warmup
Reply With Quote #12

There are only two situations in which pcvars are slower:
  • You only reference the cvar once.
  • You need to use set_cvar_string() (and even this has some weird technicalities).
In this case, you make reference to mp_freezetime thrice in the code, and probably a good 10-20 times on the average lifespan of a loaded plugin.

PHP Code:
public plugin_cfg() 
{
    
mp_freezetime get_cvar_num("mp_freezetime")

PHP Code:
        set_task(1.0"restart"TASKID__"b")        
        
set_cvar_num("mp_freezetime"0)        
    } 
PHP Code:
    if(hudtimer <= 0)
    {
        
remove_task(TASKID)
        
set_cvar_num("sv_restartround"1)
        
set_cvar_num("mp_freezetime"mp_freezetime)        
    } 
So use pcvars.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-23-2009 , 01:13   Re: Simple Knife Warmup
Reply With Quote #13

Also, you should consider that mp_freezetime can be set in amxx.cfg, or even in mapname.cfg, so retrieve its value in plugin_cfg is too early.

From admin.sma :
PHP Code:
public plugin_cfg()
{
    
set_task(6.1"delayed_load")
}

public 
delayed_load()
{
    new 
configFile[128], curMap[64], configDir[128]

    
get_configsdir(configDirsizeof(configDir)-1)
    
get_mapname(curMapsizeof(curMap)-1)

    new 
i=0;
    
    while (
curMap[i] != '_' && curMap[i++] != '^0') {/*do nothing*/}
    
    if (
curMap[i]=='_')
    {
        
// this map has a prefix
        
curMap[i]='^0';
        
formatex(configFilesizeof(configFile)-1"%s/maps/prefix_%s.cfg"configDircurMap);

        if (
file_exists(configFile))
        {
            
server_cmd("exec %s"configFile);
        }
    }

    
get_mapname(curMapsizeof(curMap)-1)

    
    
formatex(configFilesizeof(configFile)-1"%s/maps/%s.cfg"configDircurMap)

    if (
file_exists(configFile))
    {
        
server_cmd("exec %s"configFile)
    }
    

I think a ~10.0 task should be better.
__________________
- tired and retired -
ConnorMcLeod is offline
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 10-23-2009 , 12:31   Re: Simple Knife Warmup
Reply With Quote #14

So ok. I'll make it.
__________________
Join US - custom Zombie Server - Custom Addons:



Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
Redfalcon
BANNED
Join Date: Sep 2009
Location: Prison Break
Old 10-23-2009 , 12:54   Re: Simple Knife Warmup
Reply With Quote #15

Already posted.
Redfalcon is offline
Send a message via MSN to Redfalcon
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 10-26-2009 , 08:20   Re: Simple Knife Warmup
Reply With Quote #16

Check it now.
__________________
Join US - custom Zombie Server - Custom Addons:



Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
kr4nk
Junior Member
Join Date: Nov 2009
Location: Vienna
Old 11-21-2009 , 07:04   Re: Simple Knife Warmup
Reply With Quote #17

Very nice plugin
kr4nk is offline
Send a message via MSN to kr4nk
takenb
Junior Member
Join Date: Oct 2009
Old 12-01-2009 , 22:56   Re: Simple Knife Warmup
Reply With Quote #18

Please test this language:
Quote:
[cn]
WARUMP_START = 刀战热身开始!
WARUMP_END = 热身结束...
COUNTING = [ 刀战中... 还剩 %i 秒 ]

Last edited by takenb; 12-01-2009 at 23:10.
takenb is offline
Mekor
Junior Member
Join Date: Dec 2009
Old 04-13-2010 , 02:58   Re: Simple Knife Warmup
Reply With Quote #19

Turkish Language ;)

[tr]
WARUMP_START = Simdi bicak warump basladi!
WARUMP_END = Warump sona erdi...
COUNTING = [ Simdi bicak... Hala %i saniye var ]
__________________
~
Mekor is offline
DangerSpirit
Member
Join Date: Nov 2009
Location: Slovakia
Old 05-16-2010 , 10:57   Re: Simple Knife Warmup
Reply With Quote #20

PLS How can I add in this plugin sounds. This can be?
THX
DangerSpirit 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 14:52.


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