Raised This Month: $ Target: $400
 0% 

1 command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
InteX01
Senior Member
Join Date: Jan 2017
Old 01-22-2017 , 09:06   1 command
Reply With Quote #1

Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <colorchat>

#define PLUGIN "ADMIN FUN PLUGIN"
#define VERSION "1.0"
#define AUTHOR "InteX"

public plugin_init() {
	register_clcmd("say /noclipon", "NoClipON")
	register_clcmd("say /noclipoff", "NoClipOFF")
}
public NoClipON(id)
{
	if(get_user_flags(id) & ADMIN_RCON)
	{
		set_user_noclip (id, 1)
		ColorChat(id, GREEN, "[AdminFun] ^3You turned on noclip.")
	}
	else
	{
		{
			if(get_user_flags(id) & ADMIN_USER)
			{
				ColorChat(id, GREEN, "[AMXX] ^3You dont have access to this command.")
			}
		}
	}
	return PLUGIN_HANDLED;
}
public NoClipOFF(id)
{
	if(get_user_flags(id) & ADMIN_RCON)
	{
		set_user_noclip (id, 0)
		ColorChat(id, GREEN, "[AdminFun] ^3You turned off noclip.")
	}
	else
	{
		{
			if(get_user_flags(id) & ADMIN_USER)
			{
				ColorChat(id, GREEN, "[AMXX] ^3You dont have access to this command.")
			}
		}
	}
	return PLUGIN_HANDLED;
}
This is only part of plugin.
Im begginer at scripting and my question is:
Can i somehow make both like switching ON/OFF with one command /noclip but to keep this "You dont have access...."
So i dont need to use /noclipon and /noclipoff
And yeah if u can give me some advices if i done something wrong or.....

Thanks.

Last edited by InteX01; 01-22-2017 at 09:15.
InteX01 is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 01-22-2017 , 09:21   Re: 1 command
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <colorchat>

#define PLUGIN "ADMIN FUN PLUGIN"
#define VERSION "1.0"
#define AUTHOR "InteX"

//You will need this to check if that player is on/off
new is_noclip[33

public 
plugin_init() 
{
    
register_clcmd("say /noclip""NoClip")    
}
public 
NoClip(id)
{
    if(
get_user_flags(id) & ADMIN_RCON)
    {
        if(!
is_noclip[id]) //already turn on?
        
{
            
set_user_noclip (id1)
            
ColorChat(idGREEN"[AdminFun] ^3You turned on noclip.")
            
is_noclip[id] = 1
        
}
        else 
//other situation (here, definitely check if it already on)
        
{
            
set_user_noclip (id0)
            
ColorChat(idGREEN"[AdminFun] ^3You turned off noclip.")
            
is_noclip[id] = 0
        
}
        
    }
    else
    {
        
//if(get_user_flags(id) & ADMIN_USER) //You only need else, don't need to be ADMIN_USER here
        
ColorChat(idGREEN"[AMXX] ^3You dont have access to this command.")
    }
    return 
PLUGIN_HANDLED;

__________________
My plugin:

Last edited by Celena Luna; 01-22-2017 at 09:24.
Celena Luna is offline
InteX01
Senior Member
Join Date: Jan 2017
Old 01-22-2017 , 09:22   Re: 1 command
Reply With Quote #3

Thanks

new is_noclip [33]

btw what does that number mean

Last edited by InteX01; 01-22-2017 at 09:32.
InteX01 is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 01-22-2017 , 09:25   Re: 1 command
Reply With Quote #4

I update it a bit.
__________________
My plugin:
Celena Luna is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-22-2017 , 09:56   Re: 1 command
Reply With Quote #5

Quote:
Originally Posted by InteX01 View Post
Thanks

new is_noclip [33]

btw what does that number mean
There is a maximum of 32 players with indexes from 1 to 32. The array has to have the last cell empty, so in order to be able to access 32rd cell the array must have a size of 33. If you would do is_noclip[32] then only indexes from 1 to 31 can be used and the 32rd player will cause an index out of bounds error, because there is no room for index 32.
The first cell(0) remains unused.
__________________
HamletEagle is offline
InteX01
Senior Member
Join Date: Jan 2017
Old 01-22-2017 , 10:38   Re: 1 command
Reply With Quote #6

Code:
public prefix(id){
    if(get_user_flags(id) & ADMIN_LEVEL_H)
{
        new said[192], name[30]
        get_user_name(id,name,29)
        read_args(said,191)
        remove_quotes(said)
        ColorChat(0, GREEN,"[VIP] ^3%s^4 : %s",name,said)
 }
I dont want to open new topic so
Is this properly used ?
cuz im getting

InteX : hello
[VIP] InteX : hello

How could i make this

And on my second plugin i used this
its only
[VIP] InteX : message
but useres without T flag cant chat :/

Last edited by InteX01; 01-22-2017 at 10:40.
InteX01 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-22-2017 , 10:52   Re: 1 command
Reply With Quote #7

It's because you have two plugins that modify the chat.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 20:49.


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