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

[help]Plugin to admin flag


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kakarot47
Senior Member
Join Date: May 2015
Location: Pakistan
Old 08-01-2016 , 12:18   [help]Plugin to admin flag
Reply With Quote #1

hey all here,

i want to put this plugin for VIPs(ADMIN_LEVEL_H) players only so can you please edit it

PHP Code:
        #include <amxmodx>
        #include <amxmisc>
        #include <fakemeta>
        #include <hamsandwich>
         
        
public plugin_init()
        {
                
register_plugin("Fast Reloading""1.0""")
                
RegisterHam(Ham_Weapon_Reload"weapon_ak47""fw_reload_post"1)
        }
         
        
#define OFFSET_WEAPON_IN_RELOAD                         54
        #define EXTRA_OFFSET_WEAPON_LINUX                       4
        #define OFFSET_PLAYER_NEXT_ATTACK                       83
        #define OFFSET_WEAPON_OWNER                                     41
        #define EXTRA_OFFSET_PLAYER_LINUX                       5
         
        
public fw_reload_post(ent)
        {
                if(
get_pdata_int(entOFFSET_WEAPON_IN_RELOADEXTRA_OFFSET_WEAPON_LINUX))
                {
                        new 
id get_pdata_cbase(entOFFSET_WEAPON_OWNEREXTRA_OFFSET_WEAPON_LINUX)
                        
set_pdata_float(idOFFSET_PLAYER_NEXT_ATTACK0.0EXTRA_OFFSET_PLAYER_LINUX)
                }
                return 
HAM_IGNORED
        

Thanks in advance.
__________________



AssasinSniperNightmare ModArmageddon ModApolacyps Mod
Kakarot47 is offline
Send a message via Skype™ to Kakarot47
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-01-2016 , 12:35   Re: [help]Plugin to admin flag
Reply With Quote #2

PHP Code:
get_user_flags(id) & ADMIN_LEVEL_H 
__________________
HamletEagle is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 08-01-2016 , 12:55   Re: [help]Plugin to admin flag
Reply With Quote #3

Code:
// The FLAG in quote. has_flag( id, "x" )
__________________
Project: Among Us

Last edited by Craxor; 08-01-2016 at 12:56.
Craxor is offline
Send a message via ICQ to Craxor
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-01-2016 , 20:53   Re: [help]Plugin to admin flag
Reply With Quote #4

It is more efficient to use HamletEagle's posted code. You would only need to use has_flag() if the flag is not known at compile time.
__________________
fysiks is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 08-02-2016 , 02:48   Re: [help]Plugin to admin flag
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
It is more efficient to use HamletEagle's posted code. You would only need to use has_flag() if the flag is not known at compile time.
What do you mean 'is not know at compile time' ? has_flag is an native not a macross. and they have the same objectives but maked in different ways, that is just a 'little detail' and may be optional for him, depends on the 'taste' you have, anyway, better for him to know all option, that they, what they do, and then he choose depedenind on his opinion and 'taste' again.
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-02-2016 , 03:54   Re: [help]Plugin to admin flag
Reply With Quote #6

Quote:
Originally Posted by Craxor View Post
What do you mean 'is not know at compile time' ? has_flag is an native not a macross. and they have the same objectives but maked in different ways, that is just a 'little detail' and may be optional for him, depends on the 'taste' you have, anyway, better for him to know all option, that they, what they do, and then he choose depedenind on his opinion and 'taste' again.
https://github.com/alliedmodders/amx...xmisc.inc#L780
has_flag does an extra step by using read_flags, which is useless when you know the flag. Anyway, the difference in performance is trivial. It just makes more sense to use what I've posted in this case.
__________________

Last edited by HamletEagle; 08-02-2016 at 03:56.
HamletEagle is offline
Kakarot47
Senior Member
Join Date: May 2015
Location: Pakistan
Old 08-02-2016 , 07:09   Re: [help]Plugin to admin flag
Reply With Quote #7

Quote:
Originally Posted by HamletEagle View Post
PHP Code:
get_user_flags(id) & ADMIN_LEVEL_H 
Can you add it on whole codes and send me ? cuz i don't know where to add it.
__________________



AssasinSniperNightmare ModArmageddon ModApolacyps Mod
Kakarot47 is offline
Send a message via Skype™ to Kakarot47
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 08-02-2016 , 08:40   Re: [help]Plugin to admin flag
Reply With Quote #8

PHP Code:
 #include <amxmodx>
        #include <amxmisc>
        #include <fakemeta>
        #include <hamsandwich>
         
        
public plugin_init()
        {
                
register_plugin("Fast Reloading""1.0""")
                
RegisterHam(Ham_Weapon_Reload"weapon_ak47""fw_reload_post"1)
        }
         
        
#define OFFSET_WEAPON_IN_RELOAD                         54
        #define EXTRA_OFFSET_WEAPON_LINUX                       4
        #define OFFSET_PLAYER_NEXT_ATTACK                       83
        #define OFFSET_WEAPON_OWNER                                     41
        #define EXTRA_OFFSET_PLAYER_LINUX                       5
         
        
public fw_reload_post(ent)
        {
                if(
get_pdata_int(entOFFSET_WEAPON_IN_RELOADEXTRA_OFFSET_WEAPON_LINUX))
                {
                        new 
id get_pdata_cbase(entOFFSET_WEAPON_OWNEREXTRA_OFFSET_WEAPON_LINUX)
                        if(
get_user_flags(id) & ADMIN_LEVEL_H)
                             
set_pdata_float(idOFFSET_PLAYER_NEXT_ATTACK0.0EXTRA_OFFSET_PLAYER_LINUX)
                }
                return 
HAM_IGNORED
        


Last edited by siriusmd99; 08-02-2016 at 08:40.
siriusmd99 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:39.


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