Raised This Month: $ Target: $400
 0% 

Thunder, need good code.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Screeaam..
Senior Member
Join Date: Jun 2010
Location: Poland
Old 10-09-2010 , 18:58   Thunder, need good code.
Reply With Quote #1

Hello everyone. I have problem with one, small code... I need to make an thunder... If player tap button "E (+use)" on Knife and his crossair will be on the enemy in little area in enemy will hit thunder which takin about 80 dmg. And the cooldown of thunder will be 10 sec. This's my code:


Code:
public MakeThunderBolt(id) 
{
        if (halflife_time()-gravitytimer[id] <= 10)
        {
                 hudmsg(id,2.0,"Thunder can be used in 10 seconds.",gravitytimer[id])
                 return PLUGIN_CONTINUE
        }
     
        gravitytimer[id] = floatround(halflife_time())
        
        new iMakerOrigin[3], Float:iMakeOriginSe[3];
        get_user_origin(id, iMakerOrigin);
        for(new i = 0; i < 3; i++){
                iMakeOriginSe[i] = float(iMakerOrigin[i]);
        }
        
        new entPlayer;
        entPlayer = -1;
        
        while((entPlayer = find_ent_in_sphere(id, iMakeOriginSe, 550.0)) != 0)
        {
                new iVictimOrigin[3];
                get_user_origin(entPlayer, iVictimOrigin);
                change_health(entPlayer, -80, 0, "world");
                CreateBolt(entPlayer, iMakerOrigin, iVictimOrigin);
                g_thunderbolt[id]++;
        }
        return PLUGIN_CONTINUE;
}

CreateBolt(iPlayer, iMaker[3], iVictim[3]) {
        message_begin(MSG_BROADCAST, SVC_TEMPENTITY) 
        write_byte(0) 
        write_coord(iMaker[0]) 
        write_coord(iMaker[1]) 
        write_coord(iMaker[2])
        write_coord(iVictim[0])
        write_coord(iVictim[1])
        write_coord(iVictim[2])
        write_short(light)
        write_byte(1)
        write_byte(5)
        write_byte(2)
        write_byte(20)
        write_byte(30)
        write_byte(255)
        write_byte(255)
        write_byte(255)
        write_byte(200) 
        write_byte(200)
        message_end()
}
PreThink:

Code:
        if (button2 & IN_USE && on_knife[id] && button[id]==0 && piorunek[id]==1){
                  button[id] = 1;
                  MakeThunderBolt(id)
        }
Is it good code? Cause' I can't test it, I haven't server yet. Or gimme good code for it.

It's code for DiabloMod 5.9l SQL.

And sorry for my english.

Last edited by Screeaam..; 10-09-2010 at 19:12.
Screeaam.. is offline
 


Thread Tools
Display Modes

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 10:27.


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