Raised This Month: $51 Target: $400
 12% 

Plugin to run only if are x players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RazorX
Member
Join Date: Aug 2011
Old 01-30-2015 , 04:23   Plugin to run only if are x players
Reply With Quote #1

I want this plugin to run only if are x player. Ex: If are <8 players, plugin don't run, and if are >=8 players, plugin RUN. Thanks!
Attached Files
File Type: sma Get Plugin or Get Source (bestofround.sma - 431 views - 2.5 KB)
__________________
STEAUA este cea mai BUNA
RazorX is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 01-30-2015 , 06:31   Re: Plugin to run only if are x players
Reply With Quote #2

Something like that?
PHP Code:
#include <amxmodx>

public plugin_init() 
{
    
register_plugin("Plugin Pauser""1.0""Flicker")
    
server_cmd("amxx pause bestofround.amxx")
}

public 
client_putinserver(id)
    if(
checkPlayers())
        
server_cmd("amxx unpause bestofround.amxx")
        
public 
client_disconnect(id)
    if(!
checkPlayers())
        
server_cmd("amxx pause bestofround.amxx")

stock bool:checkPlayers()
    return 
get_playersnum() < false true 
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
RazorX
Member
Join Date: Aug 2011
Old 01-30-2015 , 08:23   Re: Plugin to run only if are x players
Reply With Quote #3

Don't work
__________________
STEAUA este cea mai BUNA
RazorX is offline
Old 01-30-2015, 08:48
Freezo Begin
This message has been deleted by Freezo Begin.
RazorX
Member
Join Date: Aug 2011
Old 01-30-2015 , 09:32   Re: Plugin to run only if are x players
Reply With Quote #4

Still doesn't work..
__________________
STEAUA este cea mai BUNA
RazorX is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-31-2015 , 10:51   Re: Plugin to run only if are x players
Reply With Quote #5

Quote:
Originally Posted by Flick3rR View Post
Something like that?
PHP Code:
#include <amxmodx>

public plugin_init() 
{
    
register_plugin("Plugin Pauser""1.0""Flicker")
    
server_cmd("amxx pause bestofround.amxx")
}

public 
client_putinserver(id)
    if(
checkPlayers())
        
server_cmd("amxx unpause bestofround.amxx")
        
public 
client_disconnect(id)
    if(!
checkPlayers())
        
server_cmd("amxx pause bestofround.amxx")

stock bool:checkPlayers()
    return 
get_playersnum() < false true 
If you pause a plugin, you can't unpause it from it's own code. If it's paused how would the unpause code run ?
__________________
HamletEagle is offline
RazorX
Member
Join Date: Aug 2011
Old 01-31-2015 , 11:45   Re: Plugin to run only if are x players
Reply With Quote #6

So? What can i do?
__________________
STEAUA este cea mai BUNA
RazorX is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-31-2015 , 11:47   Re: Plugin to run only if are x players
Reply With Quote #7

Add an "enabled" check to change the functionality of the code. Then, add a command to change the enabled state of the plugin.
__________________
fysiks is offline
RazorX
Member
Join Date: Aug 2011
Old 01-31-2015 , 17:21   Re: Plugin to run only if are x players
Reply With Quote #8

I recompile plugin made by HamletEagle and the plugin is paused until 8 players connect. Now, if 1 player exit, the plugin still run, and i want ONLY IF are 8 players or more to run this plugin. Thanks!
__________________
STEAUA este cea mai BUNA

Last edited by RazorX; 02-01-2015 at 09:34.
RazorX is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 01-11-2016 , 08:37   Re: Plugin to run only if are x players
Reply With Quote #9

Doesnt work.
Why because commands are run when someone is connecting and disconnecting.
It doesnt count player amount at all.
4ever16 is offline
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 01-12-2016 , 02:55   Re: Plugin to run only if are x players
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
Add an "enabled" check to change the functionality of the code. Then, add a command to change the enabled state of the plugin.
Bumping the solution.
And keep a check on that variable to be "Enabled" or "Disabled" depending upon client_putinserver and client_disconnect.
I ll prefer to keep it boolean.

Adding Info :
You dont actually need to pause the plugin. Just disable the functionality. As simple as that.
__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then

Last edited by devilicioux; 01-12-2016 at 02:56.
devilicioux 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 07:34.


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