BANNED
Join Date: Jul 2009
Location: Los Teques
|
03-17-2010
, 22:19
Re: [TUT] Recording Damage/Hits Per-Round and Displaying It
|
#46
|
Ok you explain a little better my code is this:
PHP Code:
#include <amxmodx> #include <amxmisc> #include <engine>
#include <yap_modspecific> #include <yap_forwards> #include <yap_stocks> #include <yap_const>
new const plugin_author[] = "PsychO" new const plugin_name[] = "YAP-AUX" new const plugin_version[] = "0.0.1"
#define RESET_DELAY 15.0 new bool:allowdmg
public plugin_init() { register_plugin(plugin_name,plugin_version,plugin_author);
register_dictionary("yap.txt") register_dictionary("yap_aux.txt")
register_pug_admincmd("help","cmd_cmdlist",_,"Lista de todos los comandos PUG")
register_pug_clcmd("hp","cmd_rdmg",_,"Muestra el hp de los oponentes")
register_pug_clcmd("dmg","cmd_dmg",_,"Muestra el daño que causastes y el que te causo el oponente") register_pug_clcmd("rdmg","cmd_dmg",_,"Muestra el daño que causastes y el que te causo el oponente")
register_pug_admincmd("svrestart","cmd_restart",PUG_CMD_LVL,"Solo para ADMIN")
//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] new pug_lastroundhp[33]
public client_connect(id) { arrayset(pug_dmg[id], 0, 33); arrayset(pug_hits[id], 0, 33); pug_lastroundhp[id] = floatround(entity_get_float(id, EV_FL_max_health)); }
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() { #if defined RESET_DELAY set_task( RESET_DELAY, "allowdmgreset" ) #else allowdmgreset() #endif allowdmg = true }
public pug_round_start_failed() { #if defined RESET_DELAY set_task( RESET_DELAY, "allowdmgreset" ) #else allowdmgreset() #endif allowdmg = true }
// 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 pug_lastroundhp[victim] -= amount }
#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_header2,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 && !allowdmg ) { 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_header2,id,"PUG_AUX_HP",is_user_alive( player ) ? pug_lastroundhp[player] : 0, get_user_armor(player), name) } } return PLUGIN_HANDLED }
public allowdmgreset() { for (new i = 0; i < 33; ++i) { arrayset(pug_dmg[i], 0, 33) arrayset(pug_hits[i], 0, 33) pug_lastroundhp[i] = 100 } allowdmg = false }
public cmd_dmg(id) { if( is_user_alive(id) && id != 0 && !allowdmg ) 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, tmp_rhits, tmp_rdmg, check for (i=0; i<playerCount; i++) { player = Players[i] tmp_hits = pug_hits[id][player] tmp_rhits = pug_hits[player][id]
if( tmp_hits || tmp_rhits ) { check = 1 tmp_dmg = pug_dmg[id][player] tmp_rdmg = pug_dmg[player][id]
if(player == id) client_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_DMG_SELF",tmp_dmg,tmp_hits, is_user_alive( player ) ? get_user_health(player) : 0) else { get_user_name(player,name, 31) client_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_DMG",tmp_dmg,tmp_hits,tmp_rdmg,tmp_rhits, name, is_user_alive( player ) ? get_user_health(player) : 0) } } }
tmp_hits = pug_hits[id][0] tmp_rhits = pug_hits[0][id] if( tmp_hits || tmp_rhits ) { tmp_dmg = pug_dmg[id][0] tmp_rdmg = pug_dmg[0][id] client_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_DMG","WorldSpawn",tmp_hits,tmp_dmg, is_user_alive( player ) ? get_user_health(player) : 0) } else if(!check) client_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_NODMG") } return PLUGIN_HANDLED }
It works to the perfection but i just lack add something to the code cmd_dmg(id) what i want is what achievement wrecked in this code:
PHP Code:
public CMD_ShowDamage( id ) { if( is_user_alive( id ) && !b_CanTypeWhileAlive ) { client_print( id, print_chat, "Hey! You can't do that right now!" ) return PLUGIN_CONTINUE; } new iPlayers[32] new iNum new plrid get_players( iPlayers, iNum ) static name[32] static message[108] new CsTeams:idteam = cs_get_user_team( id ) for( new i = 0; i < iNum; i++ ) { plrid = iPlayers[i] if( id == plrid || cs_get_user_team( plrid ) == idteam ) { continue; } get_user_name( plrid, name, 31 ) formatex( message, 107, "Given: ( %i Damage / %i Hits ) Taken: ( %i Damage / %i Hits )", iDamageGiven[id][plrid], iHitsGiven[id][plrid], iDamageTaken[id][plrid], iHitsTaken[id][plrid] ) client_print( id, print_chat, "[%s] %s", name, message ) } return PLUGIN_CONTINUE; }
He has worked with cs_get_user_team which makes the following:
*
Shows all the team to run the command! So does not have inflicted damage or you have inflicted damage, meaning that it does not have done damage to nadien you show all players to execute the command if i do not understand warn! Back to view the image and really that shows all the players that are in the other team so it is not beeches inflicted damage to nobody
I have tried to implement the code asi but does not work
PHP Code:
public cmd_dmg(id) { if( is_user_alive(id) && id != 0 && !allowdmg ) 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, tmp_rhits, tmp_rdmg, check new CsTeams:teamid = cs_get_user_team( id ) for (i=0; i<playerCount; i++) { player = Players[i] tmp_hits = pug_hits[id][player] tmp_rhits = pug_hits[player][id]
if( tmp_hits || tmp_rhits ) { check = 1 tmp_dmg = pug_dmg[id][player] tmp_rdmg = pug_dmg[player][id]
if( id == player || cs_get_user_team( player ) == teamid ) { continue; }
get_user_name(player,name, 31) client_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_DMG",tmp_dmg,tmp_hits,tmp_rdmg,tmp_rhits, name, is_user_alive( player ) ? get_user_health(player) : 0) } }
tmp_hits = pug_hits[id][0] tmp_rhits = pug_hits[0][id] if( tmp_hits || tmp_rhits ) { tmp_dmg = pug_dmg[id][0] tmp_rdmg = pug_dmg[0][id] client_print(id,print_chat,"%s %L",pug_header2,id,"PUG_AUX_DMG","WorldSpawn",tmp_hits,tmp_dmg, is_user_alive( player ) ? get_user_health(player) : 0) } else if(!check) client_print(id,print_chat,"",pug_header2,id,"PUG_AUX_NODMG") } return PLUGIN_HANDLED }
Last edited by flamin; 03-17-2010 at 22:22.
|
|