AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   radiusrange (https://forums.alliedmods.net/showthread.php?t=54030)

Alka 04-15-2007 15:15

radiusrange
 
1 Attachment(s)
Hi.I have this code...but is not working properly!
1.Not showing Hudmessage to everyone...:|
2.If i'm outside the range with 2 persons ..the Hudmessage "You are Outside the range of %s" is overwriting...
-I want to show something like this "You are Outside the range of "name1","name2","name3""

Thanks...:wink:

[ --<-@ ] Black Rose 04-15-2007 16:09

Re: radiusrange
 
Your code makes no sense at all.
Why would you possibly need this irritating plugin?
"In range" of what? I suggest you stop writing this plugin, no one will download it.

If you still wanna write it...:
Whenever there is one person outside of the range no one inside will se a hudmsg since your second loop wich shouldn't even be there keeps counting until i is equal to num... then the first loop would end too, since i is equal to num.

Edit: Nican, your code is just retarded...

Nican 04-15-2007 16:20

Re: radiusrange
 
D:
he sad
Quote:

-I want to show something like this "You are Outside the range of "name1","name2","name3""
I tried to to show all names in order of distance

I kind went off-course of what he wanted, i know, putting people inside too

Sorry D:

Alka 04-16-2007 02:18

Re: radiusrange
 
Quote:

Originally Posted by [ --<-@ ] Black Rose (Post 465420)
Your code makes no sense at all.
Why would you possibly need this irritating plugin?
"In range" of what? I suggest you stop writing this plugin, no one will download it.

If you still wanna write it...:
Whenever there is one person outside of the range no one inside will se a hudmsg since your second loop wich shouldn't even be there keeps counting until i is equal to num... then the first loop would end too, since i is equal to num.

Edit: Nican, your code is just retarded...

In range of a player...!This is for me not for public posting or....,i want to know when someone is in my range...! But Thanks anyway...BlackRose

Nican:what was your code?...

mysticssjgoku4 04-16-2007 16:56

Re: radiusrange
 
I dunno if this is what u wanted, but it tells you only who you are in range with.

Code:
#include <amxmodx> #include <amxmisc> #include <engine> #include <fakemeta> #define PLUGIN "RadiusRange Announce" #define VERSION "1.0" #define AUTHOR "Remo Williams" #define DIST 1000.0 new or_id[32][3], or_ta[32][3], or_dist[32] new g_entid[32], g_entbody[32] new Float:s_origin[32][3] new g_hud_str[32][512] new g_hud_head[] = "You are in range of: "; new g_name[32][32] public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR) } public bool:is_player_in_range(id,tid) //IS "id" in range of "tid"? {     if(!is_user_alive(tid) || !is_user_connected(tid)) return false;         get_user_origin(id, or_id[id]);     get_user_origin(tid,or_ta[id]);     or_dist[id] = get_distance(or_id[id],or_ta[id])         if(or_dist[id] < DIST) return false;     return true; } public client_authorized(id) {     reset_data(id)     set_task(1.0,"com",id,_,_,"b") } public client_disconnect(id) {     reset_data(id) } reset_data(id) {     or_id[id][0] = 0     or_ta[id][0] = 0     or_dist[id] = 0     g_entid[id] = 0     g_entbody[id] = 0     g_hud_str[id][0] = 0     g_name[id][0] = 0     s_origin[id][0] = 0.0 } public com(id) {     new ent = 0, total = 0     pev(id,pev_origin,s_origin[id])         set_hudmessage(50,50,255, 0.02, 0.84, 1, 6.0, 2.0,0.1,0.2,-1);     new len = format(g_hud_str[id],511,"%s^n",g_hud_head)     while( (ent = find_ent_in_sphere(ent,s_origin[id],DIST)) != 0)     {         if(is_player_in_range(id,ent) && id != ent)         {             get_user_name(ent,g_name[ent],31)             len += format(g_hud_str[id][len],511-len,"%s^n",g_name[ent])             total++;         }     }     if(total > 0)     {         show_hudmessage(id,g_hud_str[id]);     }     return PLUGIN_HANDLED }

Nican 04-16-2007 17:18

Re: radiusrange
 
eh... I did this:
PHP Code:

showplayers(id){
    new 
iplayer[32][2],count
    
    
for(i=1;i<=get_maxplayers();i++){
        if(!
is_user_connected(id))
            continue;
        if(!
is_user_alive(id))
            continue;
        
        
player[count][0] = i
        player
[count][1] = get_entity_distance(id,i)
        
count++
    }    
    
    
SortCustom2D(player,count,"stats_custom_compare")
    
    new 
message[480],pos,hasgonefar=0
    pos 
+= format(message[pos],480 pos,"Inside:^n")
    for(new 
i=0;i<=count-1;i++){
        new 
name[32]
        
get_user_name(player[count][0],name,32)
        
pos += format(message[pos],480 pos,"  %s^n"name)
        
        if(
player[count][1] > 1000 && hasgonefar == 0){
            
pos += format(message[pos],480 pos,"^nOutside:^n")
            
hasgonefar 1
        
}    
    }
    
set_hudmessage(255000.010.1506.012.00.00.03)
    
show_hudmessage(idmessage)
}

public 
stats_custom_compare(elem1[],elem2[])
{
    if(
elem1[1] > elem2[1]) return -1;
    else if(
elem1[1] < elem2[1]) return 1;
    return 
0;




All times are GMT -4. The time now is 06:44.

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