AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What happened with Show Target Plugin? (https://forums.alliedmods.net/showthread.php?t=220418)

yl2401 07-10-2013 12:16

What happened with Show Target Plugin?
 
What happened? Thank You!

Error Message:
Quote:

L 07/09/2013 - 15:49:46: [CSTRIKE] Player out of range (0)
L 07/09/2013 - 15:49:46: [AMXX] Run time error 10 (plugin "show_target.amxx") (native "cs_get_user_team") - debug not enabled!
L 07/09/2013 - 15:49:46: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
My Sma:
PHP Code:

#include <amxmodx>
#include <cstrike>

#define PLUGIN_NAME    "Show Target Info"
#define PLUGIN_VERSION    "1.0"
#define PLUGIN_AUTHOR    "yl2401"

new show[4], dc[4]

public 
plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
}

public 
client_connect(id)
{
    
dc[id] = 0
    show
[id] = 1
    ShowHUD
(id)
}

public 
client_disconnect(id)
{
    
show[id] = 0
    dc
[id] = 1
}

public 
ShowHUD(id)
{
    if( 
show[id] && is_user_connected(id) && is_user_alive(id) && !is_user_bot(id) )
    {
        new 
entaimname[32]
        
get_user_aiming(identaim)
        
get_user_name(entnamecharsmax(name))
        if( 
cs_get_user_team(id) == cs_get_user_team(ent) )
        {
            if( 
cs_get_user_team(ent) == CS_TEAM_T )
            {
                
set_hudmessage(25500, -1.00.5311.00.00.10.23)
                
show_hudmessage(id"[Friend]%s - HP: %d / AP: %d"nameget_user_health(ent), get_user_armor(ent))
            }
            else if( 
cs_get_user_team(ent) == CS_TEAM_CT )
            {
                
set_hudmessage(00255, -1.00.5311.00.00.10.23)
                
show_hudmessage(id"[Friend]%s - HP: %d / AP: %d"nameget_user_health(ent), get_user_armor(ent))
            }
            else if( 
cs_get_user_team(ent) == CS_TEAM_SPECTATOR )
            {
                
set_hudmessage(100100100, -1.00.5311.00.00.10.23)
                
show_hudmessage(id"[Friend]%s - HP: %d / AP: %d"nameget_user_health(ent), get_user_armor(ent))
            }
        }
        else
        {
            if( 
cs_get_user_team(ent) == CS_TEAM_T )
            {
                
set_hudmessage(25500, -1.00.5311.00.00.10.23)
                
show_hudmessage(id"[Enemy]%s - HP: %d / AP: %d"nameget_user_health(ent), get_user_armor(ent))
            }
            else if( 
cs_get_user_team(ent) == CS_TEAM_CT )
            {
                
set_hudmessage(00255, -1.00.5311.00.00.10.23)
                
show_hudmessage(id"[Enemy]%s - HP: %d / AP: %d"nameget_user_health(ent), get_user_armor(ent))
            }
            else if( 
cs_get_user_team(ent) == CS_TEAM_SPECTATOR )
            {
                
set_hudmessage(100100100, -1.00.5311.00.00.10.23)
                
show_hudmessage(id"[SPEC]%s - HP: %d / AP: %d"nameget_user_health(ent), get_user_armor(ent))
            }
        }
    }
    else if(
dc[id]) { }
    else
        
set_task(0.1"ShowHUD"id)



Sylwester 07-10-2013 12:40

Re: What happened with Show Target Plugin?
 
After you use get_user_aiming, you need to check if ent is connected player.
This plugin is badly coded. If you just need "show target info" then it already exists in miscstats or you can get my version here.

yl2401 07-12-2013 01:28

Re: What happened with Show Target Plugin?
 
Quote:

Originally Posted by Sylwester (Post 1987763)
After you use get_user_aiming, you need to check if ent is connected player.
This plugin is badly coded. If you just need "show target info" then it already exists in miscstats or you can get my version here.

Oh, Thank You.


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

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