Raised This Month: $ Target: $400
 0% 

[ZP] Extra item: Thunder Knife


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
fiendshard
Senior Member
Join Date: Dec 2009
Location: In Water
Old 09-12-2010 , 01:45   Re: [HELP] [ZP] Extra item: Thunder Knife
Reply With Quote #6

Quote:
Originally Posted by nikhilgupta345 View Post
Never ever used register_event("Damage"), but used takedamage. So idk why is passed in the paramter of the function eventDeath or w/e. What is the id? The victim?

Anyway, if it is as i suspect, this should work:

Code:
#include <amxmodx>
#include <engine>
#include <zombieplague>

new havetk[33] 
new g_lightning, g_smoke
new g_tknife

public plugin_init()
{
    register_plugin( "[ZP] Thunder Knife", "0.1", "fiendshard" );
    register_event("Damage" , "event_Damage" , "b" , "2>0");
    g_tknife = zp_register_extra_item("Thunder Knife (Once)", 15, ZP_TEAM_HUMAN) 
}
public plugin_precache()
{
    g_lightning = precache_model( "sprites/lgtning.spr" );
    g_smoke = precache_model( "sprites/steam1.spr" );
}

public zp_extra_item_selected(id, itemid)
{
    if (itemid == g_tknife)
    havetk[id] = 1
    client_print(id, print_chat, "[ZP] You got Thunder Knife! Slash a Zombie to kill him with thunder")
    return PLUGIN_CONTINUE;    
}

public event_Damage(id)
{
    new weapon
    new attacker = get_user_attacker(id , weapon);
    
    if(!is_user_alive(attacker))
        return PLUGIN_CONTINUE;
        
    if     ((zp_get_user_zombie(attacker)) ||
        (zp_get_user_nemesis(attacker)) || 
        (zp_get_user_survivor(attacker)))
    return PLUGIN_HANDLED;
    
    if(weapon == CSW_KNIFE && havetk[attacker])
    {
        new vorigin[ 3 ], pos[ 3 ];
        get_user_origin( id, vorigin );
        vorigin[ 2 ] -= 26;
        pos[ 0 ] = vorigin[ 0 ] + 150;
        pos[ 1 ] = vorigin[ 1 ] + 150;
        pos[ 2 ] = vorigin[ 2 ] + 800;
        
        user_kill(id);
        Thunder( pos, vorigin );
        Smoke( vorigin, 10, 10 );
        
        havetk[id] = 0
    }
    
    return PLUGIN_CONTINUE;
}
Thunder( start[ 3 ], end[ 3 ] )
{
message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); 
write_byte( TE_BEAMPOINTS ); 
write_coord( start[ 0 ] ); 
write_coord( start[ 1 ] ); 
write_coord( start[ 2 ] ); 
write_coord( end[ 0 ] ); 
write_coord( end[ 1 ] ); 
write_coord( end[ 2 ] ); 
write_short( g_lightning ); 
write_byte( 1 );
write_byte( 5 );
write_byte( 7 );
write_byte( 20 );
write_byte( 30 );
write_byte( 200 ); 
write_byte( 200 );
write_byte( 200 );
write_byte( 200 );
write_byte( 200 );
message_end();

message_begin( MSG_PVS, SVC_TEMPENTITY, end );
write_byte( TE_SPARKS );
write_coord( end[ 0 ]  );
write_coord( end[ 1 ]);
write_coord( end[ 2 ] );
message_end();
}

Smoke( iorigin[ 3 ], scale, framerate )
{
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_SMOKE );
write_coord( iorigin[ 0 ] );
write_coord( iorigin[ 1 ] );
write_coord( iorigin[ 2 ] );
write_short( g_smoke );
write_byte( scale );
write_byte( framerate );
message_end();
}

public event_round_start()
{
    for(new i = 0; i < 32; i++)
        havetk[i] = 0
}
It partially works; if purchased, player gets one hit kill knife for the rest of the map time
__________________

Last edited by fiendshard; 09-12-2010 at 02:17.
fiendshard is offline
 



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:26.


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