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

Distance between dropped c4


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
faki
Senior Member
Join Date: Jul 2013
Old 09-01-2013 , 02:03   Distance between dropped c4
Reply With Quote #1

I need to show with HUD with meters to CT/T distance between him and dropped c4.
Please, help me.
faki is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-01-2013 , 08:23   Re: Distance between dropped c4
Reply With Quote #2

I think this should work. I haven't tried getting killed with the bomb though.
Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich> #define INTERVAL    0.1 #define CHANNEL  3 new g_C4ent; new g_fwdThink; public plugin_init() {     register_plugin("Test Plugin 7", "", "");     register_forward(FM_SetModel, "fwd_SetModel", 1);     RegisterHam(Ham_AddPlayerItem, "player", "fwd_AddPlayerItem"); } public fwd_SetModel(ent, const model[]) {     if ( ! equal(model, "models/w_backpack.mdl") )         return         new classname[10];     pev(ent, pev_classname, classname, charsmax(classname));         if ( equal(classname, "weapon_c4" ) )         return;         g_C4ent = ent;     g_fwdThink = register_forward(FM_Think, "fwd_Think", 1);     set_pev(ent, pev_nextthink, get_gametime() + INTERVAL); } public fwd_AddPlayerItem(player, item) {     if ( pev(item, pev_owner) != g_C4ent )         return;         unregister_forward(FM_Think, g_fwdThink, 1); } public fwd_Think(ent) {     if ( ent != g_C4ent )         return;         new Float:plOrigin[3], Float:entOrigin[3], Float:distance;     pev(ent, pev_origin, entOrigin);         set_hudmessage(_, _, _, _, 0.25, _, _, INTERVAL, 0.0, 0.05, CHANNEL);         new players[32], playersnum;     get_players(players, playersnum, "ach");         for ( new i = 0 ; i < playersnum ; i++ ) {         pev(players[i], pev_origin, plOrigin);         distance = get_distance_f(entOrigin, plOrigin);         show_hudmessage(players[i], "Distance to c4: %dm", floatround(distance / 32));     }         set_pev(ent, pev_nextthink, get_gametime() + INTERVAL); }
__________________
Black Rose is offline
lqlqlq
Senior Member
Join Date: Jan 2008
Old 09-30-2013 , 09:50   Re: Distance between dropped c4
Reply With Quote #3

not working correctly i get this error when drop c4 (and its gone):
Code:
L 09/30/2013 - 16:48:07: [FAKEMETA] Invalid entity
L 09/30/2013 - 16:48:07: [AMXX] Run time error 10 (plugin "c4_distance.amxx") (native "pev") - debug not enabled!
L 09/30/2013 - 16:48:07: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
with debug:
Code:
L 09/30/2013 - 16:50:01: [FAKEMETA] Invalid entity
L 09/30/2013 - 16:50:01: [AMXX] Displaying debug trace (plugin "c4_distance.amxx")
L 09/30/2013 - 16:50:01: [AMXX] Run time error 10: native error (native "pev")
L 09/30/2013 - 16:50:01: [AMXX]    [0] c4_distance.sma::fwd_Think (line 44)
lqlqlq is offline
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 09-30-2013 , 11:46   Re: Distance between dropped c4
Reply With Quote #4

Check is pev valid
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
lqlqlq
Senior Member
Join Date: Jan 2008
Old 09-30-2013 , 12:09   Re: Distance between dropped c4
Reply With Quote #5

please do it for me
lqlqlq is offline
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 09-30-2013 , 12:58   Re: Distance between dropped c4
Reply With Quote #6

PHP Code:
if (!pev_valid(ent))
    return 
Add this in top of fwd think, should fix it

Last edited by ~Ice*shOt; 09-30-2013 at 12:58.
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
lqlqlq
Senior Member
Join Date: Jan 2008
Old 09-30-2013 , 13:52   Re: Distance between dropped c4
Reply With Quote #7

Error now is gone but c4 disappear after drop it....
lqlqlq is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-30-2013 , 15:03   Re: Distance between dropped c4
Reply With Quote #8

The only thing this plugin does is updating nextthink for the entity. I did not have any problems with disappearing c4 when I tested it.
You probably have some other plugin that is deleting the c4.
Disable all other plugins to make sure.
__________________
Black Rose is offline
lqlqlq
Senior Member
Join Date: Jan 2008
Old 10-03-2013 , 10:39   Re: Distance between dropped c4
Reply With Quote #9

No, please test the plugin.
Anyone who can make the plugin ?
lqlqlq is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 10-03-2013 , 11:02   Re: Distance between dropped c4
Reply With Quote #10

I can't reproduce the problem.

Write this in console:
amxx plugins
and post the result.
__________________
Black Rose 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 02:29.


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