AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Knife (https://forums.alliedmods.net/showthread.php?t=141064)

SaM.ThE.MaN 10-19-2010 05:35

Knife
 
Hi ,

I have seen loooots of places where they show how to replace knife skin/model with custom ones .... well that is not exactly what i want ... what i want is

Script :
PHP Code:

#include <amxmodx>
#include <fakemeta_util>

#define PLUGIN "Knife"
#define VERSION "1.0"
#define AUTHOR "Sam"

new Model[] = "models/model.mdl"
new Model1[] = "models/model1.mdl"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    new 
keys MENU_KEY_0|MENU_KEY_1|MENU_KEY_2;
        
register_menucmd(register_menuid("Test knife"), keys"ChooseKnife");
    
    
// Clcmd
        
register_clcmd("say /Test""Test");
}

public 
plugin_precache()
{
    
precache_model(Model)
    
precache_model(Model1)
}

public 
Test(id)
{
    new 
menu[192];
    new 
keys MENU_KEY_0|MENU_KEY_1|MENU_KEY_2
    
    format
(menu191"Test knife^n^n1. Knife1^n2. Knife2")
    
show_menu(idkeysmenu)
    
    return 
PLUGIN_CONTINUE
}

public 
ChooseChar(idkey
{
    switch (
key)
    {
        case 
1
        {
            
fm_strip_user_weapons(id)
            
fm_give_item(idModel)
            
        }
        case 
2
        {
            
fm_strip_user_weapons(id)
            
fm_give_item(idModel1)
        }
    }
    return 
PLUGIN_HANDLED;


If Option 1 is selected ... I want him to be given Model knife ... and if Option 2 is selected ... i want him to be given Model1 knife.

Vechta 10-19-2010 06:05

Re: Knife
 
Maybe this is okay, i dont know

PHP Code:

#include <amxmodx> 
#include <fakemeta> 
#include <fun>

#define PLUGIN "Knife" 
#define VERSION "1.0" 
#define AUTHOR "Sam" 

new Model[] = "models/model.mdl" 
new Model1[] = "models/model1.mdl" 

new bool:g_knifemodel[33][3]

public 
plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR
    
    new 
keys MENU_KEY_0|MENU_KEY_1|MENU_KEY_2
    
register_menucmd(register_menuid("Test knife"), keys"ChooseKnife"); 
    
    
register_event("CurWeapon""Event_CurWeapon""be""1=1")
     
    
// Clcmd 
    
register_clcmd("say /Test""Test"); 


public 
plugin_precache() 

    
precache_model(Model
    
precache_model(Model1


public 
Test(id

    new 
menu[192]; 
    new 
keys MENU_KEY_0|MENU_KEY_1|MENU_KEY_2 
     
    format
(menu191"Test knife^n^n1. Knife1^n2. Knife2"
    
show_menu(idkeysmenu
     
    return 
PLUGIN_CONTINUE 


public 
ChooseChar(idkey)  

    switch (
key
    { 
        case 
1:  
        { 
            
strip_user_weapons(id
            
g_knifemodel[id][1] = true
            give_item
(id"weapon_knife")
             
        } 
        case 
2:  
        { 
            
strip_user_weapons(id
            
g_knifemodel[id][2] = true
            give_item
(id"weapon_knife")
        } 
    } 
    return 
PLUGIN_HANDLED


public 
Event_CurWeapon(id)
{
    new 
weapon get_user_weapon(id)
    
    if (
weapon == CSW_KNIFE && g_knifemodel[id][1])
        
set_pev(idpev_viewmodel2Model)        
    else if (
weapon == CSW_KNIFE && g_knifemodel[id][2])
        
set_pev(idpev_viewmodel2Model1)



SaM.ThE.MaN 10-19-2010 07:34

Re: Knife
 
aww thanx man ... works -.-


All times are GMT -4. The time now is 10:21.

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