Raised This Month: $ Target: $400
 0% 

Server lot for hltv


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
usabrad86
Junior Member
Join Date: Jun 2009
Location: Florida
Old 06-25-2009 , 23:12   Server lot for hltv
Reply With Quote #1

ok I am seriously trying to learn how to code just need some help to get me to understand on how to do it

what i need is to grab sv_visiblemaxplayers value and +1 when a the HLTV enters and -1 for exit and i need this to override any other plugin that changes that cvar

the code i made Crashes and i tossed it out..now im askin for help
usabrad86 is offline
Send a message via AIM to usabrad86
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-25-2009 , 23:36   Re: Server lot for hltv
Reply With Quote #2

Try this maybe:

PHP Code:
#include <amxmodx>

new g_pVisMaxPlayers
new g_iVisMaxPlayers

public plugin_init()
{
    
g_pVisMaxPlayers get_cvar_pointer("sv_visiblemaxplayers")
}

public 
client_connect(id)
{
    if( 
is_user_hltv(id) )
    {
        
g_iVisMaxPlayers get_pcvar_num(g_pVisMaxPlayers)
        
g_iVisMaxPlayers++
        
set_pcvar_num(g_pVisMaxPlayersg_iVisMaxPlayers)
    }
}

public 
client_disconnect(id)
{
    if( 
is_user_hltv(id) )
    {
        
g_iVisMaxPlayers get_pcvar_num(g_pVisMaxPlayers)
        
g_iVisMaxPlayers--
        
set_pcvar_num(g_pVisMaxPlayersg_iVisMaxPlayers)
    }

__________________
fysiks is offline
usabrad86
Junior Member
Join Date: Jun 2009
Location: Florida
Old 06-26-2009 , 00:30   Re: Server lot for hltv
Reply With Quote #3

OK Tested it 1/2 way works


before HLTV enters = 0/10
when hltv enters = 1/11
when hltv left = 0/9
usabrad86 is offline
Send a message via AIM to usabrad86
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-26-2009 , 00:42   Re: Server lot for hltv
Reply With Quote #4

Try this:
PHP Code:
#include <amxmodx>

new sv_visiblemaxplayers

new g_bIsHLTV[33]

public 
plugin_init()
{
    
sv_visiblemaxplayers get_cvar_pointer("sv_visiblemaxplayers")
}

public 
client_putinserver(id)
{
    if( (
g_bIsHLTV[id] = is_user_hltv(id)) )
    {
        
set_pcvar_num(sv_visiblemaxplayersget_pcvar_num(sv_visiblemaxplayers)+1)
    }
}

public 
client_disconnect(id)
{
    if( 
g_bIsHLTV[id] )
    {
        
set_pcvar_num(sv_visiblemaxplayersget_pcvar_num(sv_visiblemaxplayers)-1)
    }

If doesn't work, try this :
PHP Code:
#include <amxmodx>

new sv_visiblemaxplayers
new g_bMaxPlayers
new g_bIsHLTV[33]

public 
plugin_init()
{
    
sv_visiblemaxplayers get_cvar_pointer("sv_visiblemaxplayers")
    
g_bMaxPlayers get_maxplayers()
}

public 
client_putinserver(id)
{
    if( (
g_bIsHLTV[id] = is_user_hltv(id)) )
    {
        
set_pcvar_num(sv_visiblemaxplayersg_bMaxPlayers CoundHltvs())
    }
}

public 
client_disconnect(id)
{
    if( 
g_bIsHLTV[id] )
    {
        
g_bIsHLTV[id] = false
        set_pcvar_num
(sv_visiblemaxplayersg_bMaxPlayers CoundHltvs())
    }
}

CoundHltvs()
{
    new 
iCount
    
for(new i=1i<=g_iMaxPlayersi++)
    {
        if( 
g_bIsHLTV[i] )
        {
            
iCount++
        }
    }
    return 
iCount

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 06-26-2009 at 00:47.
ConnorMcLeod is offline
usabrad86
Junior Member
Join Date: Jun 2009
Location: Florida
Old 06-26-2009 , 01:05   Re: Server lot for hltv
Reply With Quote #5

this does the same thing as the other guys script

before HLTV enters = 0/10
when hltv enters = 1/11
when hltv left = 0/9

Quote:
Originally Posted by ConnorMcLeod View Post
PHP Code:
#include <amxmodx>

new sv_visiblemaxplayers

new g_bIsHLTV[33]

public 
plugin_init()
{
    
sv_visiblemaxplayers get_cvar_pointer("sv_visiblemaxplayers")
}

public 
client_putinserver(id)
{
    if( (
g_bIsHLTV[id] = is_user_hltv(id)) )
    {
        
set_pcvar_num(sv_visiblemaxplayersget_pcvar_num(sv_visiblemaxplayers)+1)
    }
}

public 
client_disconnect(id)
{
    if( 
g_bIsHLTV[id] )
    {
        
set_pcvar_num(sv_visiblemaxplayersget_pcvar_num(sv_visiblemaxplayers)-1)
    }

-----------------------------------------------------------------------
and this one fails to compile on

g_bIsHLTV[i] = false
Error: Undefined symbol "i"

and

for(new i=1; i<=g_iMaxPlayers; i++)
Error Undefined symbol "g_iMaxPlayers"


Quote:
Originally Posted by ConnorMcLeod View Post
If doesn't work, try this :
PHP Code:
#include <amxmodx>

new sv_visiblemaxplayers
new g_bMaxPlayers
new g_bIsHLTV[33]

public 
plugin_init()
{
    
sv_visiblemaxplayers get_cvar_pointer("sv_visiblemaxplayers")
    
g_bMaxPlayers get_maxplayers()
}

public 
client_putinserver(id)
{
    if( (
g_bIsHLTV[id] = is_user_hltv(id)) )
    {
        
set_pcvar_num(sv_visiblemaxplayersg_bMaxPlayers CoundHltvs())
    }
}

public 
client_disconnect(id)
{
    if( 
g_bIsHLTV[id] )
    {
        
g_bIsHLTV[id] = false
        set_pcvar_num
(sv_visiblemaxplayersg_bMaxPlayers CoundHltvs())
    }
}

CoundHltvs()
{
    new 
iCount
    
for(new i=1i<=g_iMaxPlayersi++)
    {
        if( 
g_bIsHLTV[i] )
        {
            
iCount++
        }
    }
    return 
iCount

And I am more then willing to test more code so Other People can use it

also Thank you so much Everybody for the Help
usabrad86 is offline
Send a message via AIM to usabrad86
usabrad86
Junior Member
Join Date: Jun 2009
Location: Florida
Old 06-26-2009 , 01:23   Re: Server lot for hltv
Reply With Quote #6

THIS CODE DOES WORK
i just had a another plugin causeing it to go to 0/9

i commented out the "public client_disconnect" area
and it worked fine

Quote:
Originally Posted by fysiks View Post
Try this maybe:

PHP Code:
#include <amxmodx>

new g_pVisMaxPlayers
new g_iVisMaxPlayers

public plugin_init()
{
    
g_pVisMaxPlayers get_cvar_pointer("sv_visiblemaxplayers")
}

public 
client_connect(id)
{
    if( 
is_user_hltv(id) )
    {
        
g_iVisMaxPlayers get_pcvar_num(g_pVisMaxPlayers)
        
g_iVisMaxPlayers++
        
set_pcvar_num(g_pVisMaxPlayersg_iVisMaxPlayers)
    }
}

public 
client_disconnect(id)
{
    if( 
is_user_hltv(id) )
    {
        
g_iVisMaxPlayers get_pcvar_num(g_pVisMaxPlayers)
        
g_iVisMaxPlayers--
        
set_pcvar_num(g_pVisMaxPlayersg_iVisMaxPlayers)
    }

usabrad86 is offline
Send a message via AIM to usabrad86
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-26-2009 , 18:43   Re: Server lot for hltv
Reply With Quote #7

Yeah, I just realized my code has a flaw, oops .
__________________
fysiks is offline
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 15:33.


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