Raised This Month: $ Target: $400
 0% 

Block Radio Command [SOLVED] | Create entity in front of Player [SOLVED]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Grinf4ce
Senior Member
Join Date: May 2006
Old 07-19-2008 , 16:29   Block Radio Command [SOLVED] | Create entity in front of Player [SOLVED]
Reply With Quote #1

Hello everyone,
How i can create an entity in front of the player?

(EXAMPLE) Like TeamFortress Classic:
If someone press drop a backpack, it will throw in front of the player.
How i can realize that?

- Grinf4ce
__________________

Last edited by Grinf4ce; 07-19-2008 at 16:31.
Grinf4ce is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 07-19-2008 , 20:55   Re: Create entity in front of Player
Reply With Quote #2

Actually, I'm in need of this two.
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
hzqst
Senior Member
Join Date: Jul 2008
Old 07-19-2008 , 22:10   from bazooka(rpg) plugin
Reply With Quote #3

Quote:
new NUKERPG = create_entity("info_target")
new Float:Origin[3], Float:Angle[3]
get_user_origin(id,origin) entity_set_string(NUKERPG, EV_SZ_classname, "hahahanuke")
entity_set_model(NUKERPG, "models/rpgrocket.mdl")
entity_set_origin(NUKERPG, origin)
entity_get_vector(id, EV_VEC_v_angle, Angle)// ←return the angle(player)
entity_set_vector(NUKERPG, EV_VEC_angles, Angle)//set the angle of this entity

new Float:MinBox[3] = {-1.0, -1.0, -1.0}
new Float:MaxBox[3] = {1.0, 1.0, 1.0}
entity_set_vector(NUKERPG, EV_VEC_mins, MinBox)
entity_set_vector(NUKERPG, EV_VEC_maxs, MaxBox)
entity_set_int(NUKERPG, EV_INT_solid, 1)
entity_set_int(NUKERPG, EV_INT_movetype, 6)
new vec[3]
new Float:force = Float(999)
VelocityByAim(id, force, Vec) // important
entity_set_vector(NUKERPG, EV_VEC_velocity, Vec) // throw

Last edited by hzqst; 07-19-2008 at 22:29.
hzqst is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 07-20-2008 , 01:51   Re: Create entity in front of Player
Reply With Quote #4

Code:
    new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString,"info_target"))
    if(!ent)
        return
    
    set_pev(ent,pev_classname, "env_whatever")
    
    new Float:vOrigin[3],Float:vAngles[3],Float:vAngleVector[3]
    pev(id,pev_origin,vOrigin)
    pev(id,pev_v_angle,vAngles)
    angle_vector(vAngles,1,vAngleVector)
    
    for(new i=0;i < 3;i++)
        // This will put the entity 50 units in front of the player's view angle
        fOrigin[i] += (vAngleVector[i] * 50)
        
    dllfunc(DLLFunc_Spawn,ent)
danielkza is offline
Grinf4ce
Senior Member
Join Date: May 2006
Old 07-20-2008 , 01:53   Re: Create entity in front of Player
Reply With Quote #5

Oh new code..
i will try it @ danielkza

EDIT::
Hmm.. Doesnt work, because the back flow in the sky or very far of me away.. to the next wall.. :-(
It should drop in front of my feets :-/

Please help
__________________

Last edited by Grinf4ce; 07-20-2008 at 02:04.
Grinf4ce is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-20-2008 , 03:41   Re: Create entity in front of Player
Reply With Quote #6

Take a look in this plugin http://forums.alliedmods.net/showthread.php?p=19610
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Grinf4ce
Senior Member
Join Date: May 2006
Old 07-20-2008 , 04:57   Re: Create entity in front of Player
Reply With Quote #7

Hello Alka,
i taked a look in the plugin and created the function which drop a entity in front of me.

PHP Code:
new g_Classname[] = "func_backpack"
new g_Model[] = "models/tfm/backpack.mdl"

public drop_backpack(id) {
    new 
FloatOrigin[3], FloatVelocity[3]
    
entity_get_vector(idEV_VEC_originOrigin)

    new 
backpackdrop create_entity("info_target")
    if(!
backpackdrop) return

    
entity_set_string(backpackdropEV_SZ_classnameg_Classname)
    
entity_set_model(backpackdropg_Model)

    new 
Float:MinBox[3] = {-1.0, -1.0, -1.0}
    new 
Float:MaxBox[3] = {1.01.01.0}
    
entity_set_vector(backpackdropEV_VEC_minsMinBox)
    
entity_set_vector(backpackdropEV_VEC_maxsMaxBox)

    
entity_set_origin(backpackdropOrigin)

    
entity_set_int(backpackdropEV_INT_effects32)
    
entity_set_int(backpackdropEV_INT_solid1)
    
entity_set_int(backpackdropEV_INT_movetype6)
    
entity_set_edict(backpackdropEV_ENT_ownerid)

    
VelocityByAim(id400 Velocity)
    
entity_set_vector(backpackdropEV_VEC_velocity ,Velocity)

I tryed to "touch" the entity, but nothing happens..:
PHP Code:
public plugin_init() {
    
register_touch("player","*","hook_touch");
}

public 
hook_touch(pToucherpTouched) {
    if ( !
is_valid_ent(pToucher) ) return

    new 
Classname[32]
    
entity_get_string(pToucherEV_SZ_classnameClassname31)
    new 
Float:kOrigin[3]
    
entity_get_vector(pToucherEV_VEC_originkOrigin)

    if(
equal(Classname,g_Classname)) 
    {
        if ( !
is_valid_ent(pTouched) ) return
        
        
// Aufgehoben
        
client_print(pTouched,print_chat,"[TEST] You touched the entity dude..")
        
remove_entity(pToucher)
    }

Whats wrong? :-S
Please help me :-/

- Grinf4ce
__________________
Grinf4ce is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 07-20-2008 , 05:08   Re: Create entity in front of Player
Reply With Quote #8

Quote:
Originally Posted by Grinf4ce View Post
Oh new code..
i will try it @ danielkza

EDIT::
Hmm.. Doesnt work, because the back flow in the sky or very far of me away.. to the next wall.. :-(
It should drop in front of my feets :-/

Please help
Try changing the 50 in the code to a small number,like 1 or 2.
danielkza is offline
Grinf4ce
Senior Member
Join Date: May 2006
Old 07-20-2008 , 17:32   Re: Block Radio Commands [OPEN] | Create entity in front of Player [SOLVED]
Reply With Quote #9

Thank you I created a script to drop a entity infront of me and pick it up

But i have a new question:
How i can block radio command "Fire in the hole" when i throw a grenade? I would block the sound and the message, but how? :S

Can someone help me please?

- Grinf4ce
__________________
Grinf4ce is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 07-20-2008 , 18:46   Re: Block Radio Command [OPEN] | Create entity in front of Player [SOLVED]
Reply With Quote #10

http://forums.alliedmods.net/showthread.php?t=29293
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 05:29.


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