This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Properly emulate weapon drop


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 03-31-2020 , 00:05   Properly emulate weapon drop
Reply With Quote #1

Hello, I want to emulate a "weaponbox" drop, (like when you press the G key when holding a weapon) using a particular item.

I tried to emulate the drop function in HLSDK but I'm not good with vectors.

This is the code I tried so far.

Code:
public drop_jp(id) {     if(g_bHasJP[id])     {         if(pev_valid(g_iWClientJP[id]))             engfunc(EngFunc_RemoveEntity, g_iWClientJP[id]);         new Float:fOrigin[3], Float:fNewOrigin[3];         new jp = create_entity("item_security");         pev(id, pev_origin, fOrigin);         global_get(glb_v_forward, fNewOrigin);         xs_vec_mul_scalar(fNewOrigin, 300.0, fNewOrigin);         xs_vec_add(fOrigin, fNewOrigin, fOrigin);         set_pev(jp, pev_origin, fOrigin);         set_pev(jp, pev_velocity, fNewOrigin)         convertToJetpack(jp)         //DispatchKeyValue(jp, "spawnflags", "384");         DispatchSpawn(jp);     }         g_bHasJP[id] = false;     return PLUGIN_HANDLED; }

It works, but the item just pops out near player instead of dropping it like a normal weapon.

How can I achieve this?
__________________

Last edited by gabuch2; 03-31-2020 at 00:05.
gabuch2 is offline
 



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 02:40.


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