29/07/2016, 05:14 PM
Buenas tengo un pequeño problemita no tanto pero bueno... el que sabe sabe.. yo no
Este aporte que hizo K.- el Automix tengo un pequeño problema el damage no se registra.. y deseo agregarle esto pero no me gunciona con el g_IsStarted
En fin.. quiero agregarle el .dmg y saber el dinero de mi team.
Aporte AutoMix
este es el .dmg original de Twilight Suzuka
Este aporte que hizo K.- el Automix tengo un pequeño problema el damage no se registra.. y deseo agregarle esto pero no me gunciona con el g_IsStarted
En fin.. quiero agregarle el .dmg y saber el dinero de mi team.
Código PHP:
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#define NAME "show teammate's money"
#define VERSION "1.3.1"
#define AUTHOR "K.K.Lv"
new g_max_players, g_sync_creat_statustext, g_sync_creat_list
new bool:g_teammate[33]
new cvar_plugin_on
new cvar_status_on
public plugin_init()
{
register_plugin(NAME, VERSION, AUTHOR)
RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
register_clcmd("say /money", "clcmd_money")
register_event("StatusValue", "show_teammate_money", "be", "1=2", "2!0")
register_event("StatusValue", "set_team", "be", "1=1")
cvar_plugin_on = register_cvar("stm_on", "1")
cvar_status_on = register_cvar("stm_st_on", "1")
g_max_players = get_maxplayers()
g_sync_creat_statustext = CreateHudSyncObj()
g_sync_creat_list = CreateHudSyncObj()
}
public clcmd_money(client)
{
if (!get_pcvar_num(cvar_plugin_on))
{
client_print(client, print_chat, "[AMXX]: Show Teammate's Money was off.")
return PLUGIN_HANDLED
}
show_money(client)
return PLUGIN_CONTINUE
}
public player_spawn(client)
{
remove_task(client)
if (is_user_alive(client) && get_pcvar_num(cvar_plugin_on))
{
set_task(1.0, "show_money", client)
}
}
public show_money(client)
{
static message[1024];
static name[32];
new money, id, len;
len = format(message, charsmax(message), "The teammate's money:^n");
for (id = 1; id <= g_max_players; id++)
{
if (id != client && is_user_connected(id) && cs_get_user_team(id) == cs_get_user_team(client))
{
money = cs_get_user_money(id);
get_user_name(id, name, 31);
len += format(message[len], charsmax(message) - len, "%-22.22s: %d^n", name, money);
}
}
set_hudmessage(100, 200, 0, 0.05, 0.35, 0, 0.02, 5.0, 0.1, 0.2, 2);
ShowSyncHudMsg(client, g_sync_creat_list, message);
}
public set_team(id)
g_teammate[id] = bool:(read_data(2) == 1);
public show_teammate_money(id)
{
if (!get_pcvar_num(cvar_plugin_on))
return PLUGIN_HANDLED
if(!is_user_bot(id) && is_user_connected(id) && get_pcvar_num(cvar_status_on))
{
static name[32]
new pid = read_data(2)
new red = 0, blue = 0
if (cs_get_user_team(pid) == CS_TEAM_T)
red = 255
else if(cs_get_user_team(pid) == CS_TEAM_CT)
blue = 255
get_user_name(pid, name, charsmax(name))
new money = cs_get_user_money(pid)
if (g_teammate[id])
{
set_hudmessage(red, 50, blue, -1.0, 0.60, 1, 0.01, 0.6, 0.01, 0.01, 8)
ShowSyncHudMsg(id, g_sync_creat_statustext, "Friend:%s -- Money:%d", name, money)
}
else {
set_hudmessage(red, 50, blue, -1.0, 0.60, 1, 0.01, 0.6, 0.01, 0.01, 8)
ShowSyncHudMsg(id, g_sync_creat_statustext, "Enemy:%s", name)
}
}
return PLUGIN_CONTINUE
}
public client_disconnect(client)
{
remove_task(client)
}
Aporte AutoMix
este es el .dmg original de Twilight Suzuka
Código PHP:
#include <amxmodx>
#include <amxmisc>
#include <yap_modspecific>
#include <yap_forwards>
#include <yap_stocks>
#include <yap_const>
new const plugin_author[] = "Twilight Suzuka"
new const plugin_name[] = "YAP-AUX"
new const plugin_version[] = "0.0.1"
public pug_cvar_help
public pug_cvar_admin_help
public plugin_init()
{
register_plugin(plugin_name,plugin_version,plugin_author);
register_dictionary("yap.txt")
register_dictionary("yap_aux.txt")
pug_cvar_help = register_cvar("pug_help","http://")
pug_cvar_admin_help = register_cvar("pug_adminhelp","http://")
register_pug_admincmd("cmds","cmd_cmdlist",_,"Lists all PUG commands")
register_pug_admincmd("commands","cmd_cmdlist",_,"Lists all PUG commands")
register_pug_clcmd("hp","cmd_hpteam",_,"[target] Shows health of other clients")
register_pug_clcmd("hpteam","cmd_hpteam",_,"[target] Shows health of other clients")
register_pug_clcmd("hpall","cmd_hpall",_,"[target] Shows health of other clients")
register_pug_clcmd("dmg","cmd_dmg",_,"[target] Shows damage you have done to other clients")
register_pug_clcmd("rdmg","cmd_rdmg",_,"[target] Shows damage done to you by other clients")
register_pug_clcmd("db server","cmd_db",_,"Brings up server info")
register_pug_clcmd("dbserver","cmd_db",_,"Brings up server info")
register_pug_admincmd("svrestart","cmd_restart",PUG_CMD_LVL,"Restarts the server")
register_pug_admincmd("kill","cmd_kill",PUG_CMD_LVL,"<name or #userid> Kills a client")
register_pug_admincmd("kick","cmd_kick",PUG_CMD_LVL,"<name or #userid> Kicks a client")
register_pug_admincmd("message","cmd_msg",PUG_CMD_LVL,"Sends a message")
register_pug_admincmd("msg","cmd_msg",PUG_CMD_LVL,"Sends a message")
register_pug_admincmd("rcon","cmd_rcon",PUG_CMD_LVL,"Sends RCON command")
register_pug_admincmd("exec","cmd_rcon",PUG_CMD_LVL,"Sends RCON command")
register_pug_clcmd("help","cmd_help",_,"Brings up client help info")
register_pug_clcmd("adminhelp","cmd_admin_help",PUG_CMD_LVL,"Brings up admin help info")
//parse_header("BOE-E",pug_header,5)
}
// Rukia: We need to reset the dmg and hits when a client connects, disconnects, and rounds start
new pug_dmg[33][33]
new pug_hits[33][33]
public client_connect(id)
{
arrayset(pug_dmg[id], 0, 33);
arrayset(pug_hits[id], 0, 33);
}
public client_disconnect(id)
{
for (new i = 0; i < 33; i++)
{
pug_dmg[i][id] = 0;
pug_hits[i][id] = 0;
}
}
public pug_round_start()
{
for (new i = 0; i < 33; ++i)
{
arrayset(pug_dmg[i], 0, 33)
arrayset(pug_hits[i], 0, 33)
}
}
public pug_round_start_failed()
{
for (new i = 0; i < 33; ++i)
{
arrayset(pug_dmg[i], 0, 33)
arrayset(pug_hits[i], 0, 33)
}
}
// Rukia: Assume that the mod specific plugin has loaded the correct module, or provided this for us
public client_damage ( attacker, victim, amount, wpnindex, hitplace, TA )
{
//if (attacker == victim) return;
pug_dmg[attacker][victim] += amount
pug_hits[attacker][victim] += 1
}
#include <yap_aux>
public cmd_hpall(id)
{
if(is_user_alive(id) && id != 0) { pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED"); }
else
{
static Players[32], name[32]
new playerCount, i, player
get_players(Players, playerCount, "ah")
for (i=0; i<playerCount; i++)
{
player = Players[i]
get_user_name(player,name,31)
client_print(id,print_chat,"%s %L",pug_header,id,"PUG_AUX_HP",name,get_user_health(player),get_user_armor(player))
}
}
return PLUGIN_HANDLED
}
public cmd_hpteam(id)
{
if(is_user_alive(id) && id != 0) { pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED"); }
else
{
static Players[32], name[32]
new playerCount, i, player
get_players(Players, playerCount, "ah")
new teamid = pug_get_client_team(id)
for (i=0; i<playerCount; i++)
{
player = Players[i]
if(teamid == pug_get_client_team(player) ) continue;
get_user_name(player,name,31)
client_print(id,print_chat,"%s %L",pug_header,id,"PUG_AUX_HP",name,get_user_health(player),get_user_armor(player))
}
}
return PLUGIN_HANDLED
}
public cmd_dmg(id)
{
if(is_user_alive(id) && id != 0) pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED");
else
{
static Players[32], name[32]
new playerCount, i, player
get_players(Players, playerCount, "ch")
new tmp_hits, tmp_dmg, check
for (i=0; i<playerCount; i++)
{
player = Players[i]
tmp_hits = pug_hits[id][player]
if( tmp_hits )
{
check = 1
tmp_dmg = pug_dmg[id][player]
if(player == id) client_print(id,print_chat,"%s %L",pug_header,id,"PUG_AUX_DMG_SELF",tmp_hits,tmp_dmg)
else
{
get_user_name(player,name, 31)
client_print(id,print_chat,"%s %L",pug_header,id,"PUG_AUX_DMG",name,tmp_hits,tmp_dmg)
}
}
}
tmp_hits = pug_hits[id][0]
if(tmp_hits)
{
tmp_dmg = pug_dmg[id][0]
client_print(id,print_chat,"%s %L",pug_header,id,"PUG_AUX_DMG","WorldSpawn",tmp_hits,tmp_dmg)
}
else if(!check) client_print(id,print_chat,"%s %L",pug_header,id,"PUG_AUX_NODMG")
}
return PLUGIN_HANDLED
}
public cmd_rdmg(id)
{
if(is_user_alive(id) && id != 0) pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED");
else
{
static Players[32], name[32]
new playerCount, i, player
get_players(Players, playerCount, "ch")
new tmp_hits, tmp_dmg, check
for (i=0; i<playerCount; i++)
{
player = Players[i]
tmp_hits = pug_hits[player][id]
if( tmp_hits )
{
check = 1
tmp_dmg = pug_dmg[player][id]
if(player == id) client_print(id,print_chat,"%s %L",pug_header,id,"PUG_AUX_RDMG_SELF",tmp_hits,tmp_dmg)
else
{
get_user_name(player,name, 31)
client_print(id,print_chat,"%s %L",pug_header,id,"PUG_AUX_RDMG",name,tmp_hits,tmp_dmg)
}
}
}
tmp_hits = pug_hits[0][id]
if(tmp_hits)
{
tmp_dmg = pug_dmg[0][id]
client_print(id,print_chat,"%s %L",pug_header,id,"PUG_AUX_RDMG","WorldSpawn",tmp_hits,tmp_dmg)
}
else if(!check) client_print(id,print_chat,"%s %L",pug_header,id,"PUG_AUX_RNODMG")
}
return PLUGIN_HANDLED
}
public cmd_restart(id,level,cid)
{
if (!cmd_access(id, level, cid, 1) ) return pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED")
else server_cmd("restart");
return PLUGIN_HANDLED;
}
public cmd_kill(id,level,cid)
{
if (!cmd_access(id, level, cid, 2) ) return pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED")
static arg[32]
read_argv(1,arg,31)
client_cmd(id,"amx_slay %s",arg)
return PLUGIN_HANDLED;
}
public cmd_kick(id,level,cid)
{
if (!cmd_access(id, level, cid, 2) ) return pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED")
static arg[32], reason[50]
read_argv(1,arg,31)
if(read_argc ( ) > 2) read_argv(2,reason,49)
else formatex(reason,49,"%s Bye!",pug_header)
client_cmd(id,"amx_kick %s %s",arg,reason)
return PLUGIN_HANDLED;
}
public cmd_msg(id,level,cid)
{
if (!cmd_access(id, level, cid, 2) ) return pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED")
static arg[192]
read_args(arg,191)
strbreak(arg,"",0,arg,191)
client_cmd(id,"amx_say %s %s",pug_header,arg)
return PLUGIN_HANDLED;
}
public cmd_rcon(id,level,cid)
{
if (!cmd_access(id, level, cid, 2) ) return pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED")
static arg[192]
read_args(arg,191)
strbreak(arg,"",0,arg,191)
client_cmd(id,"amx_rcon %s",arg)
return PLUGIN_HANDLED;
}
public cmd_help(id)
{
static tmp[255], name[32]
formatex(name,31,"%s PUG Help",pug_header)
get_pcvar_string(pug_cvar_help,tmp,255)
show_motd(id,tmp,name)
return PLUGIN_HANDLED
}
public cmd_admin_help(id)
{
static tmp[255], name[32]
if(!access(id,PUG_CMD_LVL) ) pug_msg_tmp_empty(id,"PUG_CMD_NOTALLOWED")
else
{
formatex(name,31,"%s PUG Admin Help",pug_header)
get_pcvar_string(pug_cvar_admin_help,tmp,255)
show_motd(id,tmp,name)
}
return PLUGIN_HANDLED
}
public cmd_cmdlist(id)
{
static dyna_MOTD[1600], cmd[64], info[256], flags;
static seperator[10]
if(colored_menus()) copy(seperator,4,"<br>")
else copy(seperator,4,"^n^n")
dyna_MOTD[0] = '^0'
formatex(dyna_MOTD,1599,"%s%L%s%s",pug_header,id,"PUG_DYNAHELP",seperator,seperator)
//new idflags = get_user_flags(id)
new num = get_concmdsnum(-1)
for(new i = 0; i < num; i++)
{
get_concmd(i, cmd, 63, flags, info, 255, -1);
if(cmd[0] == '.')
{
format(dyna_MOTD,1599,"%s%s - %s%s",dyna_MOTD,cmd,info,seperator)
}
}
show_motd(id,dyna_MOTD,"Dynamic Command Collection")
return PLUGIN_HANDLED;
}
public cmd_db(id)
{
static DbUrl[256], BoxTitle[128], server_name[64], server_rcon[128], server_ip[32], server_ip_port[42], ip_tmp[32], server_port[10]
get_cvar_string( "hostname", server_name, 63 )
format( BoxTitle, 127, "%s - ESEA SteamID DataBase", server_name )
get_cvar_string( "ip", server_ip, 32 )
get_user_ip(0, server_ip_port, 41) // Takes in the whole IP:port string.. (0 is always the server)
strtok(server_ip_port, ip_tmp, 31, server_port, 9, ':') // Divides the string with the help of strtok and delimiter :
get_cvar_string( "rcon_password", server_rcon, 127 )
formatex( DbUrl, 255, "http://steamid.esportsea.com/?action=search&type=rcon&server=%s:%s&pass=%s", server_ip, server_port, server_rcon )
show_motd( id, DbUrl, BoxTitle )
return PLUGIN_HANDLED
}
aprendiendo