Raised This Month: $ Target: $400
 0% 

Reserve slot


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sutar
Senior Member
Join Date: Sep 2010
Old 08-15-2012 , 09:53   Reserve slot
Reply With Quote #1

I have a server, it can be 17 players.
1st place for the administrator.
16 places for the players.

When the server has 15 players at the entrance of the sixteenth - is disabled and says that there is no space.
Although it should be disabled when the server is 16 people.

Here's the script:

Code:
public client_authorized(id)
{
	accessUser(id)
	
	if(!access(id, ADMIN_RESERVATION))
	{
		if(get_playersnum(1) >= (get_maxplayers() - g_aSlot))
		{
			server_cmd("kick #%d ^"There is no place.^"", get_user_userid(id))
			return PLUGIN_CONTINUE
		}
	}
	
	return PLUGIN_CONTINUE
}
What is wrong?
Sutar is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 08-15-2012 , 10:40   Re: Reserve slot
Reply With Quote #2

show the entire plugin and not just a part
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]
striker07 is offline
Sutar
Senior Member
Join Date: Sep 2010
Old 08-15-2012 , 10:51   Re: Reserve slot
Reply With Quote #3

I wrote this piece in end admin.amxx...

The plugin will be:

Code:
#include <amxmodx>
#include <amxmisc>

new g_aSlot = 1

public plugin_init()
{
	register_plugin("AmxBans Admin Base", "2.5", "Sutar")
}

public client_authorized(id)
{
	if(!access(id, ADMIN_RESERVATION))
	{
		if(get_playersnum(1) >= (get_maxplayers() - g_aSlot))
		{
			server_cmd("kick #%d ^"Извините, нет места для игроков!^"", get_user_userid(id))
			return PLUGIN_CONTINUE
		}
	}
	return PLUGIN_CONTINUE
}
Possible error in the:
Code:
get_playersnum(1)
-->
Code:
get_playersnum()

Last edited by Sutar; 08-15-2012 at 11:08.
Sutar is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 08-15-2012 , 15:30   Re: Reserve slot
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <amxmisc>
 
new g_aSlot 1
 
public plugin_init()
{
    
register_plugin("AmxBans Admin Base""2.5""Sutar")
}
 
public 
client_authorized(id)
{
    if(!
access(idADMIN_RESERVATION))
    {
        if(
get_playersnum(1) >= (get_maxplayers() - g_aSlot))
        {
            
server_cmd("kick #%d Извините, нет места для игроков!"get_user_userid(id))           
            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_CONTINUE

try changing plugin continue to handled, i think that should do it
Quote:
Possible error in the:
Code:
get_playersnum(1)
-->
Code:
get_playersnum()
get_playersnum(1) will return also players connecting to the server
get_playersnum() not
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]

Last edited by striker07; 08-15-2012 at 15:35.
striker07 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-15-2012 , 15:32   Re: Reserve slot
Reply With Quote #5

Quote:
Originally Posted by striker07 View Post
try changing plugin continue to handled, i think that should do it
Return value is ignored in the connect/authorized/disconnect forwards.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 08-15-2012 , 15:38   Re: Reserve slot
Reply With Quote #6

return PLUGIN_IGNORED?
does he even need the returns?
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]
striker07 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-15-2012 , 15:39   Re: Reserve slot
Reply With Quote #7

Quote:
Originally Posted by striker07 View Post
return PLUGIN_IGNORED?
does he even need the returns?
1. That doesn't exist.
2. No, since return values are ignored, there is no point to return here.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 08-15-2012 , 16:38   Re: Reserve slot
Reply With Quote #8

ah ok thx
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]
striker07 is offline
Sutar
Senior Member
Join Date: Sep 2010
Old 08-16-2012 , 03:03   Re: Reserve slot
Reply With Quote #9

That is, the code will be then?

Code:
#include <amxmodx>
#include <amxmisc>
 
new g_aSlot = 1
 
public plugin_init()
{
    register_plugin("AmxBans Admin Base", "2.5", "Sutar")
}
 
public client_authorized(id)
{
        if(!access(id, ADMIN_RESERVATION) && get_playersnum() >= (get_maxplayers() - g_aSlot))
                server_cmd("kick #%d", get_user_userid(id))
}
as said striker07, get_playersnum() - Not the player who enters. That's what I need?

Last edited by Sutar; 08-16-2012 at 03:05.
Sutar is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 08-16-2012 , 06:45   Re: Reserve slot
Reply With Quote #10

Quote:
Originally Posted by Sutar View Post
Code:
public client_authorized(id)
{
	accessUser(id)
	
	if(!access(id, ADMIN_RESERVATION))
	{
		if(get_playersnum(1) >= (get_maxplayers() - g_aSlot))
		{
			server_cmd("kick #%d ^"There is no place.^"", get_user_userid(id))
			return PLUGIN_CONTINUE
		}
	}
	
	return PLUGIN_CONTINUE
}
the problem is in this line: if(get_playersnum(1) >= (get_maxplayers() - g_aSlot))
let me change the natives with proper numbers
if(16 >= (17 - 1))
thats why it wont let the 16th player connect
jimaway 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 05:41.


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