Ok guys I added 3 cvars for your gaming pleasure:
c4bt_take_from_humans [default 0 ]- set to '1' to enable to take C4 from human players
c4bt_max_distance [default 200] - max distance for the take
c4bt_hud [default 5] - number of instances the HUD Message appears. Set to '0' to disable. Can be set to '9999...'.
Now it is possible for it to work with humans.
Use_Button function now looks like this, like JusTGo suggested:
public Use_Button(id) //Function when you press 'E' or the USE key
if(pev(id,pev_button) & IN_USE) //Checks if you pressed the USE key
Take_C4(id); //Calls function to take C4
Added a code when player disconnects resets num to 0 just as Black Rose advised:
public client_disconnect(id) num[id] = 0 //Resets 'num' to 0 when a player disconnects
I studied some codes involving player disconnections. Is it really this simple? Sorry, still a noob.
StatusValue, as far as I know, do not trigger on dead players. The names and health percentages just don't show up.
As for this:
const MaxSlots = 32
get_maxplayers(), unless pHit only returns players, then it's not even necessary to check.
I have no idea as of now...
In light of what Hamlet
has just told me, I will next attempt to replace getLookingAt
in an effort to make the plugin more efficient...
function with native get_user_aiming.