PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <core>
new PLUGIN[] = "Deathrun Manager"
new AUTHOR[] = "Schwabba"
new VERSION[] = "1.0"
new bool:g_dr_on;
new g_dr_T;
new g_dr_T_nick[32];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
set_task(2.0,"StartBot")
set_task(5.0,"DRcheck",0,_,_,"b")
register_logevent( "EventRoundStart", 2, "1=Round_Start" );
register_logevent( "EventRoundEnd", 2, "1=Round_End" );
}
public StartBot()
{
new BotName[] = "Pingstars.de"
new Bot = engfunc(EngFunc_CreateFakeClient, BotName)
dllfunc(MetaFunc_CallGameEntity, "player", Bot)
set_pev(Bot, pev_flags, FL_FAKECLIENT)
set_pev(Bot, pev_model, "")
set_pev(Bot, pev_viewmodel2, "")
set_pev(Bot, pev_modelindex, 0)
set_pev(Bot, pev_renderfx, kRenderFxNone)
set_pev(Bot, pev_rendermode, kRenderTransAlpha)
set_pev(Bot, pev_renderamt, 0.0)
cs_set_user_team(Bot, CS_TEAM_T)
}
public DRcheck()
{
if(!g_dr_on)
{
new iPlayers[32],iNum
get_players(iPlayers, iNum);
if (iNum > 2)
{
print_color(0, 1, 0, "^x04-=[Pingstars]=- ^x03 Deathrun ^x01 wird gestartet.")
g_dr_on = true
DRchange()
}
}
}
public DRchange()
{
g_dr_T = random(32) +1
if(is_user_connected(g_dr_T))
{
get_user_name(g_dr_T, g_dr_T_nick, 31);
print_color(0, 1, 0, "^x04-=[Pingstars]=- ^x03 %s ( %d ) ^x01 ist jetzt der Terrorist.", g_dr_T_nick, g_dr_T)
}
else
{
DRchange()
}
}
public EventRoundEnd( )
{
if(g_dr_on)
{
DRchange()
}
}
public print_color(id, cid, color, const message[], any:...)
{
new msg[192]
vformat(msg, charsmax(msg), message, 5)
/* //if you want to use ML, enable
replace_all(msg, charsmax(msg), "!g", "^x04")
replace_all(msg, charsmax(msg), "!n", "^x01")
replace_all(msg, charsmax(msg), "!t", "^x03")*/
new param
if (!cid) return
else param = cid
new team[32]
get_user_team(param, team, 31)
switch (color)
{
case 0: msg_teaminfo(param, team)
case 1: msg_teaminfo(param, "TERRORIST")
case 2: msg_teaminfo(param, "CT")
case 3: msg_teaminfo(param, "SPECTATOR")
}
if (id) msg_saytext(id, param, msg)
else msg_saytext(0, param, msg)
if (color != 0) msg_teaminfo(param, team)
}
msg_saytext(id, cid, msg[])
{
message_begin(id?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0,0,0}, id)
write_byte(cid)
write_string(msg)
message_end()
}
msg_teaminfo(id, team[])
{
message_begin(MSG_ONE, get_user_msgid("TeamInfo"), {0,0,0}, id)
write_byte(id)
write_string(team)
message_end()
}