AlliedModders

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

Caldeum 08-17-2012 16:15

Player status
 
Anyone can help? Why doesn't work this?

PHP Code:

#include <amxmodx>
#include <csx>

public PlayerName;
new 
g_status_sync;
new 
g_friend33 ];

public 
plugin_init()
{
    
register_plugin("CS Misc. Stats""0.1""AMXX Dev Team")
    
register_event("StatusValue""setTeam""be""1=1")
    
register_event("StatusValue""showStatus""be""1=2""2!0")
    
register_event("StatusValue""hideStatus""be""1=1""2=0")
    
    
g_status_sync CreateHudSyncObj();
}

public 
setTeam(id)
    
g_friend[id] = read_data(2)

public 
showStatus(id)
{
    if(!
is_user_bot(id) && is_user_connected(id) && PlayerName
    {
        new 
name[32], pid read_data(2)
    
        
get_user_name(pidname31)
        new 
color1 0color2 0
    
        
if (get_user_team(pid) == 1)
            
color1 255
        
else
            
color2 255
        
        
if (g_friend[id] == 1)    // friend
        
{
            new 
clipammowpnid get_user_weapon(pidclipammo)
            new 
wpnname[32]
        
            if (
wpnid)
                
xmod_get_wpnname(wpnidwpnname31)
        
            
set_hudmessage(color150color2, -1.00.6010.013.00.010.01, -1)
            
ShowSyncHudMsg(idg_status_sync"%s -- %d HP / %d AP / %s"nameget_user_health(pid), get_user_armor(pid), wpnname)
        } else {
            
set_hudmessage(color150color2, -1.00.6010.013.00.010.01, -1)
            
ShowSyncHudMsg(idg_status_sync"%s"name)
        }
    }
}

public 
hideStatus(id)
{
    if (
PlayerName)
        
ClearSyncHud(idg_status_sync)



Torge 08-17-2012 16:18

Re: Player status
 
I can compile it fine.

Could you tell us your problems?

Caldeum 08-17-2012 16:37

Re: Player status
 
Doesn't show status in game.

DoviuX 08-18-2012 06:19

Re: Player status
 
What does this function do ?
PHP Code:

public PlayerName

Try this:
PHP Code:

#include <amxmodx>
#include <csx>

new g_status_sync;
new 
g_friend33 ];

public 
plugin_init()
{
    
register_plugin("CS Misc. Stats""0.1""AMXX Dev Team")
    
register_event("StatusValue""setTeam""be""1=1")
    
register_event("StatusValue""showStatus""be""1=2""2!0")
    
register_event("StatusValue""hideStatus""be""1=1""2=0")
    
    
g_status_sync CreateHudSyncObj();
}

public 
setTeam(id)
    
g_friend[id] = read_data(2)

public 
showStatus(id)
{
    if(!
is_user_bot(id) && is_user_connected(id)) 
    {
        new 
name[32], pid read_data(2)
    
        
get_user_name(pidname31)
        new 
color1 0color2 0
    
        
if (get_user_team(pid) == 1)
            
color1 255
        
else
            
color2 255
        
        
if (g_friend[id] == 1)    // friend
        
{
            new 
clipammowpnid get_user_weapon(pidclipammo)
            new 
wpnname[32]
        
            if (
wpnid)
                
xmod_get_wpnname(wpnidwpnname31)
        
            
set_hudmessage(color150color2, -1.00.6010.013.00.010.01, -1)
            
ShowSyncHudMsg(idg_status_sync"%s -- %d HP / %d AP / %s"nameget_user_health(pid), get_user_armor(pid), wpnname)
        } else {
            
set_hudmessage(color150color2, -1.00.6010.013.00.010.01, -1)
            
ShowSyncHudMsg(idg_status_sync"%s"name)
        }
    }
}

public 
hideStatus(id)
    
ClearSyncHud(idg_status_sync); 


OnePL 08-18-2012 23:57

Re: Player status
 
PHP Code:

#include <amxmodx>
#include <csx>

new hudg_friend[33]

public 
plugin_init() {
    
register_plugin("Player Status""1.0""OnePL"
    
    
register_event("StatusValue""set_team""be""1=1")
    
register_event("StatusValue""player_status""be""1=2""2!0")
    
register_event("StatusValue""player_status""be""1=1""2=0")
    
    
hud CreateHudSyncObj()
}

public 
set_team(idg_friend[id] = read_data(2)

public 
player_status(id) {
    new 
type read_data(1)
    switch(
type) {
        case(
1): ClearSyncHud(idhud)
        case(
2): {
            if(
is_user_alive(id)) {
                new 
pid read_data(2)
                new 
nick[32]; get_user_name(pidnick31)
                new 
clipammowpnname[32], wpnid get_user_weapon(pidclipammo)

                if(
wpnidxmod_get_wpnname(wpnidwpnname31)

                
set_hudmessage(25550255, -1.00.6010.013.00.010.01, -1)

                if(
g_friend[id]) ShowSyncHudMsg(idhud"%s -- %d HP / %d AP / %s"nickget_user_health(pid), get_user_armor(pid), wpnname)
                else 
ShowSyncHudMsg(idhud"%s"nick)
            }
        }
    }
    return 
PLUGIN_CONTINUE




All times are GMT -4. The time now is 05:53.

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