24/03/2019, 12:58 AM
ayuda para que la demo no se grabe cuando un jugador este en spect solo cuando hayan elegido equipo
Código PHP:
#include <amxmodx>
#include <amxmisc>
new const TAG[] = "^x1[^x4TEST^x1]"
#define IsPugAlive(%1) pug_get_state() == ALIVE && Recording[%1] == false
#define IsPugNotAlive (pug_get_state() == NO_ALIVE)
new bool:Recording[33]
enum _DATA_SERVER
{
SERVER_TABLE[20],
SERVER_IP[21]
};
enum _:PUGSTATE
{
NO_ALIVE = 0,
ALIVE,
COMMENCING
}
native pug_get_state()
forward pug_end(team)
forward pug_round_end(team)
native register_forward(_forwardType,const _function[],_post=0);
new const g_MySQLTable[][_DATA_SERVER] =
{
{ "TEST", "46.174.54.40:27015" }
};
new g_szServerIP[21], g_mapname[32], szData[64];
public plugin_init()
{
register_plugin("Demo Record", "v0.1.1", "whOo-");
register_event("HLTV", "EV_new_round", "a", "1=0", "2=0");
get_time( "%H-%M-%S_%d-%m-%Y", szData, charsmax(szData));
get_mapname(g_mapname, charsmax(g_mapname));
get_user_ip(0, g_szServerIP, charsmax(g_szServerIP), 0);
}
public client_putinserver(id)
{
Recording[id] = false
set_task(10.0, "grab_ar", id)
}
public client_disconnected(id){
Recording[id] = false
}
public plugin_cfg()
{
server_cmd("amx_pausecfg add ^"Demo Record^"");
}
public grab_ar( id )
{
if(!is_user_connected(id)) return;
new archivo[150], szData[64]
get_time ( "%H-%M-%S_%d-%m-%Y", szData, charsmax(szData));
for(new i = 0; i < sizeof(g_MySQLTable); i++)
{
if(!equali(g_MySQLTable[i][SERVER_IP], g_szServerIP))
continue;
format(archivo, charsmax(archivo), "TAG_%s_%s_%s", g_MySQLTable[i][SERVER_TABLE], g_mapname, szData)
}
replace_all( archivo, 127, ".", "_" );
replace_all( archivo, 127, "|", "_" );
replace_all( archivo, 127, "\", "_" );
replace_all( archivo, 127, "/", "_" );
replace_all( archivo, 127, " ", "_" );
replace_all( archivo, 127, ":", "_" );
replace_all( archivo, 127, "?", "_" );
replace_all( archivo, 127, ">", "_" );
replace_all( archivo, 127, "<", "_" );
}
public EV_new_round()
{
for(new i=1; i <= get_maxplayers(); i++){
if(!is_user_connected(i)) continue
if(IsPugAlive(i))
{
client_print_color(i, i, "%s Pug Demo: ^4^"%s_%s_...dem^"", TAG, g_MySQLTable[SERVER_TABLE], g_mapname)
client_cmd(i, "stop; record ^"%s_%s_%s^"", g_MySQLTable[SERVER_TABLE], g_mapname, szData)
Recording[i] = true
}
else if(IsPugNotAlive){
Recording[i] = false
client_cmd(i, "stop")
}
}
}
Aprendiendo scripting || Tratare ayudar en lo que pueda || PD: Soy pobre