Raised This Month: $ Target: $400
 0% 

Knife Mod Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kotasiu
New Member
Join Date: Jul 2010
Old 07-02-2010 , 12:03   Knife Mod Plugin
Reply With Quote #1

hello everyone. i have a problem with a plugin. I'd tried to modify the .sma from http://forums.alliedmods.net/showthread.php?t=111567, because i didn't want abilities. I wanted only the models.

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

#define PLUGIN "Knife Mod+"
#define VERSION "1.0"
#define AUTHOR "none"
#define MAXPLAYERS 32
#define TASK_INTERVAL 4.0

#define m_pLastItem 375
#define m_pLastKnifeItem 370


new knife_model[33] 
new g_Menu


public plugin_init() { 
	
	register_plugin(PLUGIN, VERSION, AUTHOR) 
	
	g_Menu = register_menuid("Knife Mod")
	register_menucmd(g_Menu, 1023, "knifemenu")
	register_clcmd("say /knife", "display_knife")
	
}

public plugin_precache() { 
	precache_model("models/knife-mod/v_assassin.mdl") 
	precache_model("models/knife-mod/p_assassin.mdl") 
	precache_model("models/knife-mod/v_machete.mdl")
	precache_model("models/knife-mod/p_machete.mdl")
        precache_model("models/knife-mod/v_bayonet.mdl")
        precache_model("models/knife-mod/p_bayonet.mdl")
	precache_model("models/knife-mod/v_combat.mdl")
	precache_model("models/knife-mod/p_combat.mdl")
	precache_model("models/knife-mod/v_KerisNogososro.mdl")
	precache_model("models/knife-mod/p_KerisNogososro.mdl")
	precache_model("models/v_knife.mdl") 
	precache_model("models/p_knife.mdl")
	precache_model("models/knife-mod/v_claw.mdl")
        precache_model("models/knife-mod/v_fantome.mdl")
        precache_model("models/knife-mod/v_fork.mdl")
} 

public display_knife(id) {
	// Codes makes it so only the dead can pick a knife.
	if (is_user_alive(id) == 1){
		console_print(id, "You are not allowed to select knives while alive")
		client_print(id, print_chat, "You are not allowed to select knives while alive")
		return PLUGIN_CONTINUE
	}
	else 
		console_print(id, "You are not allowed to select knives while alive")
	client_print(id, print_chat, "You are not allowed to select knives while alive")
	
	new menuBody[512]
	add(menuBody, 511, "\rKnife Mod\w^n^n")
	add(menuBody, 511, "1. Assassin \y (FragSquare) \w^n")
	add(menuBody, 511, "2. Machete \y (FragSquare) \w^n")
	add(menuBody, 511, "3. Bayonet  \y (FragSquare) \w^n")
	add(menuBody, 511, "4. Combat Knife \y (FragSquare) \w^n")
	add(menuBody, 511, "5. KerisNogososro \y (FragSquare) \w^n")
	add(menuBody, 511, "6. Deafult Knife \y (FragSquare) \w^n^n")
        add(menuBody, 511, "7. Ninja Knife \y (FragSquare) \w^n^n")
        add(menuBody, 511, "8. Fantome Knife \y (FragSquare) \w^n^n")
        add(menuBody, 511, "9. Fork \y (FragSquare) \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 Mod")
	
	return PLUGIN_HANDLED
}
public knifemenu(id, key) {
	switch(key) 
	{
			case 0: SetKnife(id , 6)
			case 1: SetKnife(id , 1)
			case 2: SetKnife(id , 2)
			case 3: SetKnife(id , 3)
			case 4: SetKnife(id , 4)
			case 5: SetKnife(id , 5)
                        case 7: SetKnife(id , 7)
                        case 8: SetKnife(id , 8)
                        case 9: SetKnife(id , 9)
			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_assassin.mdl")
			format(pModel,55,"models/knife-mod/p_assassin.mdl")
		}
		case 2: {
			format(vModel,55,"models/knife-mod/v_machete.mdl")
			format(pModel,55,"models/knife-mod/p_machete.mdl")
		}
		case 3: {
			format(vModel,55,"models/knife-mod/v_bayonet.mdl")
			format(pModel,55,"models/knife-mod/p_bayonet.mdl")
		}
		case 4: {
			format(vModel,55,"models/knife-mod/v_combat.mdl")
			format(pModel,55,"models/knife-mod/p_combat.mdl")
		}
                case 5: {
			format(vModel,55,"models/knife-mod/v_KerisNogososro.mdl")
			format(pModel,55,"models/knife-mod/p_KerisNogososro.mdl")
		}
		case 6: {
			format(vModel,55,"models/knife-mod/v_claw.mdl")
		} 
                case 7: {
			format(vModel,55,"models/knife-mod/v_fantome.mdl")
		} 
                case 8: {
			format(vModel,55,"models/knife-mod/v_fork.mdl")
		} 
	}
	
	entity_set_string(id, EV_SZ_viewmodel, vModel)
	entity_set_string(id, EV_SZ_weaponmodel, pModel)
	
	return PLUGIN_HANDLED;  

}  


public EventCurWeapon(id)
{
	new Weapon = read_data(2)
	
	// Set Knife Model
	SetKnife(id, knife_model[id])   
	
	// Task Options
	
	if(knife_model[id] == 0 && !task_exists(id) && Weapon == CSW_KNIFE)
		set_task(TASK_INTERVAL , "task_healing",id,_,_,"b")
	else if(task_exists(id))
		remove_task(id)

        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 model.")
}  

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)

}
I can see the menu, where you can choose your knife. But the knifes are not working. Please help me.

Last edited by kotasiu; 07-02-2010 at 12:05.
kotasiu is offline
kotasiu
New Member
Join Date: Jul 2010
Old 07-03-2010 , 18:31   Re: Knife Mod Plugin
Reply With Quote #2

anybody? Come on! There must be somebody who knows scripting(c+). Where are you guys? I need your help.
kotasiu is offline
kotasiu
New Member
Join Date: Jul 2010
Old 07-07-2010 , 13:03   Re: Knife Mod Plugin
Reply With Quote #3

Thank you for not helping me! =>you don't know scripting.
kotasiu is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 07-07-2010 , 13:06   Re: Knife Mod Plugin
Reply With Quote #4

Violating the rules will most certainly help you get assistance.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
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 07:09.


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