Raised This Month: $ Target: $400
 0% 

Knife Mod+


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
drastiq
Junior Member
Join Date: Nov 2009
Old 12-12-2009 , 04:33   Knife Mod+
Reply With Quote #1

I'm not sure if a recode has been done like this or not. Basically I took Spunko's Knife Mod and made it so you had to be dead to choose a new knife. Also I added another knife option "Ninja Knife". I thought people would enjoy the new features. This is also my first submission, be it a recode or not. Go easy on me.

I'd like to thank Spunko for all his hard work.

Knife Mod+ (Recode/Addon)

- It changes the models of the knife (six models including default knife).

- Each knife has an ability (see below)

- Change the models via menu with a chat command: /knife

- It saves the data of the model you choose (so if you leave the server and come in again you will have the model you chose before).

- It prints a message with help every 8 minutes.

Knife Abilities

1. Machete (More Damage/Low Speed)
2. Bak Knife (No Footsteps)
3. Pocket Knife (High Speed)
4. Butcher Knife (Low Gravity)
5. Default Knife (Health Regeneration)
6. Ninja Knife (Cloaking Ability)

Install

- Unzip the file in "cstrike" folder
- Add "knife_mod_plus.amxx" without quotes in plugins.ini

Modules Required
< Fun >
< Engine >

Commands
For Admins:
km_highspeed 340 (sets the speed for Pocket Knife)
km_lowspeed 170 (sets the speed for Machete)
km_addhealth 3 (sets the health you will gain with Default Knife)
km_maxhealth 75 (sets the healt you can reach when healing D-knife)
km_damage 2 (damage multiplier for Machete)
km_lowgravity 400 (sets the low gravity)
km_invis 75 (set the visibility percentage, 0-255, 255 fully visible)

For Players:

/knife Write it in chat for the menu to change the knifes
You must be dead in order to access the menu.

Credits
Damage multiplier and log_kill code
- Nightscream Plugin: He Damage Multiplier
Speed code
- v3x Plugin: Various Weapon Speeds
Healing code
- Knife Healing
Thanx to "SweatyBanana" for the client_putinserver suggestion.
Original Plugin
-
Knife Mod
Attached Files
File Type: sma Get Plugin or Get Source (knife_mod_plus.sma - 20150 views - 8.3 KB)
File Type: zip knife_mod-models.zip (1.73 MB, 11156 views)
drastiq is offline
drastiq
Junior Member
Join Date: Nov 2009
Old 12-12-2009 , 04:34   Re: Knife Mod+
Reply With Quote #2

Just a note, I know that the ninja knife is actually a set of claws. But yea, this is called Knife Mod.. Not claw mod.. ;p
drastiq is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-12-2009 , 06:01   Re: Knife Mod+
Reply With Quote #3

It's not worth to post as new plugins with the changes you have done. It's 99% the same code. You should have post in the original plugin thread.

As something really new, you could add the possibility to customize knifes with a file. So you can set the number of knifes you want, the models you want, the abilities you want etc.
__________________
Arkshine is offline
drastiq
Junior Member
Join Date: Nov 2009
Old 12-12-2009 , 11:56   Re: Knife Mod+
Reply With Quote #4

Quote:
Originally Posted by Arkshine View Post
It's not worth to post as new plugins with the changes you have done. It's 99% the same code. You should have post in the original plugin thread.

As something really new, you could add the possibility to customize knifes with a file. So you can set the number of knifes you want, the models you want, the abilities you want etc.
Ah, well I didn't wanna take away from his thread. But I did post a link there to this. Also, Ill see what I can do about your ideas.

-Dras
drastiq is offline
floatman
Senior Member
Join Date: Oct 2009
Location: nowhere.
Old 12-12-2009 , 13:21   Re: Knife Mod+
Reply With Quote #5

Right arkshine.
Anyway,
The code isn't perfectly:
1.
PHP Code:
stock log_kill(killervictimweapon[],headshot) {
user_silentkillvictim );

message_beginMSG_ALLget_user_msgid"DeathMsg" ), {0,0,0}, );
write_bytekiller );
write_bytevictim );
write_byteheadshot );
write_stringweapon );
message_end();

new 
kfrags get_user_fragskiller );
set_user_fragskillerkfrags++ );
new 
vfrags get_user_fragsvictim );
set_user_fragsvictimvfrags++ );

return  
PLUGIN_CONTINUE



public 
task_healing(id) {  
new 
addhealth get_pcvar_num(CVAR_HEALTH_ADD)  
if (!
addhealth)
    return  

new 
maxhealth get_pcvar_num(CVAR_HEALTH_MAX)  
if (
maxhealth MAX_HEALTH) { 
    
set_pcvar_num(CVAR_HEALTH_MAXMAX_HEALTH)  
    
maxhealth MAX_HEALTH 
}  

new 
health get_user_health(id)   

if (
is_user_alive(id) && (health maxhealth)) { 
    
set_user_health(idhealth addhealth)
    
set_hudmessage(02550, -1.00.2501.02.00.10.14)
    
show_hudmessage(id,"<< !!HEAL IN PROGRESS!! >>")
    
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, id)
    
write_short(1<<10)
    
write_short(1<<10)
    
write_short(0x0000)
    
write_byte(0)
    
write_byte(200)
    
write_byte(0)
    
write_byte(75)
    
message_end()
}

else {
    if (
is_user_alive(id) && (health maxhealth))
        
remove_task(id)
    
}
}  

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(idauthid31)

new 
vaultkey[64]
new 
vaultdata[64]

format(vaultkey63"KMOD_%s"authid)
format(vaultdata63"%d"knife_model[id])
set_vaultdata(vaultkeyvaultdata)
}

LoadData(id

new 
authid[32
get_user_authid(id,authid,31)

new 
vaultkey[64], vaultdata[64]

format(vaultkey63"KMOD_%s"authid)
get_vaultdata(vaultkeyvaultdata63)
knife_model[id] = str_to_num(vaultdata)


Use TAB button.

2.
Code:
    if (is_user_alive(id) == 1){
Don't needed.

(optionaly)3. http://forums.alliedmods.net/showthread.php?t=46364
__________________

floatman is offline
drastiq
Junior Member
Join Date: Nov 2009
Old 12-12-2009 , 13:59   Re: Knife Mod+
Reply With Quote #6

ah, as far as the indents go, my bad, lol. also with the
PHP Code:
if (is_user_alive(id) == 1){ 
I assume you're referring to the "1". At one time I intended on doing an else if but I could never get it to work, that would be the proper format right? As in

PHP Code:
if (is_user_alive(id) == 1){
        
console_print(id"You are not allowed to select knives while alive")
else if (
is_user_alive(id) == 0)
        ..
code here..()) 
Along those lines?


And im not sure I understand your 3rd suggestion, are you basically saying you hate my menu? It was part of the original code, but I'll see If I can attempt to comprehend what it is exactly your suggesting with that link.

Thanks for the support/tips guys, I'm pretty much a code noob when it comes to this sorta thing.

-Dras
drastiq is offline
floatman
Senior Member
Join Date: Oct 2009
Location: nowhere.
Old 12-12-2009 , 14:07   Re: Knife Mod+
Reply With Quote #7

Quote:
Originally Posted by drastiq View Post
ah, as far as the indents go, my bad, lol. also with the
PHP Code:
if (is_user_alive(id) == 1){ 
I assume you're referring to the "1". At one time I intended on doing an else if but I could never get it to work, that would be the proper format right? As in

PHP Code:
if (is_user_alive(id) == 1){
        
console_print(id"You are not allowed to select knives while alive")
else if (
is_user_alive(id) == 0)
        ..
code here..()) 
Along those lines?
You could use:
PHP Code:
if( !is_user_alive(index) ) return PLUGIN_HANDLED
Not bullshits.
__________________

floatman is offline
drastiq
Junior Member
Join Date: Nov 2009
Old 12-12-2009 , 14:06   Re: Knife Mod+
Reply With Quote #8

Also, I'm having an issue I just noticed with the new knife, I put a print in there to show up when you first switch to the new knife, however it also appears two of the other knives. The first option, and the third option I believe(or the Machete and the Pocketknife). I have absolutely -no- clue why. lol. here the new knife code.

PHP Code:
public EventCurWeapon(id)
{
    new 
Weapon read_data(2)
    
    
// Set Knife Model
    
SetKnife(idknife_model[id])   
    
    
// Task Options
    
    
if(knife_model[id] == && !task_exists(id) && Weapon == CSW_KNIFE)
        
set_task(TASK_INTERVAL "task_healing",id,_,_,"b");
    else if(
task_exists(id))
        
remove_task(id)
    
    
// Abilities
    
set_user_footsteps(id , ( (knife_model[id] == && Weapon == CSW_KNIFE) ? 0) );
    
    new 
Float:Gravity = ((knife_model[id] == && Weapon == CSW_KNIFE)? get_pcvar_float(CVAR_LOWGRAV) : get_pcvar_float(CVAR_NORMGRAV)) / 800.0
    set_user_gravity
(id Gravity);
    
    
    
// Speed
    
new Float:Speed
    
if(Weapon != CSW_KNIFE || knife_model[id] < 3)
        return 
PLUGIN_CONTINUE
    
else if(knife_model[id] == 3)
        
Speed get_pcvar_float(CVAR_HIGHSPEED);
    else if(
knife_model[id] == 4)
        
Speed get_pcvar_float(CVAR_LOWSPEED);
    
    
set_user_maxspeed(idSpeed);
    
    
    
    
// Ninja
    
if(Weapon != CSW_KNIFE || knife_model[id] == 5)
        
set_user_renderingidkRenderFxNone000kRenderTransAlphaget_pcvar_numg_pVisiblity ) )
        
client_print(id,print_center,"One with the Shadows...");
        return 
PLUGIN_HANDLED


And it doesn't look like the highlighting is coming up right on here, but its right in AMXX-Studio.
drastiq is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 12-12-2009 , 14:07   Re: Knife Mod+
Reply With Quote #9

You actually don't need the == at all on is_user_alive. Either use if(is_user_alive(id) ) or if(!is_user_alive(id) ) since it can only be 1 or 0. The ! means that it checks if he's not alive.

What he meant by the link is to use those kind of menu's instead of doing it as Spunko did in his original code.

Code:
    if(Weapon != CSW_KNIFE || knife_model[id] == 5)
        set_user_rendering( id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, get_pcvar_num( g_pVisiblity ) )
        client_print(id,print_center,"One with the Shadows...");
        return PLUGIN_HANDLED
Use { }
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
drastiq
Junior Member
Join Date: Nov 2009
Old 12-12-2009 , 16:37   Re: Knife Mod+
Reply With Quote #10

Quote:
Originally Posted by DarkGod View Post
You actually don't need the == at all on is_user_alive. Either use if(is_user_alive(id) ) or if(!is_user_alive(id) ) since it can only be 1 or 0. The ! means that it checks if he's not alive.

What he meant by the link is to use those kind of menu's instead of doing it as Spunko did in his original code.

Code:
    if(Weapon != CSW_KNIFE || knife_model[id] == 5)
        set_user_rendering( id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, get_pcvar_num( g_pVisiblity ) )
        client_print(id,print_center,"One with the Shadows...");
        return PLUGIN_HANDLED
Use { }

If I put brackets on it wouldn't close it off from the code it relies on to work?
PHP Code:
public EventCurWeapon(id
?? I tried putting brackets on it tho, to no avail, perhaps im doing it wrong tho. but when even I did put brackets on it I got this..

Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Undefined symbol "SaveData" on line 97
Error: Undefined symbol "log_kill" on line 166
Warning: Loose indentation on line 217
Error: Invalid expression, assumed zero on line 217
Warning: Unreachable code on line 221
Warning: Loose indentation on line 221
Error: Invalid expression, assumed zero on line 221
Error: Undefined symbol "log_kill" on line 221
Error: Undefined symbol "victim" on line 221
Error: Too many error messages on one line on line 221

Compilation aborted.
7 Errors.
Could not locate output file C:\Documents and Settings\Compaq_Administrator\Desktop\knife_mod_plus.amx (compile failed).
drastiq 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 20:11.


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