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

Open custom motd with chat command if x players only


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
4ever16
Veteran Member
Join Date: Apr 2015
Old 04-28-2018 , 19:00   Open custom motd with chat command if x players only
Reply With Quote #1

If i write .lol a custom motd will open lol.txt
If i write .lol2 another custom motd will open lol2.txt
But these chat commands only works if there are minimum 5 players in the server.
If someone write .lol and there arnt 5 players then server prints to that user sorry need minimum 5 players.

I mean in chat not in console. By any user.

Also limit maximum amount of times a steam id or a user can use all of these commands per connection. We say if i play dust2 and write any of the commands 10 times i cant use them no more and server prints you used this command 10 times wait until mapchange or map restart or reconnect.

Thanks!

Last edited by 4ever16; 04-29-2018 at 17:46.
4ever16 is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 04-28-2018 , 20:02   Re: Open custom motd with chat command if x players only
Reply With Quote #2

Code:
register_clcmd() public called_clcmd(id){     if (get_playersnum() < 5){         server_print("5+ connected players onleeh")         return 1;     }     else show_motd()     return 0; // classic }
What do you mean when you say random? You have like 30 motd files and print a random one from them?
__________________

Last edited by Relaxing; 04-28-2018 at 20:02.
Relaxing is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 04-28-2018 , 20:36   Re: Open custom motd with chat command if x players only
Reply With Quote #3

Sorry wasnt so clear. Updated first post.
4ever16 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-28-2018 , 21:42   Re: Open custom motd with chat command if x players only
Reply With Quote #4

Try

PHP Code:
#include <amxmodx>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new pCvarMaxTimesg_iSaid[33]

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say .lol""cmdLol1")
    
register_clcmd("say .lol2""cmdLol2")
    
    
pCvarMaxTimes register_cvar("motd_command_max""10")
}

public 
client_disconnect(id)
{
    
g_iSaid[id] = 0
}

public 
cmdLol1(id)
{
    if(
g_iSaid[id] >= get_pcvar_num(pCvarMaxTimes))
    {
        
client_print(idprint_chat"[AMXX]: You cant say this message anymore.")
        return 
PLUGIN_HANDLED
    
}
    
show_motd(id"addons/amxmodx/configs/lol.txt""LOL 1")
    
g_iSaid[id]++
    return 
PLUGIN_HANDLED
}

public 
cmdLol2(id)
{
    if(
g_iSaid[id] >= get_pcvar_num(pCvarMaxTimes))
    {
        
client_print(idprint_chat"[AMXX]: You cant say this message anymore.")
        return 
PLUGIN_HANDLED
    
}
    
    
show_motd(id"addons/amxmodx/configs/lol2.txt""LOL 2")
    
g_iSaid[id]++
    return 
PLUGIN_HANDLED

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 04-28-2018 at 21:44.
EFFx is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-29-2018 , 05:52   Re: Open custom motd with chat command if x players only
Reply With Quote #5

If player reconnected he will be able to say it 10 more times
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
4ever16
Veteran Member
Join Date: Apr 2015
Old 04-29-2018 , 06:41   Re: Open custom motd with chat command if x players only
Reply With Quote #6

Quote:
Originally Posted by Natsheh View Post
If player reconnected he will be able to say it 10 more times
Thats ok.

But can you fix that your plugin needs minimum 5 players like i sed in first post?

Last edited by 4ever16; 04-29-2018 at 17:46.
4ever16 is offline
Kodish
New Member
Join Date: Apr 2018
Old 04-29-2018 , 20:22   Re: Open custom motd with chat command if x players only
Reply With Quote #7

Can someone make this plugin like this.

If admin is online and someone writes .lol then it prints in chat.
Admin is online this command can't be used try later.
Kodish is offline
instinctpt1
Senior Member
Join Date: Dec 2016
Location: Chandigarh, India
Old 04-30-2018 , 11:22   Re: Open custom motd with chat command if x players only
Reply With Quote #8

Quote:
Originally Posted by Kodish View Post
Can someone make this plugin like this.

If admin is online and someone writes .lol then it prints in chat.
Admin is online this command can't be used try later.
Add something like this in plugin :
PHP Code:
HandleFunctionForCommand(id)
{
    if(
is_adminOnline()) 
        
client_print(idprint_chat"An ADMIN is on server, you cant open it now")
}

bool:is_adminOnline()
{
    new 
players[32], numx
    get_players
(playersnum);
    new 
0;
    while (
num)
    {
        
players[i];
        if (
get_user_flags(x) & ADMIN_BAN) return true;
        
i++;
    }
    return 
false;

instinctpt1 is offline
Kodish
New Member
Join Date: Apr 2018
Old 04-30-2018 , 12:02   Re: Open custom motd with chat command if x players only
Reply With Quote #9

Ok solved it.

But can some just make so ithus plugin needs minimum 5 players if there arnt 5 players then it prints sorry need 5 players.

Last edited by Kodish; 04-30-2018 at 12:14.
Kodish is offline
instinctpt1
Senior Member
Join Date: Dec 2016
Location: Chandigarh, India
Old 04-30-2018 , 13:52   Re: Open custom motd with chat command if x players only
Reply With Quote #10

Quote:
Originally Posted by Kodish View Post
Ok solved it.

But can some just make so ithus plugin needs minimum 5 players if there arnt 5 players then it prints sorry need 5 players.
May be this then :
PHP Code:
HandleFunctionForCommand(id

    if(
is_adminOnline())  
        
client_print(idprint_chat"An ADMIN is on server, you cant open it now"
    new 
players[32], num
    get_players
(playersnum)
    if( 
num 5){
        
client_print(idprint_chat"Needed min. 5 Players")
        return 
PLUGIN_HANDLED
    
}


bool:is_adminOnline() 

    new 
players[32], num
    get_players
(playersnum); 
    new 
0
    while (
num
    { 
        
players[i]; 
        if (
get_user_flags(x) & ADMIN_BAN) return true
        
i++; 
    } 
    return 
false

instinctpt1 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 10:51.


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