AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   If player dead show him a hud message about the player info of he looking. (https://forums.alliedmods.net/showthread.php?t=135643)

GarbageBox 08-18-2010 05:59

If player dead show him a hud message about the player info of he looking.
 
Check if the player still alive, if yes then hide the hud message and if dead, show the hud messgae.
I try to use is_user_alive, but I don`t know what I should put in {}.
Secondly, my intention is to show the player info who the dead player looking, but now this code is show the info about myself.
Can someone help me with this two question?
Code:

public DHM(id)
{
//        if (is_user_alive(id))
//        {
//               
//        }
        for (new id = 1; id <= SzMaxPlayers; id++)
                {
                        new SzHostname[64], SzTimer[32] // Get Hostname & Time
                        get_cvar_string("Hostname",SzHostname,63) // Get Hostname
                        get_time("%Y/%m/%d - %H:%M:%S", SzTimer,31) // Get Time
                        new SzNextMap[32]
                        get_cvar_string("amx_nextmap", SzNextMap, 31)
                        new SzTimeLeft = get_timeleft()

                        new SzName[128] // Get Player Name
                        get_user_name(id, SzName, 127) // Get Player Name

                        new SzAuthID[32] // Get STEAMID
                        get_user_authid(id, SzAuthID, 32) // Get STEAMID

                        new SzScores = (get_user_frags(id) - get_user_deaths(id)) // Get Player Scores

                        new SzIP[16] // Get Player IP
                        static SzCountry[32] // Get Player Country
                        get_user_ip(id, SzIP, 15, 1) // Get Player IP
                        geoip_country(SzIP, SzCountry, 45) // Get Player Country By Using The IP

                        new SzPing, SzLoss // Get Player Ping
                        get_user_ping(id, SzPing, SzLoss) // Get Player Ping

                        set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.05, 0.60, 0, 1.0, 1.0, 0.1, 0.2, -1)
                        ShowSyncHudMsg(id, hudsync, "%s ^n Nextmap: %s ^n Timeleft: %d:%02d ^n Time: %s ^n Player Name: %s ^n SteamID: %s ^n Score: %d ^n Country: %s", SzHostname, SzNextMap, SzTimeLeft / 60, SzTimeLeft % 60, SzTimer, SzName, SzAuthID, SzScores, SzCountry)
                }
}


vL. 08-18-2010 06:40

Re: If player dead show him a hud message about the player info of he looking.
 
Maby

PHP Code:

public DHM(id)
{
    if(!
is_user_alive(id))    
    {
        for (new 
id 1id <= SzMaxPlayersid++)
        {
            new 
SzHostname[64], SzTimer[32// Get Hostname & Time
            
get_cvar_string("Hostname",SzHostname,63// Get Hostname
            
get_time("%Y/%m/%d - %H:%M:%S"SzTimer,31// Get Time
            
new SzNextMap[32]
            
get_cvar_string("amx_nextmap"SzNextMap31)
            new 
SzTimeLeft get_timeleft()
            
            new 
SzName[128// Get Player Name
            
get_user_name(idSzName127// Get Player Name
            
            
new SzAuthID[32// Get STEAMID
            
get_user_authid(idSzAuthID32// Get STEAMID
            
            
new SzScores = (get_user_frags(id) - get_user_deaths(id)) // Get Player Scores
            
            
new SzIP[16// Get Player IP
            
static SzCountry[32// Get Player Country
            
get_user_ip(idSzIP151// Get Player IP
            
geoip_country(SzIPSzCountry45// Get Player Country By Using The IP
            
            
new SzPingSzLoss // Get Player Ping
            
get_user_ping(idSzPingSzLoss// Get Player Ping
            
            
set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.050.6001.01.00.10.2, -1)
            
ShowSyncHudMsg(idhudsync"%s ^n Nextmap: %s ^n Timeleft: %d:%02d ^n Time: %s ^n Player Name: %s ^n SteamID: %s ^n Score: %d ^n Country: %s"SzHostnameSzNextMapSzTimeLeft 60SzTimeLeft 60SzTimerSzNameSzAuthIDSzScoresSzCountry)
        }
    }



GarbageBox 08-18-2010 07:10

Re: If player dead show him a hud message about the player info of he looking.
 
Tried, nothing change with it...

fireattack 08-18-2010 08:39

Re: If player dead show him a hud message about the player info of he looking.
 
PHP Code:

 
public DHM(id)
{
 if(!
is_user_alive(id))    
  return 
FMRES_IGNORED
  
 
for (new id 1id <= SzMaxPlayersid++)
 {
  new 
SzHostname[64], SzTimer[32// Get Hostname & Time
  
get_cvar_string("Hostname",SzHostname,63// Get Hostname
  
get_time("%Y/%m/%d - %H:%M:%S"SzTimer,31// Get Time
  
new SzNextMap[32]
  
get_cvar_string("amx_nextmap"SzNextMap31)
  new 
SzTimeLeft get_timeleft()
            
  new 
SzName[128// Get Player Name
  
get_user_name(idSzName127// Get Player Name
            
  
new SzAuthID[32// Get STEAMID
  
get_user_authid(idSzAuthID32// Get STEAMID
            
  
new SzScores = (get_user_frags(id) - get_user_deaths(id)) // Get Player Scores
            
  
new SzIP[16// Get Player IP
  
static SzCountry[32// Get Player Country
  
get_user_ip(idSzIP151// Get Player IP
  
geoip_country(SzIPSzCountry45// Get Player Country By Using The IP
            
  
new SzPingSzLoss // Get Player Ping
  
get_user_ping(idSzPingSzLoss// Get Player Ping
            
  
set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.050.6001.01.00.10.2, -1)
  
ShowSyncHudMsg(idhudsync"%s ^n Nextmap: %s ^n Timeleft: %d:%02d ^n Time: %s ^n Player Name: %s ^n SteamID: %s ^n Score: %d ^n Country: %s"SzHostnameSzNextMapSzTimeLeft 60SzTimeLeft 60SzTimerSzNameSzAuthIDSzScoresSzCountry)
 }
 return 
PLUGIN_CONTINUE


vL, your code show the hud while the player is alive, i think.

GarbageBox 08-18-2010 09:03

Re: If player dead show him a hud message about the player info of he looking.
 
I tried, if change the code like yours the hud message is hide but even when a player dead hide too.

I have fixed only show the hud message for dead player.
Code:

public DHM(id)
{
        for (new id = 1; id <= SzMaxPlayers; id++)
        {
                if(is_user_alive(id))
                continue;

And now the problem is how can change the info of the dead player who spectating.

vL. 08-18-2010 10:15

Re: If player dead show him a hud message about the player info of he looking.
 
fireattack do you know what
PHP Code:

if(!is_user_alive(id)) 

even mean, it means that the user is not alive

for the how to get user stuff, use targetid, theres also some threads about it.

GarbageBox 08-19-2010 00:44

Re: If player dead show him a hud message about the player info of he looking.
 
Thanks. Fixed.
But now I get another problem, when a player who is not spectating someone, the hud message will show the player name to hostname, therefore, I want to hide the dead message if a dead player is not spectating someone.
possible?


All times are GMT -4. The time now is 21:56.

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