| closedsandbag deploying fix |
| Started by diamond-optic on 02-03-2009, 10:42 PM |
Threads: 103
Joined: May 2005
i feel kinda wierd posting a request, but i really dont have the time to do it myself...nnanyway i hate it how you can deploy an mg when theres a sandbag behind you.. like so youre not facing the sandbag and the mg is 'propped' up on the air.. fucking annoying as hell lolnn..someone fix this shit!
Threads: 75
Joined: Nov 2007
lol well i really not sure that ive seen this, only some bots doing it... but thats bots... So should it be something like only when u touch the dod_trigger_sandbag entity u can deploy it? rnrnsomething like this. Warning really fast written and not tested!rnrn
////////////////////////////////////////////////////////////////////////////////////////////////////rn//rn#include <amxmisc>rn#include <amxmodx>rn#include <dodx>rn#include <fakemeta>rnrn////////////////////////////////////////////////////////////////////////////////////////////////////rn//rn#define PLUGIN "DoD Deploy Fix"rn#define VERSION "1.0 by Dr.G - www.clan-go.net"rn#define AUTHOR "Dr.G"rnrn////////////////////////////////////////////////////////////////////////////////////////////////////rn//rnnew p_onrn////////////////////////////////////////////////////////////////////////////////////////////////////rn//rnpublic plugin_init()rn{rn register_plugin("dod_deploy_fix",VERSION, AUTHOR)rn register_cvar("dod_deploy_fix", VERSION, FCVAR_SERVER|FCVAR_SPONLY)rn rn register_forward(FM_Touch,"hook_touch")rn p_on = register_cvar("dod_deploy_fix","1") // Plugin On | Offrn}rn////////////////////////////////////////////////////////////////////////////////////////////////////rn//rnpublic hook_touch(ptr,id)rn{rn if(get_pcvar_num(p_on) && is_user_connected(id) && is_user_alive(id))rn {rn new button = pev(id,pev_button) rn rn static stClassName[32]rn pev(ptr, pev_classname, stClassName, sizeof stClassName - 1)rn rn if(!equali(stClassName, "dod_trigger_sandbag") && !deployable_weapon(id) && !dod_get_pronestate(id) == 1)rn if(button & IN_ATTACK2) rn set_pev(id,pev_button,button & ~IN_ATTACK2)rn rn if(equali(stClassName, "dod_trigger_sandbag") && deployable_weapon(id))rn rn ///client_print(id,print_center,"****TESTING****")rn return FMRES_IGNOREDrn rn }rn return FMRES_IGNOREDrn}rn////////////////////////////////////////////////////////////////////////////////////////////////////rn// Stock by Wilson [29th ID] ???rnstock deployable_weapon(id) rn{ rn new clip, ammo, rn wpn = get_user_weapon(id, clip, ammo) rn if( wpn == DODW_BAR rn || wpn == DODW_BAR rn || wpn == DODW_FG42 rn || wpn == DODW_BREN rn || wpn == DODC_30CALrn || wpn == DODC_MG34rn || wpn == DODW_MG42) rn return 1 rn return 0rn}rnrnWell this is really odd cuz if its not more then this you would have made faster then me and this took me 10 - 15 min...Threads: 103
Joined: May 2005
i havent tried that, but i think thats exactly what the problem is, even tho youre not facing the sandbags youre still touching the sandbag trigger entity which allows you to still deploy, facing the wrong way...nnni have some time tonight i think since im sick and not going out so maybe ill mess with some stuff after all
Threads: 75
Joined: Nov 2007
ok i thought it was when u were touching the sandbags it had some kinda bug, then my code is useless lol, i still cant see it tho, ive only seen sometimes kinda on top of a sandbag, but not when its behind you... however if u see the dod_trigger_sandbag entitys in BSP viewer they are quite small boxes. rnrnSo would it be something like removing all dod_trigger_sandbag entitys and the make it deployable when u touch the sandbag model... but again that will have a bad effect on some maps like kalt e.g.
Threads: 24
Joined: Oct 2006
Its not ONLY when you touch it. You MUST be facing the correct angle also. The reason if fails is because the game only checks the player/sandbag angle relationship every 1 second. If during that 1 second, the player quickly turns and then deploys before the next angle check, he will be allowed to deploy.rnrnSome info...rnThere's 2 parameters ("angles" and "sandbag_range") in the dod_trigger_sandbag entity that work together to check if the player is facing the proper angle. If the player's y-axis angle is within the range of "angles" (y-axis) +/- the "sandbag_range", the player's vuser1[0] pev is set to 1.0 (normally 0.0). After being set to 1.0, the player is allowed to deploy on the sandbag entity. When deployed on a sandbag entity, vuser1[0] is set to 2.0.rnrnThe cure...rnAlas I, like D-O, don't currently have the time to work on this. But I'd suggest using HAM_touch on the dod_trigger_sandbag entity, then check the player's angle against the entity's parameters, then set/reset the player's vuser1 pev.
Threads: 24
Joined: Oct 2006
I got some time and wrote a fix. Seems to work OK. It was an interesting poroject.

