AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help me (https://forums.alliedmods.net/showthread.php?t=173341)

RuRuRu612754 12-04-2011 02:53

help me
 
I do not know the problem

Where is the problem?

Code:

#include <amxmodx>

new count = 0

new server_down
new server_up

public plugin_init()
{
        register_plugin("PLUGIN", "VERSION", "AUTHOR")

        server_up = register_cvar("server_up", "addons/amxmodx/configs/server_up.cfg")
        server_down = register_cvar("server_down", "addons/amxmodx/configs/server_down.cfg")

        count = 0

        set_task(10.0,"check")
}

public check()
{
        if(count == 1)
        {
                server_cmd(server_up)
        }
        if(count == 0)
        {
                server_cmd(server_down)
        }
}

public client_connect(id)
{
        if(is_user_hltv(id) || is_user_bot(id))
        {
                count += 1
        }
        if(count == 1)
        {
                server_cmd(server_up)
        }
}

public client_disconnect(id)
{
        if(is_user_hltv(id) || is_user_bot(id))
        {
                count -= 1
        }
        if(count == 0)
        {
                server_cmd(server_down)
        }
}


jim_yang 12-04-2011 03:01

Re: help me
 
you use server_cmd on a cvar pointer, that's the problem.

RuRuRu612754 12-04-2011 03:14

Re: help me
 
jim_yang

thanks

problem was solved by using the define
However, even if not read the server_up connect to the server
However, even if not read the server_down disconnect to the server

Code:

#include <amxmodx>

#define server_up  "exec addons/amxmodx/configs/server_up.cfg"
#define server_down "exec addons/amxmodx/configs/server_down.cfg"

new count = 0

public plugin_init()
{
        register_plugin("PLUGIN", "VERSION", "AUTHOR")

        count = 0

        set_task(10.0,"check")
}

public check()
{
        if(count == 1)
        {
                server_cmd(server_up)
        }
        if(count == 0)
        {
                server_cmd(server_down)
        }
}

public client_connect(id)
{
        if(is_user_hltv(id) || is_user_bot(id))
        {
                count += 1
        }
        if(count == 1)
        {
                server_cmd(server_up)
        }
}

public client_disconnect(id)
{
        if(is_user_hltv(id) || is_user_bot(id))
        {
                count -= 1
        }
        if(count == 0)
        {
                server_cmd(server_down)
        }
}

server_up.cfg
Code:

pb add 1
pb add 1
pb add 1
pb add 1
pb add 1
pb add 1
pb add 1
pb add 1
pb add 1
pb add 1

server_down.cfg
Code:

pb removebots

fysiks 12-04-2011 12:38

Re: help me
 
Quote:

Originally Posted by RuRuRu612754 (Post 1607358)
However, even if not read the server_up connect to the server
However, even if not read the server_down disconnect to the server

What?

RuRuRu612754 12-05-2011 00:38

Re: help me
 
plugin is not working properly
Connected to server server_up.cfg not read
Disconnected to server server_down.cfg not read

sorry
I cannot speak english
I have bad English because I use the google translator

Erox902 12-05-2011 07:15

Re: help me
 
PHP Code:

server_cmd(server_down

--->
PHP Code:

server_cmd(exec server_down.cfg

And so on for all server_cmds.

tuty 12-05-2011 08:16

Re: help me
 
Quote:

Originally Posted by Erox902 (Post 1608070)
PHP Code:

server_cmd(server_down

--->
PHP Code:

server_cmd(exec server_down.cfg

And so on for all server_cmds.

you forgot to add " "

fysiks 12-05-2011 17:26

Re: help me
 
Quote:

Originally Posted by Erox902 (Post 1608070)
PHP Code:

server_cmd(server_down

--->
PHP Code:

server_cmd(exec server_down.cfg

And so on for all server_cmds.

That's not a solution. His exec commands will work just fine. It's probably something else like having the wrong filepath.

Note that "exec server_down.cfg" is not the same as "exec addons/amxmodx/configs/server_down.cfg"

RuRuRu612754 12-05-2011 23:04

Re: help me
 
thanks all

Devil259 12-06-2011 04:11

Re: help me
 
get_pcvar_string( ).


All times are GMT -4. The time now is 08:27.

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