Raised This Month: $ Target: $400
 0% 

Adding only admins function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fLaXXiE
Member
Join Date: Apr 2011
Old 05-15-2011 , 15:33   Adding only admins function
Reply With Quote #1

I need to add only admins function. i tried but was not correct.

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

#define prefix "^4[FB] Manager:^3"

public plugin_init ( )
{
    
register_plugin "JBManager""1.0""Capell" )
    
    
register_clcmd "say""SayCmds" )
}

public 
SayCmds iPlayerid )
{
    static 
arg 36 ]
    new 
iPlayerName 32 ]
    
read_argv 1argsizeof arg ) - )
    
parse (argarg35iPlayerNamesizeof iPlayerName ) - )

    if (!(
get_user_flags(id0)&ADMIN_VOTE))
        return
    {    
        if ( 
equali arg"!kick" ) )
        {
            if ( !
iPlayerName ] )
                
ColorChat iPlayerGREY"%s You need to type a nick"prefix )
            else
            {
                new 
iPlayerNameID cmd_target iPlayeriPlayerName)
                if ( 
iPlayerNameID )
                {
                    new 
iName 32 ], iTargetName 32 ]
                    
get_user_name iPlayeriNamesizeof iName ) - )
                    
get_user_name iPlayerNameIDiTargetNamesizeof iTargetName ) - )
                    
server_cmd "kick ^"%s^""iTargetName )
                    
ColorChat 0GREY"%s %s kicked^4 %s"prefixiNameiTargetName)
                }
                else
                    
ColorChat iPlayerGREY"%s There are no players with that name"prefix )
            }
            return 
PLUGIN_HANDLED
        
}
    
        if ( 
equali arg"!slay" ) )
        {
            if ( !
iPlayerName ] )
                
ColorChat iPlayerGREY"%s You need to type a nick"prefix )
            else
            {
                new 
iPlayerNameID cmd_target iPlayeriPlayerName)
                if ( 
iPlayerNameID )
                {
                    new 
iName 32 ], iTargetName 32 ]
                    
get_user_name iPlayeriNamesizeof iName ) - )
                    
get_user_name iPlayerNameIDiTargetNamesizeof iTargetName ) - )
                    
user_silentkill iPlayerNameID )
                    
ColorChat 0GREY"%s %s slayed^4 %s"prefixiNameiTargetName)
                }
                else
                    
ColorChat iPlayerGREY"%s There are no players with that name"prefix )
            }
            return 
PLUGIN_HANDLED
        
}
    
    }
        return 
PLUGIN_CONTINUE

fLaXXiE is offline
Send a message via MSN to fLaXXiE Send a message via Skype™ to fLaXXiE
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-15-2011 , 17:24   Re: Adding only admins function
Reply With Quote #2

You didn't read the thread that I linked you to.

I'll give you a whole sample so it's not so hard to piece together:


PHP Code:
public plugin_init()
{
    
register_clcmd("say""cmdSay")
}

public 
cmdSay(id)
{
    new 
szString[45], szFirstArgument[12], szSecondArgument[12], szThirdArgument[4], szEverythingElse[20]
    
    
read_args(szStringcharsmax(szString))
    
remove_quotes(szString)
    
    
strbreak(szStringszFirstArgumentcharsmax(szFirstArgument), szStringcharsmax(szString))
    
strbreak(szStringszSecondArgumentcharsmax(szSecondArgument), szStringcharsmax(szString))
    
strbreak(szStringszThirdArgumentcharsmax(szThirdArgument), szEverythingElsecharsmax(szEverythingElse))
    
    
client_print(idprint_console"First Argument: %s"szFirstArgument)
    
client_print(idprint_console"Second Argument: %s"szSecondArgument)
    
client_print(idprint_console"Third Argument: %s"szThirdArgument)
    
client_print(idprint_console"Everything else: %s"szEverythingElse)

Try this and see what prints in your console.

It can be modified to use fewer or more argument easily if needed.
__________________

Last edited by fysiks; 05-15-2011 at 17:37.
fysiks 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 04:31.


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