AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Return mp_buytime to server settings (https://forums.alliedmods.net/showthread.php?t=171775)

winds 11-10-2011 17:45

Return mp_buytime to server settings
 
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!

ConnorMcLeod 11-10-2011 17:47

Re: Return mp_buytime to server settings
 
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.

winds 11-10-2011 18:04

Re: Return mp_buytime to server settings
 
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.

joshknifer 11-10-2011 18:07

Re: Return mp_buytime to server settings
 
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


All times are GMT -4. The time now is 14:28.

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