Thread: [Subplugin Submission] [ZP] Zombie VIP 1.9.1
View Single Post
aaarnas
Veteran Member
Join Date: Jun 2008
Location: Lithuania
Old 05-05-2010 , 13:00   Re: [ZP] Zombie VIP 1.6
Reply With Quote #171

Guide how to remake zombie class for vips or admins only.

First what we need is depend witch mode are you using.
If MODE 1 is enabled (also MODE 3 enables MODE 1 too) plugin has itself authentication, so lets start:

Zombie Plague 5.x tutorial below.

Zombie Plague 4.3:
1. Find a function "zp_register_zombie_class" in file. It should look something like this:
PHP Code:
public plugin_precache()
{
    
g_zclass_crow zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
    

Take a variable g_zclass_crow (sure it's name will be different).

2. Add this function to your zombie class plugin:
PHP Code:
#include <zmvip>

public zp_user_infected_pre(id) {
    if(
zv_get_user_flags(id) == 0) {
        if(
zp_get_user_next_class(id) == g_zclass_crow) {
            
zp_set_user_zombie_class(id0)
            
client_print(idprint_center"Your selected class in only for *VIP* members")
            
client_print(idprint_chat"Your selected class in only for *VIP* members. Changed to default zombie class.")
        }
    }

3. g_zclass_crow have to be the same variable witch you found in #1 step.
(if(zp_get_user_zombie_class(id) == g_zclass_crow))

If you want to let the player have a class with a specific flag do like this:
Code:
if(zv_get_user_flags(id) & ZV_MAIN)
if(zv_get_user_flags(id) & ZV_MULTI)
...
Code:
#define ZV_MAIN          "a"
#define ZV_MULTI         "b"
#define ZV_UNLIMITED     "c"
#define ZV_DAMAGE        "d"
Now if you are using default amx authentication (MODE 0 or 2) do like this:

1. Find a function "zp_register_zombie_class" in file. It should look something like this:
PHP Code:
public plugin_precache()
{
    
g_zclass_crow zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
    

Take a variable g_zclass_crow (sure it's name will be different).

2. Add this code:
PHP Code:
public zp_user_infected_pre(id) {
    if(!(
get_user_flags(id) & ADMIN_LEVEL_H)) {
        if (
zp_get_user_next_class(id) == g_zclass_crow) {
            
zp_set_user_zombie_class(id0)
            
client_print(idprint_center"Your selected class in only for *VIP* members")
            
client_print(idprint_chat"Your selected class in only for *VIP* members. Changed to default zombie class.")
        }    
    }

3. g_zclass_crow have to be the same variable witch you found in #1 step.
(if(zp_get_user_zombie_class(id) == g_zclass_crow))

ADMIN_LEVEL_H is default t flag in users.ini file. It mostly using for vip plugins. Sure you can set this flag to what you want. If you want to make it for admins only, write ADMIN_IMMUNITY instead of ADMIN_LEVEL_H

Zombie Plague 5.x:

1. Find a function "zp_class_zombie_register" in file. It should look something like this:
PHP Code:
public plugin_precache()
{
    
g_ZombieClassID zp_class_zombie_register(zombieclass4_namezombieclass4_infozombieclass4_healthzombieclass4_speedzombieclass4_gravity)
    

Take a variable g_ZombieClassID (sure it's name will be different).

2. Add this function to your zombie class plugin:
PHP Code:
#include <zmvip>

public zp_fw_class_zombie_select_pre(idclassid) {
    if (
classid == g_ZombieClassID) {
        if (
zv_get_user_flags(id) == 0) {
            
zp_class_zombie_menu_text_add("*VIP* only!")
            return 
ZP_CLASS_NOT_AVAILABLE;
        }
        else {
            
zp_class_zombie_menu_text_add("*VIP*")
            return 
ZP_CLASS_AVAILABLE;
        }
    }
    return 
ZP_CLASS_AVAILABLE;

3. g_ZombieClassID have to be the same variable witch you found in #1 step.
(if (classid == g_ZombieClassID))

If you want to let the player have a class with a specific flag do like this:
Code:
if(zv_get_user_flags(id) & ZV_MAIN)
if(zv_get_user_flags(id) & ZV_MULTI)
...
Code:
#define ZV_MAIN          "a"
#define ZV_MULTI         "b"
#define ZV_UNLIMITED     "c"
#define ZV_DAMAGE        "d"
Now if you are using default amx authentication (MODE 0 or 2) do like this:

1. Find a function "zp_class_zombie_register" in file. It should look something like this:
PHP Code:
public plugin_precache()
{
    
g_ZombieClassID zp_class_zombie_register(zombieclass4_namezombieclass4_infozombieclass4_healthzombieclass4_speedzombieclass4_gravity)
    

Take a variable g_ZombieClassID (sure it's name will be different).

2. Add this function to your zombie class plugin:
PHP Code:
public zp_fw_class_zombie_select_pre(idclassid) {
    if (
classid == g_ZombieClassID) {
        if (!(
get_user_flags(id) & ADMIN_LEVEL_H)) {
            
zp_class_zombie_menu_text_add("*VIP* only!")
            return 
ZP_CLASS_NOT_AVAILABLE;
        }
        else {
            
zp_class_zombie_menu_text_add("*VIP*")
            return 
ZP_CLASS_AVAILABLE;
        }
    }
    return 
ZP_CLASS_AVAILABLE;

3. g_ZombieClassID have to be the same variable witch you found in #1 step.
(if (classid == g_ZombieClassID))

ADMIN_LEVEL_H is default t flag in users.ini file. It mostly using for vip plugins. Sure you can set this flag to what you want. If you want to make it for admins only, write ADMIN_IMMUNITY instead of ADMIN_LEVEL_H

Then compile plugin and add it to server.
__________________
My plugins:
[ZP] ZM_VIP (v2.0.0 is comming. v1.9.1 BETA is out!)


Last edited by aaarnas; 09-19-2012 at 10:38.
aaarnas is offline