Raised This Month: $ Target: $400
 0% 

API Scripting Help [TUT] ZP 5.0 Admin Only class


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Sp@jk
Member
Join Date: May 2010
Location: Serbia
Old 08-23-2011 , 05:35   [TUT] ZP 5.0 Admin Only class
Reply With Quote #1

Hi, I am going to show you how to make a admin only class in ZP 5.0

First we make a simple class:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <zp50_class_zombie>

public plugin_precache()
{
    
register_plugin("Admin only class","1.0","Sp@jk")
    
zp_class_zombie_register("Admin Zombie","Only admins can use!",5000,300.0,0.5)

Then we add a class id
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <zp50_class_zombie>

new class_id

public plugin_precache()
{
    
register_plugin("Admin only class","1.0","Sp@jk")
    
class_id zp_class_zombie_register("Admin Zombie","Only admins can use!",5000,300.0,0.5)

Now we add zp_fw_class_zombie_select_pre forward and check if user is admin
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <zp50_class_zombie>

new class_id

public plugin_precache()
{
    
register_plugin("Admin only class","1.0","Sp@jk")
    
class_id zp_class_zombie_register("Admin Zombie","Only admins can use!",5000,300.0,0.5)
}

public 
zp_fw_class_zombie_select_pre(id,cid)
{
    if(
cid==class_id)
    {
        if(!
is_user_admin(id))
            return 
ZP_CLASS_NOT_AVAILABLE
    
}
    return 
ZP_CLASS_AVAILABLE

And now we have a class than only admin can use

Last edited by Sp@jk; 08-23-2011 at 11:29.
Sp@jk is offline
 



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 16:43.


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