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

[knife plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hichamera
Senior Member
Join Date: Feb 2014
Location: Algeria
Old 02-05-2018 , 04:27   [knife plugin
Reply With Quote #1

Hello Allied.... i need help in this plugin when i use it in zombie plague Also zombie Will change the Modem i need it to work only with human

Code:
 #include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <dhudmessage> 

#define SKINS 9

new g_knife[33];

new const g_knifemodels[SKINS][64] = {
    "models/ze_b/gg_knife.mdl",
    "models/ze_b/v_axe.mdl",
    "models/ze_b/v_batman.mdl",
    "models/ze_b/v_dragon.mdl",
    "models/ze_b/v_minecraft.mdl",
    "models/ze_b/v_sakuragi_kunai.mdl",
    "models/ze_b/v_wolverine.mdl",
    "models/ze_b/v_knife_alien.mdl",
    "models/ze_b/v_knife22.mdl"
}

new const g_knifenames [SKINS][32] = {
    "GEEK",
    "AXE",
    "BATMAN",
    "DRAGON",
    "MINECRAFT",
    "Sakuragi Kunai",
    "xMAN",
    "Alien",
    "Super Knife"
}


static const AMX    [ ] = "^4[TEST]^1"
static const DIE    [ ] = "You cant choose knifes while you are dead"

#define PLUGIN "Knife Menu"
#define VERSION "2.0"
#define AUTHOR "TESt"

public plugin_init()
{
    register_clcmd("knife", "cmd_knife")
    
    register_event("CurWeapon","Event_CurWeapon","be","1=1");
}

public plugin_precache(){
    for (new i; i <= sizeof g_knifemodels; i++)
        precache_model(g_knifemodels[i]);
}

public client_putinserver(client)
    g_knife[client] = 0;

public Event_CurWeapon(client){
    
    if (read_data(2) == CSW_KNIFE)
        set_pev(client,pev_viewmodel2,g_knifemodels[g_knife[client]]);
    
}

public cmd_knife(id){
    new szSome[256];
    if(is_user_alive(id))
    {
        new knife = menu_create("\rKnife \yMenu", "cmd_knife_h");
        
        for (new i; i <= SKINS - 1; i++)
        {
            formatex(szSome,255,"\y%s",g_knifenames[i]);   
            menu_additem(knife,szSome);
        }    
        
        menu_display(id,knife);
    }
    
    else
        ChatColor(id, "%s %s", AMX, DIE);
}

public knife_callback(client,knife,item){
    new access,callback,szInfo[8],szName[32];
    menu_item_getinfo(knife,item,access,szInfo,8,szName,32,callback);
    
    if (str_to_num(szInfo) == 1)
        return ITEM_DISABLED;
    
    return ITEM_ENABLED;
}

public cmd_knife_h(client, knife, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(knife);
        return;
    }
    
    g_knife[client] = item;
    set_dhudmessage(10, 80, 255, -1.0, 0.31, 1, 2.0, 3.0, 2.0); 
    show_dhudmessage(client, "[TEST]"); 
    set_dhudmessage(100, 100, 100, -1.0, 0.35, 1, 2.0, 3.0, 2.0 ); 
    show_dhudmessage(client, "YOU CHOOSED %s",g_knifenames[g_knife[client]]);
}

stock ChatColor(const id, const input[], any:...) {
    new count = 1, players[ 32 ]
    static msg[ 191 ]
    vformat( msg, 190, input, 3 )
    
    replace_all( msg, 190, "!g", "^4" )
    replace_all( msg, 190, "!y", "^1" )
    replace_all( msg, 190, "!t", "^3" )
    
    
    if(id) players[ 0 ] = id; 
    else get_players( players, count, "ch" )
    
    for(new i = 0; i < count; i++)
    {
        if( is_user_connected( players[ i ] ) )
        {
            message_begin( MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[ i ] )  
            write_byte( players[ i ] )
            write_string( msg )
            message_end( )
        }
    }
}

Last edited by hichamera; 02-05-2018 at 06:07.
hichamera is offline
Send a message via Skype™ to hichamera
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 02-05-2018 , 05:07   Re: [knife plugin
Reply With Quote #2

check if the player is human. if(zp_get_user_zombie(id)) return;
__________________
retired chump
DjSoftero is offline
hichamera
Senior Member
Join Date: Feb 2014
Location: Algeria
Old 02-05-2018 , 06:07   Re: [knife plugin
Reply With Quote #3

Quote:
Originally Posted by DjSoftero View Post
check if the player is human. if(zp_get_user_zombie(id)) return;
this plugin its not programed for zombie mod i need someone to fix it becaus if i chosse zombie class when i got infected i got knife who i chosse in menu not zombie claws
hichamera is offline
Send a message via Skype™ to hichamera
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 02-05-2018 , 08:24   Re: [knife plugin
Reply With Quote #4

Code:
#include <zombie_plague> public Event_CurWeapon(client){         if (read_data(2) == CSW_KNIFE && !zp_get_user_zombie(client))         set_pev(client,pev_viewmodel2,g_knifemodels[g_knife[client]]);     }
__________________
retired chump
DjSoftero is offline
hichamera
Senior Member
Join Date: Feb 2014
Location: Algeria
Old 02-05-2018 , 14:33   Re: [knife plugin
Reply With Quote #5

i use zp 5.0.x how to add in this plugin ?

Last edited by hichamera; 02-05-2018 at 14:49.
hichamera is offline
Send a message via Skype™ to hichamera
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-05-2018 , 15:09   Re: [knife plugin
Reply With Quote #6

ZP 5.0.X has a backwards compatibility.
__________________
edon1337 is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 02-05-2018 , 15:15   Re: [knife plugin
Reply With Quote #7

include zombie plague library and the replace Event_curweapon function with the one I provided.
__________________
retired chump
DjSoftero is offline
hichamera
Senior Member
Join Date: Feb 2014
Location: Algeria
Old 02-05-2018 , 15:25   Re: [knife plugin
Reply With Quote #8

i don't understand what i need to do i add
#include <zombieplague>
& i replace
Quote:
public Event_CurWeapon(client){

if (read_data(2) == CSW_KNIFE)
set_pev(client,pev_viewmodel2,g_knifemodels[g_knife[client]]);

}
with this
Quote:
#include <zombie_plague>

public Event_CurWeapon(client){

if (read_data(2) == CSW_KNIFE && !zp_get_user_zombie(client))
set_pev(client,pev_viewmodel2,g_knifemodels[g_knife[client]]);

}
but can't comp.. plugin
hichamera is offline
Send a message via Skype™ to hichamera
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 02-06-2018 , 03:49   Re: [knife plugin
Reply With Quote #9

my bad, it's <zombieplague> without _
__________________
retired chump
DjSoftero is offline
hichamera
Senior Member
Join Date: Feb 2014
Location: Algeria
Old 02-06-2018 , 05:05   Re: [knife plugin
Reply With Quote #10

alsooo no work :/
hichamera is offline
Send a message via Skype™ to hichamera
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 08:22.


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