Raised This Month: $ Target: $400
 0% 

remove time and add the level


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 05-25-2009 , 10:04   remove time and add the level
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
// CVAR Pointers
// -------------------------------------------------------------------------------------------------
new CVAR_RADIUSCVAR_JUMPRADIUSCVAR_DAMAGECVAR_COOLDOWN;
// Global Variables
// -------------------------------------------------------------------------------------------------
#define MAXSLOTS 32
new gSpriteLightning
new bool:gHit[33][33];
new 
Floatg_LastLeap[33]
new const 
gMessage[] = "No valid targets!";
new const 
gSound[] = "ambience/steamburst1.wav";
// Initialization
// -------------------------------------------------------------------------------------------------
public plugin_init()
{
    
// Plugin Info
    
register_plugin("xxx""1.0""xxx");
    
    
CVAR_RADIUS register_cvar("shaman_radius""400");
    
CVAR_JUMPRADIUS register_cvar("shaman_jumpradius""400");
    
CVAR_DAMAGE register_cvar("shaman_damage""500");
    
CVAR_COOLDOWN register_cvar("shaman_cooldown""30");
    
register_clcmd("+lightning","lightning"ADMIN_USER"bind ^"key^" ^"+lightning^"")
}
public 
plugin_precache()
{
    
precache_sound(gSound);
    
gSpriteLightning precache_model("sprites/lgtning.spr");
}
// Events and Forwards
// -------------------------------------------------------------------------------------------------
// Custom Functions
// -------------------------------------------------------------------------------------------------
public lightning(id)
{
    if ( !
is_user_alive(id) ) return;
    
    new 
team _:get_user_team(id);
    new 
Float:origin[3], Float:other_origin[3];
    new 
distanceclosest_id idclosest_distance;
    
    static 
Float:Time
    Time 
get_gametime()
    static 
Float:cooldown
    cooldown 
get_pcvar_float(CVAR_COOLDOWN)
    
    new 
first_distance get_pcvar_num(CVAR_RADIUS);
    new 
other_distance get_pcvar_num(CVAR_JUMPRADIUS);
    new 
Float:damage get_pcvar_float(CVAR_DAMAGE)
    
    
pev(idpev_originorigin);
    
    new 
loop_count 0last_id id;
    while ( 
loop_count <= MAXSLOTS )
    {
        if ( !
is_user_alive(closest_id) ) break;
        
        
pev(closest_idpev_originorigin);
        
        if ( 
closest_id == id closest_distance first_distance;
        else 
closest_distance other_distance;
        
        for ( new 
1<= MAXSLOTSi++ )
        {
            if ( !
is_user_alive(i) || == id ) continue;
            if ( 
gHit[id][i] == true ) continue;
            if ( 
_:get_user_team(i) == team ) continue;
            
            
pev(ipev_originother_origin);
            
distance floatround(get_distance_f(originother_origin));
            
            if ( 
distance <= closest_distance )
            {
                
closest_id i;
                
closest_distance distance;
            }
        }
        
        if ( 
closest_id == last_id ) break;
        
gHit[id][closest_id] = true;
        if (
Time cooldown g_LastLeap[id])
        {
        
loop_count++;
        
lightning_effect(last_idclosest_id);
        
emit_sound(last_idCHAN_AUTOgSoundVOL_NORMATTN_NORM0,  PITCH_NORM);
        
ExecuteHam(Ham_TakeDamageclosest_id0iddamage0);
        
client_print(idprint_chat"Wait %i seconds until next fire!"CVAR_COOLDOWN)
        
g_LastLeap[id] = Time
        last_id 
closest_id;
        }
    }
    
    for (new 
0<= MAXSLOTSi++) gHit[id][i] = false;
    
    if ( 
closest_id == id )
    {
        
client_print(idprint_chatgMessage)
        return;
    }
}
public 
lightning_effect(idtarget_id)
{
    if ( !
is_user_alive(id) || !is_user_alive(target_id) ) return;
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_BEAMENTS);
    
write_short(id);            //start entity
    
write_short(target_id);            //end entity
    
write_short(gSpriteLightning);        //sprite index
    
write_byte(0);                //starting frame
    
write_byte(1);                //frame rate in 0.1's
    
write_byte(5);                //life in 0.1's
    
write_byte(25);                //line width in 0.1's
    
write_byte(random_num(2590));        //noise amplitude in 0.1's
    
write_byte(255);            //red
    
write_byte(255);            //green
    
write_byte(255);            //blue
    
write_byte(random_num(100200));    //brightness
    
write_byte(0);                //scroll speed in 0.1's
    
message_end();
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_BEAMENTS);
    
write_short(id);            //start entity
    
write_short(target_id);            //end entity
    
write_short(gSpriteLightning);        //sprite index
    
write_byte(0);                //starting frame
    
write_byte(1);                //frame rate in 0.1's
    
write_byte(5);                //life in 0.1's
    
write_byte(25);                //line width in 0.1's
    
write_byte(random_num(2590));        //noise amplitude in 0.1's
    
write_byte(255);            //red
    
write_byte(255);            //green
    
write_byte(255);            //blue
    
write_byte(random_num(100200));    //brightness
    
write_byte(0);                //scroll speed in 0.1's
    
message_end();
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_BEAMENTS);
    
write_short(id);            //start entity
    
write_short(target_id);            //end entity
    
write_short(gSpriteLightning);        //sprite index
    
write_byte(0);                //starting frame
    
write_byte(1);                //frame rate in 0.1's
    
write_byte(5);                //life in 0.1's
    
write_byte(25);                //line width in 0.1's
    
write_byte(random_num(2590));        //noise amplitude in 0.1's
    
write_byte(255);            //red
    
write_byte(255);            //green
    
write_byte(255);            //blue
    
write_byte(random_num(100200));    //brightness
    
write_byte(0);                //scroll speed in 0.1's
    
message_end();

what i can remove the time ? and make a this example level 5, 6 ?
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-25-2009 , 18:21   Re: remove time and add the level
Reply With Quote #2

YAHOO!! Indented code!!

English Please.
__________________
fysiks is offline
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 05-26-2009 , 06:06   Re: remove time and add the level
Reply With Quote #3

wtf ?
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-26-2009 , 06:14   Re: remove time and add the level
Reply With Quote #4

fysiks is happy to see you do some efforts to indent your code, but now he would like you ask your question in a proper english, at least so we understand what you want.
Arkshine is offline
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 05-26-2009 , 07:08   Re: remove time and add the level
Reply With Quote #5

~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
Dr.G
Senior Member
Join Date: Nov 2008
Old 05-26-2009 , 07:27   Re: remove time and add the level
Reply With Quote #6

Quote:
Originally Posted by ~Ice*shOt View Post
exactly...
__________________
Dr.G 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 01:32.


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