AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_user_aiming doesn't work :( (https://forums.alliedmods.net/showthread.php?t=49315)

hlstriker 01-01-2007 16:51

get_user_aiming doesn't work :(
 
Hi, I am trying to get the player a user is aiming at and display it in a hud message. When I aim at a player nothing shows up though.

Here is the code...
Code:
public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     set_task(1.0, "getAimed", 0, "", 0, "b"); } public getAimed(id) {     if(!is_user_alive(id)) {         return PLUGIN_HANDLED;     }         new ent, body;     get_user_aiming(id, ent, body);         if(is_valid_ent(ent)) {         new classname[50];         entity_get_string(ent,EV_SZ_classname,classname,49);                 if(equal(classname,"player")) {             if(!is_user_alive(ent)) {                 return PLUGIN_HANDLED;             }                     showPlayerHud(id, ent);         }     }         return PLUGIN_CONTINUE; } public showPlayerHud(id, ent) {     new name[50];         get_user_name(ent, name, 49);     set_hudmessage(0, 100, 200, -1.0, 0.35, 0, 4.0, 0.9, 0.1, 0.2, 2);     show_hudmessage(id, "You are looking at %s", name); }

Emp` 01-01-2007 17:04

Re: get_user_aiming doesn't work :(
 
you aren't passing anything into getAimed, so you don't have an id. you should do a for loop for all the alive players.

hlstriker 01-01-2007 17:51

Re: get_user_aiming doesn't work :(
 
Thanks, I got it working :)!


All times are GMT -4. The time now is 22:27.

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