AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Person who is nearest to you... (https://forums.alliedmods.net/showthread.php?t=46733)

stigma 11-01-2006 11:04

Person who is nearest to you...
 
1 Attachment(s)
Code:
#include <amxmodx> #include <engine> new beam public plugin_init() {     register_plugin("Nothing","0.1","idkfa") } public plugin_precache() {     beam = precache_model("sprites/laserbeam.spr") } public client_PreThink(id) {         new aimID     new aimBody     get_user_aiming(id,aimID,aimBody)         if (aimID && get_user_team(aimID) != get_user_team(id)) {         hook_beam(id,aimID)     }     }     public hook_beam(id, aimID) {     message_begin(MSG_BROADCAST,SVC_TEMPENTITY)     write_byte(8) //TE_BEAMENTS     write_short(id)     write_short(aimID)     write_short(beam)     write_byte(0)     write_byte(1)     write_byte(0)     write_byte(25)     write_byte(10)     write_byte(100)     write_byte(100)     write_byte(255)     write_byte(127)     write_byte(0)     message_end() }

How come that it makes a laserbeam just as i spawn, and the beam isent "attached" to a player.. I just attached to the air..

See the attached pic..

Emp` 11-01-2006 13:47

Re: Person who is nearest to you...
 
this is a very bad way of doing this. but you should also check if is_user_alive(aimID)

*note that this won't get the nearest person to you.

jopmako 11-01-2006 14:18

Re: Person who is nearest to you...
 
get_user_aiming ( index, &id, &body, [ distance ] )

must set distance to work like 9999
when i use amxx1.71.

teame06 11-01-2006 14:25

Re: Person who is nearest to you...
 
Code:
native Float:get_user_aiming(index,&id,&body,dist=9999);

The amxmodx.inc supply a default value of 9999 if you don't insert the distance parameter otherwise you can set your own if want.


All times are GMT -4. The time now is 04:50.

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