Raised This Month: $ Target: $400
 0% 

Return mp_buytime to server settings


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
winds
Member
Join Date: Aug 2010
Old 11-10-2011 , 17:45   Return mp_buytime to server settings
Reply With Quote #1

Hey guys,
I'm having trouble with returning the server cvar mp_buytime to it's original settings after changing it in a special round.
This is how I have it set up in my plugin:

PHP Code:
public plugin_init()
{
    
register_logevent("roundend"2"1=Round_End")
    
old_buytime get_cvar_num("mp_buytime")
}

public 
roundend()
{
    
server_cmd("mp_buytime %d",old_buytime);

The problem is it doesn't include the decimal points. If the server mp_buytime was set to 0.25 for example, it will reset it to 0 at round end. How would I do this correctly ?

Also is this the most efficient way of trying to prevent players from buying weapons? Basically i'm trying to make it a knife round, so players are stripped and given only a knife, then i'm trying to prevent them from being able to pick up weapons as well as not buy any weapons.
Cheers!
winds is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-10-2011 , 17:47   Re: Return mp_buytime to server settings
Reply With Quote #2

PHP Code:
new Float:old_buytime

public plugin_init()
{
    
register_logevent("roundend"2"1=Round_End")
    
old_buytime get_cvar_float("mp_buytime")
}

public 
roundend()
{
    
server_cmd("mp_buytime %f",old_buytime);

You may know that round end is not map end.
You can set mp_buytime in cstrike/game.cfg if you want a specific value to be set each new map.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
winds
Member
Join Date: Aug 2010
Old 11-10-2011 , 18:04   Re: Return mp_buytime to server settings
Reply With Quote #3

Thanks Connor! That worked
However i'm still having another issue now. During my knife round I set use:
PHP Code:
public logevent_round_start()
{
    
server_cmd("mp_buytime 0");

However in the console I can see when the round starts, it says this:
"mp_buytime" changed to "0"
"mp_buytime" changed to "0.25000"

It seems like 0.25 is the lowest it can be changed to. Is there something I am overlooking or another way to stop them from buying weapons during my knife round?

Also thanks for letting me know, but I realize I can change it how I want for each map. For this i'm only changing it during a knife round selected by an admin.

Last edited by winds; 11-10-2011 at 18:05.
winds is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 11-10-2011 , 18:07   Re: Return mp_buytime to server settings
Reply With Quote #4

There are a few scripts in this section for blocking the buy command. Try this one:
http://forums.alliedmods.net/showthr...ight=block+buy

Edit: Actually, this post may be more helpful:

http://forums.alliedmods.net/showpos...47&postcount=4
__________________

Last edited by joshknifer; 11-10-2011 at 18:17.
joshknifer is offline
Send a message via Skype™ to joshknifer
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 14:28.


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