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 iMaxClients, iMsgSayText
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 topfrag, toppack, topf, topp, szName[32] GetMostFrags(topfrag, toppack, topf, topp) if(is_user_connected(topfrag)) { get_user_name(topfrag, szName, 31) UTIL_ColorChat(0, "^x04%s^x01 lead the frag with^x04 %d^x01 frags!", szName, topf) }
if(is_user_connected(toppack)) { get_user_name(toppack, szName, 31) UTIL_ColorChat(0, "^x04%s^x01 lead the pack with^x04 %d^x01 packs!", szName, topp) } }
GetMostFrags(&topfrag, &toppack, &topf, &topp) { new frag, pack, j 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], iNum, y, id2 get_players(iPlayers, iNum, "ch") for(y=0;y<iNum;y++) { id2 = iPlayers[y] if(!is_user_connected(id2)) continue; vformat(szBuffer, charsmax(szBuffer), szText, 3) message_begin(MSG_ONE_UNRELIABLE, iMsgSayText, _, id2) write_byte(id2) write_string(szBuffer) message_end() } } else { vformat(szBuffer, charsmax(szBuffer), szText, 3) message_begin(MSG_ONE, iMsgSayText, _, id) write_byte(id) write_string(szBuffer) message_end() } }
|