AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   have something need to help,about judge death (https://forums.alliedmods.net/showthread.php?t=141150)

etet 10-20-2010 05:41

have something need to help,about judge death
 
if i want this plugin change to at player dead show server information,not original set,wt code i need changed ?

sorry for my bad english

thx a loot

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

new hud_rgbhud_xhud_yhud_effects,maxplayers,hudsynccurr_uptime[22], g_round 1;

public 
plugin_init() {
    
register_plugin("Server Side Info","1.6","xakintosh")
    
    
hud_rgb register_cvar"srv_hud_rgb""0 255 0" )
    
hud_x register_cvar"srv_hud_x""0.11" )
    
hud_y register_cvar"srv_hud_y""0.00" )
    
hud_effects register_cvar"srv_hud_effects""0" )
    
hudsync CreateHudSyncObj()
    
maxplayers get_maxplayers()
    
    
register_dictionary("srv_info.txt");
    
    
set_task(0.1"Fwd_StartFrame"1""0"b")
    
set_task(0.1"check_uptime"___"b")
    
    
register_forward(FM_StartFrame"Fwd_StartFrame")
    
register_event("HLTV""event_newround""a""1=0""2=0");
}
public 
event_newround() {
    
g_round++
}

public 
Fwd_StartFrame(id) {
    new 
timestring[31]
    
get_time("%H:%M:%S",timestring,8)
    
    static 
Float:GameTimeFloat:FramesPer 0.0
    
static Float:Fps
    
    GameTime 
get_gametime()
    
    if(
FramesPer >= GameTime)
        
Fps += 1.0;
    else {
        
FramesPer FramesPer 1.0
        
for( new id 1id <= maxplayersid++ ) { 
            
            new 
ip[42],redgreenblue
            
new const admins GetTotalAdmins()
            new 
timeleft get_timeleft()
            
            
get_hud_color(redgreenblue)
            
get_user_ip(0ip311)
            
            
set_hudmessage(red,green,blue,get_pcvar_float(hud_x),get_pcvar_float(hud_y),get_pcvar_num(hud_effects),6.0,1.0)
            
ShowSyncHudMsg(id,hudsync,"|* --------------------* %L *-------------------- *|^n|* %L",id,"INFO",id,"REST",timeleft 60timeleft 60,timestring,Fps,ip,curr_uptime,get_user_frags(id),get_user_deaths(id),admins,g_round)
        }
        
Fps 0.0
    
}
}
get_hud_color(&r, &g, &b) {
    new 
color[20]
    
    static 
red[5], green[5], blue[5]
    
    
get_pcvar_string(hud_rgbcolorcharsmax(color))
    
    
parse(colorredcharsmax(red), greencharsmax(green), bluecharsmax(blue))
    
str_to_num(red)
    
str_to_num(green)
    
str_to_num(blue)
}
static 
GetTotalAdmins() {
    new 
iPlayers[32],iNum,Admins
    get_players
(iPlayers,iNum)
    
    for(new 
Count;Count iNum;Count++)
        if(
is_user_admin(iPlayers[Count]))
        
Admins++
        
    return 
Admins
}
public 
check_uptime() {
    new 
Float:ft Float:engfunc(EngFunc_Time)
    new 
it floatround(ft)
    new 
= (it 60) % 60
    
new = (it 3600) % 24
    
new it 86400
    
    format
(curr_uptime21"%id:%ih:%im"dhm)



naven 10-20-2010 15:42

Re: have something need to help,about judge death
 
PHP Code:

public Fwd_StartFrame(id) { 

Replace with
Code:
public Fwd_StartFrame(id) { if(!(is_user_alive(id)){
Don't forget about adding closing brace at the end of function.

Exolent[jNr] 10-20-2010 15:44

Re: have something need to help,about judge death
 
Quote:

Originally Posted by N A V E N (Post 1330391)
PHP Code:

public Fwd_StartFrame(id) { 

Replace with
Code:
public Fwd_StartFrame(id) { if(!(is_user_alive(id)){
Don't forget about adding closing brace at the end of function.

That's wrong.
FM_StartFrame doesn't even pass a player id, so the original id is always 0.
He should check inside the loop.

naven 10-20-2010 16:10

Re: have something need to help,about judge death
 
Quote:

FM_StartFrame doesn't even pass a player id, so the original id is always 0.
So the whole
Quote:

Fwd_StartFrame(id)
id is incorrect?
edit: I didn't notice that it is never used.

Exolent[jNr] 10-20-2010 16:19

Re: have something need to help,about judge death
 
Quote:

Originally Posted by N A V E N (Post 1330428)
So the whole

id is incorrect?
edit: I didn't notice that it is never used.

It will work fine in compilation and run-time, but the id is not a valid parameter for FM_StartFrame so it will always never have a value (0 for null).

http://www.amxmodx.org/funcwiki.php?go=module&id=16


All times are GMT -4. The time now is 10:23.

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