Raised This Month: $ Target: $400
 0% 

Knife Mod Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TiGGeR2473
Junior Member
Join Date: Sep 2007
Old 09-15-2007 , 13:13   Knife Mod Help
Reply With Quote #1

Ok im now completey dumb but i just need help on how to add more than 4 knife's and and more tha 4 knifes i nthe /knife menu can some 1 plz help me?


Code:
#include <amxmodx>
#include <amxmisc>
#include <engine> 
#include <vault>
#include <fun>

#define PLUGIN "Knife"
#define VERSION "2" 
#define AUTHOR "UnKnown

#define TASK_INTERVAL 4.0  
  

new knife_model[33] 
new g_Menu

new CVAR_DAMAGE 

public plugin_init() { 
    
    register_plugin(PLUGIN, VERSION, AUTHOR) 
    
    register_event( "Damage", "event_damage", "be" )
    register_event("CurWeapon","CurWeapon","be","1=1") 
    
    g_Menu = register_menuid("Knife")
    register_menucmd(g_Menu, 1023, "knifemenu")
    
    register_clcmd("say /knife", "display_knife")
    

    CVAR_DAMAGE = register_cvar("km_damage", "0")

    
    set_task(480.0, "kmodmsg", 0, _, _, "b")
}

public plugin_precache() { 
    precache_model("models/knife-mod/v_dildo_knife") 
    precache_model("models/knife-mod/p_dildo_knife") 
    precache_model("models/knife-mod/v_holycross_knife")
    precache_model("models/knife-mod/p_holycross_knife")
    precache_model("models/knife-mod/v_darthmaulsaber_knife")
    precache_model("models/knife-mod/p_darthmaulsaber_knife")
    precache_model("models/knife-mod/v_brassknuckles_knife")
    precache_model("models/knife-mod/p_brassknuckles_knife")
    precache_model("models/v_knife.mdl") 
    precache_model("models/p_knife.mdl")
} 

public display_knife(id) {
    new menuBody[512]
    add(menuBody, 511, "\rKnife\w^n^n")
    add(menuBody, 511, "1. Dildo \y(Wanna Play?)\w^n")
    add(menuBody, 511, "2. Holy Cross \y(Vampire?)\w^n")
    add(menuBody, 511, "3. Darth Maul \y(Ah Small)\w^n")
    add(menuBody, 511, "4. Brass Kunckles \y(wanna cook)\w^n")
    add(menuBody, 511, "5. Default Knife \y(Ugly Knife)\w^n^n")
    add(menuBody, 511, "0. Exit^n")
    
    new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9 )
    show_menu(id, keys, menuBody, -1, "Knife")
}

public knifemenu(id, key) {
    switch(key) 
    {
        case 0: SetKnife(id , 4)
        case 1: SetKnife(id , 2)
        case 2: SetKnife(id , 3)
        case 3: SetKnife(id , 1)
        case 4: SetKnife(id , 0)
        default: return PLUGIN_HANDLED
    }
    SaveData(id)
    return PLUGIN_HANDLED
} 

public SetKnife(id , Knife) {
    knife_model[id] = Knife
    
    new Clip, Ammo, Weapon = get_user_weapon(id, Clip, Ammo) 
    if ( Weapon != CSW_KNIFE )
        return PLUGIN_HANDLED
    
    new vModel[56],pModel[56]
    
    switch(Knife)
    {
        case 0: {
            format(vModel,55,"models/v_knife.mdl")
            format(pModel,55,"models/p_knife.mdl")
        }
        case 1: {
            format(vModel,55,"models/knife-mod/v_dildo_knife")
            format(pModel,55,"models/knife-mod/p_dildo_knife")
        }
        case 2: {
            format(vModel,55,"models/knife-mod/v_holycross_knife")
            format(pModel,55,"models/knife-mod/p_holycross_knife")
        }
        case 3: {
            format(vModel,55,"models/knife-mod/v_darthmaulsaber_knife")
            format(pModel,55,"models/knife-mod/p_darthmaulsaber_knife")
        }
        case 4: {
            format(vModel,55,"models/knife-mod/v_brassknuckles_knife")
            format(pModel,55,"models/knife-mod/p_brassknuckles_knife")
        }
    } 
    
    entity_set_string(id, EV_SZ_viewmodel, vModel)
    entity_set_string(id, EV_SZ_weaponmodel, pModel)
    
    return PLUGIN_HANDLED;  
}

public event_damage( id ) {
    
    new victim_id = id;
    if( !is_user_connected( victim_id ) ) return PLUGIN_CONTINUE
    new dmg_take = read_data( 2 );
    new dmgtype = read_data( 3 );
    new Float:multiplier = get_pcvar_float(CVAR_DAMAGE);
    new Float:damage = dmg_take * multiplier;
    new health = get_user_health( victim_id );
    
    new iWeapID, attacker_id = get_user_attacker( victim_id, iWeapID );
    
    if( !is_user_connected( attacker_id ) || !is_user_alive( victim_id ) ) {
        return PLUGIN_HANDLED
    }
    
    if( iWeapID == CSW_KNIFE && knife_model[attacker_id] == 4 ) {
        
        if( floatround(damage) >= health ) {
            if( victim_id == attacker_id ) {
                return PLUGIN_CONTINUE
                }else{
                log_kill( attacker_id, victim_id, "knife", 0 );
            }
            
            return PLUGIN_CONTINUE
            }else {
            if( victim_id == attacker_id ) return PLUGIN_CONTINUE
            
            fakedamage( victim_id, "weapon_knife", damage, dmgtype );
        }
    }
    return PLUGIN_CONTINUE
}

public CurWeapon(id)
    {
    new Weapon = read_data(2)
    
    // Set Knife Model
    SetKnife(id, knife_model[id])   
    
    return PLUGIN_HANDLED   
    
}

stock log_kill(killer, victim, weapon[],headshot) {
    user_silentkill( victim );
    
    message_begin( MSG_ALL, get_user_msgid( "DeathMsg" ), {0,0,0}, 0 );
    write_byte( killer );
    write_byte( victim );
    write_byte( headshot );
    write_string( weapon );
    message_end();
    
    new kfrags = get_user_frags( killer );
    set_user_frags( killer, kfrags++ );
    new vfrags = get_user_frags( victim );
    set_user_frags( victim, vfrags++ );
    
    return  PLUGIN_CONTINUE
} 


public client_disconnect(id) {  
    if(task_exists(id)) remove_task(id)  
}  


public kmodmsg() { 
    
    client_print(0,print_chat,"[AMXX] Type /knife to change your knife skins")
}  

public client_authorized(id)
    {
    LoadData(id)
}

SaveData(id)
{ 
    
    new authid[32]
    get_user_authid(id, authid, 31)
    
    new vaultkey[64]
    new vaultdata[64]
    
    format(vaultkey, 63, "KMOD_%s", authid)
    format(vaultdata, 63, "%d", knife_model[id])
    set_vaultdata(vaultkey, vaultdata)
}

LoadData(id) 
{ 
    new authid[32] 
    get_user_authid(id,authid,31)
    
    new vaultkey[64], vaultdata[64]
    
    format(vaultkey, 63, "KMOD_%s", authid)
    get_vaultdata(vaultkey, vaultdata, 63)
    knife_model[id] = str_to_num(vaultdata)
    
} 
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/
TiGGeR2473 is offline
TiGGeR2473
Junior Member
Join Date: Sep 2007
Old 09-15-2007 , 14:32   Re: Knife Mod Help
Reply With Quote #2

ok so i tried editing it useing the old sma with out the powers and i get there errors

Code:
Your plugin failed to compile! Read the errors below:
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

/home/groups/amxmodx/tmp3/phpq1eETJ.sma(51) : error 001: expected token: ")", but found "-integer value-"
/home/groups/amxmodx/tmp3/phpq1eETJ.sma(51) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/phpq1eETJ.sma(70) : error 017: undefined symbol "SaveData"
/home/groups/amxmodx/tmp3/phpq1eETJ.sma(161) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phpq1eETJ.sma(161) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/phpq1eETJ.sma(161) : error 017: undefined symbol "kmodmsg"
/home/groups/amxmodx/tmp3/phpq1eETJ.sma(172) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/phpq1eETJ.sma(172) : error 004: function "client_authorized" is not implemented
/home/groups/amxmodx/tmp3/phpq1eETJ.sma(173) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phpq1eETJ.sma(175) : error 017: undefined symbol "LoadData"
/home/groups/amxmodx/tmp3/phpq1eETJ.sma(178) : warning 217: loose indentation
/home/groups/amxmodx/tmp3/phpq1eETJ.sma(178) : error 017: undefined symbol "SaveData"
/home/groups/amxmodx/tmp3/phpq1eETJ.sma(192) : error 017: undefined symbol "LoadData"
/home/groups/amxmodx/tmp3/phpq1eETJ.sma(208) : error 001: expected token: "}", but found "-end of file-"

11 Errors.
Could not locate output file /home/groups/amxmodx/public_html/websc3/phpq1eETJ.amx (compile failed).
and heres the .sma i tried to edit
Attached Files
File Type: sma Get Plugin or Get Source (knife_mod.sma - 74 views - 5.9 KB)
TiGGeR2473 is offline
maplebest
BANNED
Join Date: May 2007
Location: Sweden, Sverige
Old 09-15-2007 , 16:17   Re: Knife Mod Help
Reply With Quote #3

Check my last post instead.

Last edited by maplebest; 09-15-2007 at 17:37.
maplebest is offline
maplebest
BANNED
Join Date: May 2007
Location: Sweden, Sverige
Old 09-15-2007 , 17:35   Re: Knife Mod Help
Reply With Quote #4

I changed it but 3 warnings :

Welcome to the AMX Mod X 1.76-300 Compiler.Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team/home/groups/amxmodx/tmp3/phpvhUtgP.sma(3 : warning 217: loose indentation/home/groups/amxmodx/tmp3/phpvhUtgP.sma(46) : warning 217: loose indentation/home/groups/amxmodx/tmp3/phpvhUtgP.sma(71) : warning 217: loose indentationHeader size: 740 bytesCode size: 5072 bytesData size: 5912 bytesStack/heap size: 16384 bytes; estimated max. usage=524 cells (2096 bytes)Total requirements: 28108 bytes3 Warnings.Done.
257794 successful compiles to date.
143882 failed compiles to date.
Old compiler: 101980 compiles before decommission.
This tool by: David "BAILOPAN" Anderson







I THINK IT WILL WORK, I DONT GOT THE MODELS SO I CANT TRY IT OUT.

HERE IS THE PLUGIN :http://files.filefront.com/new+knife.../fileinfo.html

---------------------------------------------------------------------------------------------------
Please +karma if it helped.
maplebest is offline
TiGGeR2473
Junior Member
Join Date: Sep 2007
Old 09-17-2007 , 17:16   Re: Knife Mod Help
Reply With Quote #5

ok ty but u know how to add more than 4 knife's?
TiGGeR2473 is offline
maplebest
BANNED
Join Date: May 2007
Location: Sweden, Sverige
Old 09-18-2007 , 10:43   Re: Knife Mod Help
Reply With Quote #6

Hmmm.... I can add more but i dont know how i can explain it Just tell me what you want to do. I can add for you
maplebest is offline
TiGGeR2473
Junior Member
Join Date: Sep 2007
Old 09-20-2007 , 19:59   Re: Knife Mod Help
Reply With Quote #7

i want all of them plus
Code:
p_armysurvival_knife
p_assassin_knife
p_kershawshunpronakiri_knife
p_crowbar_knife
p_bf2142_knife
p_scorpian_knife
p_wiicontroller_knife
p_machete_knife
p_greensaber_knife
p_redsaber_knife
p_taser_knife
p_tablebattle_knife
v_bluesaber_knife
v_sc_knife
v_foamfinger_knife
can some one add all of them and make the sc and redsaber knifes admin only or can some one teach me?
TiGGeR2473 is offline
maplebest
BANNED
Join Date: May 2007
Location: Sweden, Sverige
Old 09-22-2007 , 02:47   Re: Knife Mod Help
Reply With Quote #8

I just got 1 problem... I can add more than 9 knives i dont know how to make a new page that will work And i dont know how to make one to admin knife.

But i will try to add some knives anyway
maplebest is offline
maplebest
BANNED
Join Date: May 2007
Location: Sweden, Sverige
Old 09-22-2007 , 02:47   Re: Knife Mod Help
Reply With Quote #9

You got the knives from MD?
maplebest is offline
maplebest
BANNED
Join Date: May 2007
Location: Sweden, Sverige
Old 09-22-2007 , 02:51   Re: Knife Mod Help
Reply With Quote #10

I think you need more v_ models.
maplebest 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 16:07.


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