Raised This Month: $ Target: $400
 0% 

API Scripting Help Extra Iteam ZP5.0 for vip


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hosimosi
Senior Member
Join Date: Apr 2013
Old 09-19-2013 , 09:48   Extra Iteam ZP5.0 for vip
Reply With Quote #1

hi
i have problem
here is tutorial for make extra Iteam for Vip
http://forums.alliedmods.net/showpos...6&postcount=99
but it's differnt and i can't make it for vip
can someone help me ?
here is sma file
PHP Code:
/*
        [ZP] Extra: Noclip for humans and survivors
        
    Description:
        *    Another extra item for zombie plague 5.0.
        This extra item can set the buyer to get noclip.
        
    Credits:
        *    NO
            
    Changlog:
        *    1.0 (Dec 22, 2011)
        {    public release;        }
*/

/****************************************
    [ Included files ]
****************************************/

#include <amxmodx>
#include <fun>
#include <zp50_core>
#include <zp50_class_nemesis>
#include <zp50_class_survivor>
#include <zp50_items>
#include <zp50_colorchat>

/****************************************
    [ Id[s] ]
****************************************/

//Cvars
new cvar_enablecvar_allow_survivorcvar_during_second
//Ids
new g_extra_noclip

/****************************************
    [ Plugin init ]
****************************************/

public plugin_init()
{
    
register_plugin("[ZP] Extra: Noclip""v1.0""snaker-beatter")
    
    
g_extra_noclip zp_items_register("Noclip feet"22)
    
    
cvar_enable register_cvar("zp_extra_noclip_enable""1")
    
cvar_allow_survivor register_cvar("zp_extra_noclip_survivor""1")
    
cvar_during_second register_cvar("zp_extra_noclip_seconds""5")
}

/*****************************************
    [ Functions ]
*****************************************/

public zp_fw_items_select_pre(iditemid)
{
    if (
itemid == g_extra_noclip)
    {
        if (
get_pcvar_num(cvar_enable) == 0)
            return 
ZP_ITEM_DONT_SHOW;
            
        if (
zp_class_nemesis_get(id) || zp_core_is_zombie(id))
            return 
ZP_ITEM_DONT_SHOW;
            
        if (
get_pcvar_num(cvar_allow_survivor) == && zp_class_survivor_get(id))
            return 
ZP_ITEM_DONT_SHOW;
            
        return 
ZP_ITEM_AVAILABLE;
    }
    return 
ZP_ITEM_AVAILABLE;
}

public 
zp_fw_items_select_post(iditemid)
{
    if (
itemid == g_extra_noclip)
    {
        
zp_colored_print(id"^x01You ^x04You buyed noclip^x01. Will be expired after ^x04%.f0 seconds^x01"get_pcvar_float(cvar_during_second))
        
set_user_noclip(id1)
        
set_task(get_pcvar_float(cvar_during_second), "set_stop_noclip"id)
    }
}

public 
set_stop_noclip(id)
{
    
set_user_noclip(id0)
    
zp_colored_print(id"^x04You're noclip is finished^x01")

thank you

Last edited by hosimosi; 09-19-2013 at 09:49.
hosimosi is offline
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 09-19-2013 , 11:14   Re: Extra Iteam ZP5.0 for vip
Reply With Quote #2

PHP Code:
/*
        [ZP] Extra: Noclip for humans and survivors
        
    Description:
        *    Another extra item for zombie plague 5.0.
        This extra item can set the buyer to get noclip.
        
    Credits:
        *    NO
            
    Changlog:
        *    1.0 (Dec 22, 2011)
        {    public release;        }
*/

/****************************************
    [ Included files ]
****************************************/

#include <amxmodx>
#include <fun>
#include <zp50_core>
#include <zp50_class_nemesis>
#include <zp50_class_survivor>
#include <zp50_items>
#include <zp50_colorchat>

/****************************************
    [ Id[s] ]
****************************************/

//Cvars
new cvar_enablecvar_allow_survivorcvar_during_second
//Ids
new g_extra_noclip

/****************************************
    [ Plugin init ]
****************************************/

public plugin_init()
{
    
register_plugin("[ZP] Extra: Noclip""v1.0""snaker-beatter")
    
    
g_extra_noclip zp_items_register("Noclip feet"22)
    
    
cvar_enable register_cvar("zp_extra_noclip_enable""1")
    
cvar_allow_survivor register_cvar("zp_extra_noclip_survivor""1")
    
cvar_during_second register_cvar("zp_extra_noclip_seconds""5")
}

/*****************************************
    [ Functions ]
*****************************************/

public zp_fw_items_select_pre(iditemid)
{
    if (
itemid == g_extra_noclip)
    {
        if (
get_pcvar_num(cvar_enable) == 0)
            return 
ZP_ITEM_DONT_SHOW;
            
        if (
zp_class_nemesis_get(id) || zp_core_is_zombie(id))
            return 
ZP_ITEM_DONT_SHOW;
            
        if (
get_pcvar_num(cvar_allow_survivor) == && zp_class_survivor_get(id))
            return 
ZP_ITEM_DONT_SHOW;

        if (!(
get_user_flags(id) & ADMIN_LEVEL_H))
            return 
ZP_ITEM_DONT_SHOW;
            
        return 
ZP_ITEM_AVAILABLE;
    }
    return 
ZP_ITEM_AVAILABLE;
}

public 
zp_fw_items_select_post(iditemid)
{
    if (
itemid == g_extra_noclip)
    {
        
zp_colored_print(id"^x01You ^x04You buyed noclip^x01. Will be expired after ^x04%.f0 seconds^x01"get_pcvar_float(cvar_during_second))
        
set_user_noclip(id1)
        
set_task(get_pcvar_float(cvar_during_second), "set_stop_noclip"id)
    }
}

public 
set_stop_noclip(id)
{
    
set_user_noclip(id0)
    
zp_colored_print(id"^x04You're noclip is finished^x01")

__________________
You will find everything u need :-
Catastrophe is offline
hosimosi
Senior Member
Join Date: Apr 2013
Old 09-20-2013 , 09:47   Re: Extra Iteam ZP5.0 for vip
Reply With Quote #3

Thanks!
but dont' need #include <zmvip> ?
hosimosi is offline
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 09-20-2013 , 11:01   Re: Extra Iteam ZP5.0 for vip
Reply With Quote #4

No since u use mode 2 in VIP plugin it uses default amxx admin flags to set VIPS
__________________
You will find everything u need :-
Catastrophe 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 00:40.


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