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

[SOLVED :)] Explosions !


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zaidbt
Senior Member
Join Date: Jun 2014
Location: Morroco
Old 05-08-2015 , 15:49   [SOLVED :)] Explosions !
Reply With Quote #1

Hey again x)

I'm Trying To Make A Plugin , That do the next :
- when a specific player Tape /Explode , He Set instant Damage on Every one near to Him in like 2m ( like a bomb Explosion ) ..
Could That be Even Possible ?

Ps : I don't know ho to begin , so i can't even try something x)
Ty
__________________
http://steamcommunity.com/profiles/76561198044821965
=========Working On Naruto Mod========
Zaidbt is offline
FromTheFuture
Senior Member
Join Date: Jan 2013
Old 05-08-2015 , 16:16   Re: Explosions !
Reply With Quote #2

I think better way to make it is - Create entity, set him size (radius), attach it to player and hook the "touch" another player to this ent, then call Ham_TakeDamage.
FromTheFuture is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 05-08-2015 , 16:26   Re: Explosions !
Reply With Quote #3

the way I would do it is get the origin of every player on the server and compare them to the exploding guy



but then again that's probably terrible
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 05-08-2015 , 17:12   Re: Explosions !
Reply With Quote #4

I would use find_sphere_class.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Zaidbt
Senior Member
Join Date: Jun 2014
Location: Morroco
Old 05-08-2015 , 17:55   Re: Explosions !
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>

new g_Classname[] = "Explosion"
new g_Model[] = "sprites/explosion.spr"

public plugin_init()
{
    
register_plugin("Explosion","Zaid","1.0")
   
    
register_clcmd("say Explode","Explosion")
   
    
register_touch(g_Classname,"player","TouchExpl")
}

public 
plugin_precache()
    
precache_model(g_Model)

public 
Explosion(id)
{
    new 
Ent create_entity("info_target")
    
entity_set_string(Ent,EV_SZ_classname,g_Classname)
    
entity_set_model(Ent,g_Model)
    
entity_set_int(Ent,EV_INT_solid,SOLID_TRIGGER// Why this ?
    
entity_set_size(Ent,Float:{-50.0,-50.0,-50.0},Float:{50.0,50.0,50.0})
    
entity_set_edict(Ent,EV_ENT_owner,id
}

public 
TouchExpl(Ptd,Ptr)
{
    new 
Owner entity_get_edict(Ptd,EV_ENT_owner)
    if(
Owner != Ptr)
        return
   
    
client_print(Ptr,print_chat,"why this xD")

Ok , Creating Entity done ; Size Done , Model Done , But the touch .. i Don't get That part Exactly .
Could Some one explain Please ? , And what's next

Quote:
Originally Posted by wickedd View Post
I would use find_sphere_class.
PHP Code:
native find_sphere_class(aroundent, const _lookforclassname[], Float:radiusentlist[], maxents, const Float:origin[3] = {0.00.00.0}); 
How to edit this one ?
__________________
http://steamcommunity.com/profiles/76561198044821965
=========Working On Naruto Mod========

Last edited by Zaidbt; 05-08-2015 at 18:28.
Zaidbt is offline
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 05-08-2015 , 18:43   Re: Explosions !
Reply With Quote #6

Quote:
Originally Posted by aron9forever View Post
the way I would do it is get the origin of every player on the server and compare them to the exploding guy



but then again that's probably terrible
No, it's not terrible, it's used since decade in superhero mod. it's probably one of the best way and it's probably faster that all those sphere native.
Fr33m@n is offline
FromTheFuture
Senior Member
Join Date: Jan 2013
Old 05-08-2015 , 18:44   Re: Explosions !
Reply With Quote #7

For the touch you also need to attach entity to player.
PHP Code:
entity_set_intiEntityEV_INT_movetypeMOVETYPE_FOLLOW );
entity_set_edictiEntityEV_ENT_aimentid ); 
Fastest way (for coding) is use find_ent_in_sphere, but u need do it every frame, so this use a many cpu.
FromTheFuture is offline
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 05-08-2015 , 18:48   Re: Explosions !
Reply With Quote #8

you better look at how superhero mod did for their kamikaze hero (the blow_up part). Of course there is SH specific code but many things can be ported.
Attached Files
File Type: sma Get Plugin or Get Source (sh_kamikaze.sma - 524 views - 8.1 KB)

Last edited by Fr33m@n; 05-08-2015 at 18:49.
Fr33m@n is offline
Zaidbt
Senior Member
Join Date: Jun 2014
Location: Morroco
Old 05-08-2015 , 19:47   Re: Explosions !
Reply With Quote #9

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <hamsandwich>
new g_Classname[] = "Explosion"


public plugin_init()
{
    
register_plugin("Explosion","Zaid","1.0")
   
    
register_clcmd("say Explode","Explosion")
   
    
register_touch(g_Classname,"player","TouchExpl")
}

public 
plugin_precache()
precache_model("sprites/explosion.spr")

public 
Explosion(id)
{
    new 
Ent create_entity("info_target")
    
entity_set_string(Ent,EV_SZ_classname,g_Classname)
    
entity_set_model(Ent"sprites/explosion.spr")
    
entity_set_int(Ent,EV_INT_solid,SOLID_TRIGGER// Why this ?
    
entity_set_size(EntFloat:{-25.0, -25.0, -25.0}, Float:{25.025.025.0})
    
entity_set_edict(Ent,EV_ENT_owner,id
    
set_rendering(EntkRenderFxNoDissipation0,0,0kRenderGlow255);
    
entity_set_intEntEV_INT_movetypeMOVETYPE_FOLLOW ); 
    
entity_set_edictEntEV_ENT_aimentid );  
    

}

public 
TouchExpl(Ptd,Ptr,player1,player2)
{
    new 
Owner entity_get_edict(Ptd,EV_ENT_owner)
    if(
Owner != Ptr)
        return
    
new 
Float:origin[3];
entity_get_vector(player1EV_VEC_originorigin);
        
    new 
player2 = -1;
    
   while((
player2 find_ent_in_sphere(player2origin100)) != 0)
{
    if(!
is_user_connected(player2)) continue;
    if(!
is_user_alive(player2)) continue;

    
    
ExecuteHam(Ham_TakeDamageplayer10player2300);
}

Lol ... ? what's wrong here

Last edited by Zaidbt; 05-08-2015 at 20:47.
Zaidbt is offline
FromTheFuture
Senior Member
Join Date: Jan 2013
Old 05-08-2015 , 21:31   Re: Explosions !
Reply With Quote #10

Oh my god, you mixed all.
Okay, forget about touch, just make with find_ent_in_sphere - google it and you see some examples.
FromTheFuture 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 09:40.


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