Raised This Month: $ Target: $400
 0% 

Thunder, need good code.


Post New Thread Reply   
 
Thread Tools Display Modes
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
SaM.ThE.MaN
Senior Member
Join Date: Jan 2010
Old 10-09-2010 , 19:02   Re: Thunder, need good code.
Reply With Quote #2

test it on ur Counter strike , install Amxmodx on your cs and add your plugin , then new game
__________________
  • Project : Level Plugin
o [||||||||||] - 100%
  • Project : OnePieceMod
o [||||||||||] - 20%
SaM.ThE.MaN is offline
Screeaam..
Senior Member
Join Date: Jun 2010
Location: Poland
Old 10-09-2010 , 19:03   Re: Thunder, need good code.
Reply With Quote #3

Can't test now. I go sleep in 5 minutes, it's 1 a.m. ;/

Can someone tell on first look is it good?
Screeaam.. is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-09-2010 , 20:44   Re: Thunder, need good code.
Reply With Quote #4

Quote:
Originally Posted by Screeaam.. View Post
Can't test now. I go sleep in 5 minutes, it's 1 a.m. ;/

Can someone tell on first look is it good?
Yep, I will tell you. It won't work. Why? Because there is not a complete plugin in that code.
__________________
fysiks is offline
Screeaam..
Senior Member
Join Date: Jun 2010
Location: Poland
Old 10-10-2010 , 05:22   Re: Thunder, need good code.
Reply With Quote #5

So, what is need to be in it to complete it? (it's cut from Diablo)

I know, I don't wrote there variable's it's

new piorunek[33];

And remember, it's code to DiabloMod.

Someone can write good code?

Last edited by Screeaam..; 10-10-2010 at 05:57.
Screeaam.. is offline
Screeaam..
Senior Member
Join Date: Jun 2010
Location: Poland
Old 10-10-2010 , 14:07   Re: Thunder, need good code.
Reply With Quote #6

Can someone give good code? :<

@edit:

New code:

Code:
public item_piorun(id)
{
         if (halflife_time()-gravitytimer[id] <= 10)
         {
                  hudmsg(id,2.0,"Thunder can be used in 10 seconds.")
                  return PLUGIN_CONTINUE
         }
    gravitytimer[id] = floatround(halflife_time())
    
    new targetplayer = UTIL_FindNearestOpponent(id,600)
    
    if (targetplayer == -1) 
        return PLUGIN_HANDLED
    
    new damage = 80+player_intelligence[id]/2
    new Hit2[3]
    get_user_origin(targetplayer, Hit2)
    
    hudmsg(id, 2.0, "You hit %i dmg", damage)

    change_health(targetplayer,-damage,0,"world")
    CreateBolt(Hit2)

    return PLUGIN_CONTINUE;
}

CreateBolt(Hit2[3]) {
        message_begin( MSG_BROADCAST, SVC_TEMPENTITY ) 
        write_byte( 0 ) 
        write_coord( Hit2[ 0 ] ) 
        write_coord( Hit2[ 1 ] ) 
        write_coord( Hit2[ 2 ] + 200)
        write_coord( Hit2[ 0 ] )
        write_coord( Hit2[ 1 ] )
        write_coord( Hit2[ 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( )
}
All is good, but I can use it only once... I need to use it in 10 seconds... How can I make it?

Last edited by Screeaam..; 10-10-2010 at 15:35.
Screeaam.. 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 10:27.


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