Hello allied mods,
I am trying to get 2 players from each T and CT team , and give them a vip model and announce it to the respectful teams with an hud .... , but what is happening is :
4-5 players in each team get the vip model or the Hud shows the other teams leader ... Plz help me
PHP Code:
#include <amxmodx>
#include <cstrike>
#define TASKID_CHOOSELEADER 153
#define PLUGIN "Ghost"
#define VERSION "1.0"
#define AUTHOR "Sam"
new g_maxplayers
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_logevent("logevent_round_start", 2, "1=Round_Start")
register_logevent("logevent_round_end", 2, "1=Round_End")
g_maxplayers = get_maxplayers()
}
public plugin_precache()
{
precache_model("models/player/vip/vip.mdl")
}
public logevent_round_start()
{
static id
for(id = 1; id <= g_maxplayers; id++) if(is_user_alive(id))
{
set_task(7.0, "Leaders", id)
}
}
public Leaders(id)
{
if(cs_get_user_team(id) == CS_TEAM_CT)
{
new iPlayers[32], iNum, szName[32]
get_players(iPlayers, iNum, "ae", "CT");
if(iNum)
{
CT(iPlayers[( iNum > 1) ? random(iNum) : 0]);
get_user_name(iNum, szName, 31)
set_hudmessage(255, 0, 0, 0.30, 0.30, 0, 5.0, 5.0)
show_hudmessage(id, "%s is the Counter Terrorist Leader", szName)
}
}
else if(cs_get_user_team(id) == CS_TEAM_T)
{
new iPlayers1[32], iNum1, szName1[32];
get_players(iPlayers1, iNum1, "ae", "TERRORIST")
if(iNum1)
{
T(iPlayers1[( iNum1 > 1) ? random(iNum1) : 0]);
get_user_name(iNum1, szName1, 31)
set_hudmessage(255, 0, 0, 0.30, 0.40, 0, 5.0, 5.0)
show_hudmessage(id, "%s is the Terrorist Leader", szName1)
}
}
}
public CT(id)
{
cs_set_user_model(id, "vip")
}
public T(id)
{
cs_set_user_model(id, "vip")
}
public logevent_round_end()
{
remove_task(TASKID_CHOOSELEADER)
static id
for(id = 1; id <= g_maxplayers; id++) if(is_user_connected(id))
{
cs_reset_user_model(id)
}
}