Raised This Month: $12 Target: $400
 3% 

Thunder, more than 1 use


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 11-16-2011 , 15:09   Thunder, more than 1 use
Reply With Quote #1

I already changed the havetk to other values ​​such as 3, but even so the use is limited to one use only.

PHP Code:
public zp_extra_item_selected(iditemid)
{
    if (
itemid == g_tknife)
    {
        
havetk[id] = 1
        client_print
(idprint_chat"[ZP] You got Thunder Knife! Slash a Zombie to kill him with thunder")
    }

thunder original plugin code by fiendshard
PHP Code:
#include <amxmodx>
#include <engine>
#include <zombieplague>

new havetk[33
new 
g_lightningg_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)"30ZP_TEAM_HUMAN
}
public 
plugin_precache()
{
    
g_lightning precache_model"sprites/lgtning.spr" );
    
g_smoke precache_model"sprites/steam1.spr" );
}

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

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], pos];
        
get_user_originidvorigin );
        
vorigin] -= 26;
        
pos] = vorigin] + 150;
        
pos] = vorigin] + 150;
        
pos] = vorigin] + 800;
        
        {
            if(
zp_get_user_nemesis(id))
            return 
PLUGIN_HANDLED;
        }
        
        
user_kill(id);
        
Thunderposvorigin );
        
Smokevorigin1010 );
        
        
havetk[attacker] = 0
        
return PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;
}
Thunderstart], end] )
{
message_beginMSG_BROADCASTSVC_TEMPENTITY ); 
write_byteTE_BEAMPOINTS ); 
write_coordstart] ); 
write_coordstart] ); 
write_coordstart] ); 
write_coordend] ); 
write_coordend] ); 
write_coordend] ); 
write_shortg_lightning ); 
write_byte);
write_byte);
write_byte);
write_byte150 );
write_byte30 );
write_byte200 ); 
write_byte200 );
write_byte200 );
write_byte200 );
write_byte200 );
message_end();

message_beginMSG_PVSSVC_TEMPENTITYend );
write_byteTE_SPARKS );
write_coordend]  );
write_coordend]);
write_coordend] );
message_end();
}

Smokeiorigin], scaleframerate )
{
message_beginMSG_BROADCASTSVC_TEMPENTITY );
write_byteTE_SMOKE );
write_coordiorigin] );
write_coordiorigin] );
write_coordiorigin] );
write_shortg_smoke );
write_bytescale );
write_byteframerate );
message_end();
}

public 
event_round_start()
{
    static 
imax_players
    
if (!max_playersmax_players get_maxplayers()

    for(
1<= max_playersi++)
        if (
is_user_connected(i)) havetk[i] = 0

Anyone know how to fix it?

Thanks.
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM
rodrigo286 is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 11-16-2011 , 15:29   Re: Thunder, more than 1 use
Reply With Quote #2

After you have set havetk[id] to a higher value, you need to change it to reduce the variable by one.

Currently, it just resets it to 0: havetk[attacker] = 0

But instead you should do: havetk[attacker]--
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 11-16-2011 , 17:25   Re: Thunder, more than 1 use
Reply With Quote #3

It worked perfectly, thank you!

One more doubt please.

I would also put a time of 5 seconds for the player take damage, I tried the way down, but did not work.

PHP Code:
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])
    {    
        {
            if(
zp_get_user_nemesis(id))
            return 
PLUGIN_HANDLED;
        }
        
        
user_kill(id);
        
set_task5.0"explode"id ); 
        
emit_sound(idCHAN_STREAMsound_uhoo1.0ATTN_NORM0PITCH_NORM);
        
        
havetk[attacker]--
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
explode(id)
{
    new 
vorigin], pos];
    
get_user_originidvorigin );
    
vorigin] -= 26;
    
pos] = vorigin] + 150;
    
pos] = vorigin] + 150;
    
pos] = vorigin] + 800;
    
    
Smokevorigin1010 );
    
Thunderposvorigin );
}

Thunderstart], end] )
{
message_beginMSG_BROADCASTSVC_TEMPENTITY ); 
write_byteTE_BEAMPOINTS ); 
write_coordstart] ); 
write_coordstart] ); 
write_coordstart] ); 
write_coordend] ); 
write_coordend] ); 
write_coordend] ); 
write_shortg_lightning ); 
write_byte);
write_byte);
write_byte);
write_byte150 );
write_byte30 );
write_byte200 ); 
write_byte200 );
write_byte200 );
write_byte200 );
write_byte200 );
message_end();

message_beginMSG_PVSSVC_TEMPENTITYend );
write_byteTE_SPARKS );
write_coordend]  );
write_coordend]);
write_coordend] );
message_end();
}

Smokeiorigin], scaleframerate )
{
message_beginMSG_BROADCASTSVC_TEMPENTITY );
write_byteTE_SMOKE );
write_coordiorigin] );
write_coordiorigin] );
write_coordiorigin] );
write_shortg_smoke );
write_bytescale );
write_byteframerate );
message_end();

and i get 1 warning in this line:

PHP Code:
    Smokevorigin1010 ); 
Thanks very much!

#EDIT

I even managed to fix, but I still get warning of loose indentaion.
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM

Last edited by rodrigo286; 11-17-2011 at 05:41.
rodrigo286 is offline
Evaldas.Grigas
Senior Member
Join Date: Sep 2011
Location: Lithuania
Old 11-17-2011 , 09:09   Re: Thunder, more than 1 use
Reply With Quote #4

tools -> indentor
__________________
Please enter this website everyday: http://forums.alliedmods.net/showthread.php?t=169067
Evaldas.Grigas is offline
Send a message via Skype™ to Evaldas.Grigas
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 11-17-2011 , 09:41   Re: Thunder, more than 1 use
Reply With Quote #5

Two fixed and two generated in other lines.

I think it's okay to let the warnings.

Thanks.
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM
rodrigo286 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 17:24.


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