Raised This Month: $ Target: $400
 0% 

[Solved] Weird Problem with get_user_aiming()


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 05-23-2007 , 11:10   [Solved] Weird Problem with get_user_aiming()
Reply With Quote #1

Hi, i have a big problem with get_user_aiming()!
if i aim at an entity which i have created i get sometimes a valid entityID and sometimes just 0 as the ID.
I have noticed that if the entity is on a certain wall in the map i get the ID and on another wall i get 0
I would realy appreciate if someone could point me in the right direction and/or help me to solve my problem.
(Full code is also attached)

With this code i create an entity:
Code:
public entcreate()
{        
    g_entity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
    engfunc(EngFunc_SetModel, g_entity, g_models[g_curmodeltype]);
    
    if(g_curmodeltype == 0) set_pev(g_entity, pev_classname, MEDKITCLASS);
    else set_pev(g_entity, pev_classname, RECHARGECLASS);
    
    set_pev(g_entity, pev_controller_0, 125);
    set_pev(g_entity, pev_controller_1, 125);
    set_pev(g_entity, pev_controller_2, 125);
    set_pev(g_entity, pev_controller_3, 125);
    
    new Float:mins[3] = {-10.0, -10.0, -10.0};
    new Float:maxs[3] = {10.0, 10.0, 10.0};
    engfunc(EngFunc_SetSize, g_entity, mins, maxs);
    
    set_pev(g_entity, pev_solid, 2);
    
    setGlow(g_entity);
}
And with that i get the ID from the entity i aim at:

Code:
public del_station(id)
{
    
    new body, index;
    if(get_user_aiming(id, index, body) == 0.0) return PLUGIN_HANDLED_MAIN;
    
    log_amx("deleting initiated index: %d", index);
    
    return PLUGIN_CONTINUE;
}
This is the Console output..for 3 different Entities...
As you see 2 of them return their ID (on the wall behind the Terror-spawn on dust2) and from 1 entity i get the ID 0 (on a different wall...) :

Quote:
L 05/23/2007 - 15:11:15: [HA-Stations_v0.3.amxx] deleting initiated index: 111
L 05/23/2007 - 15:11:17: [HA-Stations_v0.3.amxx] deleting initiated index: 0
L 05/23/2007 - 15:11:18: [HA-Stations_v0.3.amxx] deleting initiated index: 110
Thanks for looking into this!
greetz regalis

And here is the full code:
Attached Files
File Type: sma Get Plugin or Get Source (HA-Stations_v0.3.sma - 744 views - 42.4 KB)
__________________

Last edited by regalis; 05-24-2007 at 17:02. Reason: removed irrelevant code..
regalis is offline
 


Thread Tools
Display Modes

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:39.


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