AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Send cvars when reach get_realplayersnum help (https://forums.alliedmods.net/showthread.php?t=130470)

Rirre 06-24-2010 06:37

Send cvars when reach get_realplayersnum help
 
This plugin send mp_forcechasecam 2 and mp_forcecamera 2 even if it is 0 players in the server.
PHP Code:

public client_putinserver(id)
    
UpdateCvars()

public 
client_disconnect(id)
    
UpdateCvars()

UpdateCvars()
{
    if (
get_realplayersnum() <= 3)
    {
        
set_cvar_string("mp_forcecamera""2")
        
set_cvar_string("mp_forcechasecam""2")
    }
    else
    {
        
set_cvar_string("mp_forcecamera""0")
        
set_cvar_string("mp_forcechasecam""0")
    }
}

stock get_realplayersnum()
{
    new 
players[32], playerCnt
    get_players
(playersplayerCnt"ch")
    
    return 
playerCnt



Alucard^ 06-24-2010 08:02

Re: Send cvars when reach get_realplayersnum help
 
So? what is the help that you need?

Oh and use pcvars (with pointers in this case).

YamiKaitou 06-24-2010 08:47

Re: Send cvars when reach get_realplayersnum help
 
Yes, that plugin is doing exactly what it should do. What help do you need? Don't expect us to read your mind.

Rirre 06-24-2010 10:40

Re: Send cvars when reach get_realplayersnum help
 
Doesn't work the way I need it.

As I want it:
When it reach 3 players, send cvars.
And when its lower than 3 players, send "else".

YamiKaitou 06-24-2010 10:56

Re: Send cvars when reach get_realplayersnum help
 
The way you have it is when get_realplayesnum() returns a value of less than or equal to 3, set cvars to "2". If it is greater than 3, set them to "0".

abdul-rehman 06-24-2010 11:26

Re: Send cvars when reach get_realplayersnum help
 
I think it should be like this:
PHP Code:

set_cvar_string("mp_forcecamera""2")
set_cvar_string("mp_forcechasecam""2"

---->
PHP Code:

set_cvar_num("mp_forcecamera"2)
set_cvar_num("mp_forcechasecam"2



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

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