AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   Subplugin Submission [ZP43|ZP50] Addon: Frags & Ammopacks Leader. (https://forums.alliedmods.net/showthread.php?t=260455)

yokomo 03-25-2015 14:27

[ZP43|ZP50] Addon: Frags & Ammopacks Leader.
 
1 Attachment(s)
I see many people need this kind of plugin, so i write a plugin for it.

What does this plugin do?
Ok on round end a color chat message will appear to inform you who are leading the frags and ammopacks.

Screenshots:
http://cloud-4.steamusercontent.com/...72077D2DF0749/

ZP Version:
- All ZP43 & ZP50.

Credits:

Kiske -- for his original idea.

Changes Log:
Spoiler

wicho 04-02-2015 19:13

Re: [ZP43] Addon: Frags & Ammopacks Leader.
 
Not bad, I dont think this has problem for 5.0 but just in case..

PHP Code:

#include <amxmodx>
#include <zp50_ammopacks>

const TASK_LEADER 37032
new iMaxClientsiMsgSayText

public plugin_init()
{
    
register_plugin("Frags & Packs Leaders""0.0.1""wbyokomo")
    
iMaxClients get_maxplayers()
    
iMsgSayText get_user_msgid("SayText")
}

public 
zp_round_ended()
{
    
remove_task(TASK_LEADER)
    
set_task(random_float(1.0,1.5), "TaskShowLeader"TASK_LEADER)
}

public 
TaskShowLeader()
{
    new 
topfragtoppacktopftoppszName[32]
    
GetMostFrags(topfragtoppacktopftopp)
    
    if(
is_user_connected(topfrag))
    {
        
get_user_name(topfragszName31)
        
UTIL_ColorChat(0"^x04%s^x01 lead the frag with^x04 %d^x01 frags!"szNametopf)
    }

    if(
is_user_connected(toppack))
    {
        
get_user_name(toppackszName31)
        
UTIL_ColorChat(0"^x04%s^x01 lead the pack with^x04 %d^x01 packs!"szNametopp)
    }
}

GetMostFrags(&topfrag, &toppack, &topf, &topp)
{
    new 
fragpackj
    topfrag 
0
    toppack 
0
    topf 
= -1
    topp 
= -1
    
    
for(j=1;j<=iMaxClients;j++)
    {
        if(!
is_user_connected(j)) continue;
        
        
frag get_user_frags(j)
        if(
frag topf)
        {
            
topf frag
            topfrag 
j
        
}
        
        
pack zp_ammopacks_get(j)
        if(
pack topp)
        {
            
topp pack
            toppack 
j
        
}
    }
}

UTIL_ColorChat(id, const szText[], any:...)
{
    new 
szBuffer[512]
    
    if(!
id)
    {
        new 
iPlayers[32], iNumyid2
        get_players
(iPlayersiNum"ch")
        for(
y=0;y<iNum;y++)
        {
            
id2 iPlayers[y]
            if(!
is_user_connected(id2)) continue;
            
            
vformat(szBuffercharsmax(szBuffer), szText3)
            
message_begin(MSG_ONE_UNRELIABLEiMsgSayText_id2)
            
write_byte(id2)
            
write_string(szBuffer)
            
message_end()
        }
    }
    else
    {
        
vformat(szBuffercharsmax(szBuffer), szText3)
        
message_begin(MSG_ONEiMsgSayText_id)
        
write_byte(id)
        
write_string(szBuffer)
        
message_end()
    }




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

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