Raised This Month: $32 Target: $400
 8% 

restrict number players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nades
BANNED
Join Date: Oct 2020
Location: Usa
Old 04-12-2021 , 07:58   restrict number players
Reply With Quote #1

hello, I need to make this plugin run only from x online players (spec bot restriction not to calculate them), with cvar for set minimum players to start plugin

Code:
#include <amxmodx>
#include <crxranks>
#include <fun>
#include <hamsandwich>

public plugin_init()
{
    register_plugin("CRXRanks: Weapon Example", "1.0", "OciXCrom")
    RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)
}

public OnPlayerSpawn(id)
{
    if(!is_user_alive(id))
        return

    if(crxranks_get_user_level(id) >= 10)
        give_item(id, "weapon_hegrenade")
}
nades is offline
Send a message via ICQ to nades Send a message via AIM to nades Send a message via Yahoo to nades Send a message via Skype™ to nades
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 04-12-2021 , 11:13   Re: restrict number players
Reply With Quote #4

You should ask in suggestions/requests if you want someone to do it for you.
Anyway, there you go

Code:
#include <amxmodx>
#include <crxranks>
#include <fun>
#include <hamsandwich>

new cvar_min_players

public plugin_init()
{
	register_plugin("CRXRanks: Weapon Example", "1.0", "OciXCrom")
	RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)
	cvar_min_players = register_cvar("crxranks_weapon_min_players", "10")
}

public OnPlayerSpawn(id)
{
	if(!is_user_alive(id))
		return

	new players[32], num
	get_players(players, num, "ah")

	if (num < get_pcvar_num(cvar_min_players))
		return

	if(crxranks_get_user_level(id) >= 10)
		give_item(id, "weapon_hegrenade")
}
__________________









Last edited by CrazY.; 04-12-2021 at 11:14.
CrazY. 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 22:57.


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