AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Solved] Weird Problem with get_user_aiming() (https://forums.alliedmods.net/showthread.php?t=55505)

regalis 05-23-2007 11:10

[Solved] Weird Problem with get_user_aiming()
 
2 Attachment(s)
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:

regalis 05-24-2007 08:01

Re: Weird Problem with get_user_aiming()
 
Does nobody have an idea where the problem is?
I made the models by myself..is this maybe the cause?
ANY ideas/suggestions/advices/helps/hints/thoughts are appreciated!..0o

Please help me :(

Cheap_Suit 05-24-2007 15:36

Re: Weird Problem with get_user_aiming()
 
1 Attachment(s)
It might be the size problem. Picture shows where the entity is actually located, I also could not get a lock on the entity by aiming at it.


You can use this tool, it is very helpful with entities.

regalis 05-24-2007 17:01

Re: Weird Problem with get_user_aiming()
 
Quote:

Originally Posted by Cheap_Suit (Post 480154)
It might be the size problem. Picture shows where the entity is actually located, I also could not get a lock on the entity by aiming at it.


You can use this tool, it is very helpful with entities.

Thank you very much for your help!
I have found the problem with this nice SHPtools you suggested.
(I had it already but never had time to test its features *lol*)

The following is happen:
If the entity which is located far under the model is in the ground i can't get its ID with get_user_aiming()..

I would like to thank you very much for pointing this out!
greetz regalis


All times are GMT -4. The time now is 10:39.

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