Bueno chicos, acá les dejo un sistema de combos para zombie plague 4.2 de mercyless .. Espero que les guste ^^ empecemos
SISTEMA DE COMBOS ZP
BY: BLACKK
CREDITOS: AguuS.- optimización de takedamage
Stocks necesarios
Dejo el sma 4.2 virgen, para el que lo hizo mal. y le tira muchos errores..
Si van a tirar comentarios negativos, plis no mamen, si ven algun error en el code, avisen.. O posteen.
SISTEMA DE COMBOS ZP
BY: BLACKK
CREDITOS: AguuS.- optimización de takedamage
En el principio del plugin.
Código PHP:
// Creamos las Variables necesarias, las colocan donde quieran.
new gComboHud, g_finish // Hud del combo, showhud, y finalización
const DUENIO = ADMIN_RCON // ganancia de admin, según su tipo
const STAFF = ADMIN_LEVEL_A
const ADMIN = ADMIN_LEVEL_B
const VIP_FULL = ADMIN_LEVEL_C
const VIP_COMUN = ADMIN_LEVEL_D
const VIP_BASICO = ADMIN_LEVEL_E
new gDamageDealt[33] = { 0, ... }, gCombo[33] = { 0, ... }, gComboDamage[33] = { 0, ... }, g_hits[33] // Variables del combo
enum _:gComboData {
gCombos, gMessage[90], gMulti, Rojo, Verde, Azul // combos, mensajes y los colores del combo
}
new const gComboInfo[][gComboData] = {
{ 0, "Bien!", 1, 0, 255, 255 }, { 100, "Muy bien!", 1, 0, 255, 255 }, // Los mensajes y su respectivo color, ( lo modifican a gusto )
{ 250, "Black!", 2, 255, 255, 0 }, { 340, "Perfecto!", 3, 0, 255, 0 },
{ 450, "Destructor!", 4, 255, 0, 0 }, { 610, "Hiper Destructor!", 5, 255, 0, 255 }
}
#define ID_COMBO (taskid - TASK_COMBO) // el define del task combo
Código PHP:
// Luego buscamos lo siguiente
public plugin_init(){
// code code.. bla bla
g_finish = CreateHudSyncObj() // creamos los huds
gComboHud = CreateHudSyncObj()
}
// luego vamos a
// Task offsets
enum (+= 100)
{
TASK_MODEL = 2000,
TASK_TEAM,
TASK_SPAWN,
TASK_BLOOD,
TASK_NVISION,
TASK_FLASH,
TASK_CHARGE,
TASK_SHOWHUD,
TASK_NADES,
TASK_MAKEZOMBIE,
TASK_WELCOMEMSG,
TASK_THUNDER_PRE,
TASK_THUNDER,
TASK_AMBIENCESOUNDS,
TASK_LIGHTING,
TASK_COMBO // quedaría así
}
// Le agregamos TASK_COMBO
// Luego vamos
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
y lo remplazan todo por esto
// Ham Take Damage Forward (inflictor = weapon)
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if (victim == attacker || !is_user_connected(attacker)) return HAM_IGNORED;
if (g_newround || g_endround) return HAM_SUPERCEDE;
if (g_nodamage[victim]) return HAM_SUPERCEDE;
if (g_zombie[attacker] == g_zombie[victim]) return HAM_SUPERCEDE;
if (!g_zombie[attacker]) {
gDamageDealt[attacker] += floatround(damage)
gComboDamage[attacker] += floatround(damage)
g_hits[attacker]++
remove_task(attacker+TASK_COMBO)
static szDamage; szDamage = 125
while (gDamageDealt[attacker] >= szDamage) {
if (get_user_flags(attacker) & STAFF) {
g_ammopacks[attacker] +=6
gCombo[attacker] += 6
}
else if (get_user_flags(attacker) & ADMIN) {
g_ammopacks[attacker] += 5
gCombo[attacker] += 5
}
else if (get_user_flags(attacker) & VIP_FULL) {
g_ammopacks[attacker] += 4
gCombo[attacker] += 4
}
else if (get_user_flags(attacker) & VIP_COMUN) {
g_ammopacks[attacker] += 3
gCombo[attacker] += 3
}
else if (get_user_flags(attacker) & VIP_BASICO) {
g_ammopacks[attacker] += 2
gCombo[attacker]+= 2
}
else {
g_ammopacks[attacker] = gCombo[attacker]++
}
gDamageDealt[attacker] -= szDamage
}
new szComboDamage[10]
acortar(floatround(damage), szComboDamage, 9)
for (new i; i < sizeof(gComboInfo); i++) {
if (gCombo[attacker] >= gComboInfo[i][gCombos]) {
set_hudmessage(gComboInfo[i][Rojo], gComboInfo[i][Verde], gComboInfo[i][Azul], -1.0, 0.27, 1, 1.5, 1.5, 1.0, 1.0)
ShowSyncHudMsg(attacker, gComboHud, "Combo %s ammo packs^n%s %d hits %s de Daño^nhit %s de Daño^nMultiplicado x%d",Add_Point(gCombo[attacker]),gComboInfo[i][gMessage], g_hits[attacker], Add_Point(gComboDamage[attacker]), szComboDamage, gComboInfo[i][gMulti])
}
}
set_task(5.0, "Finish_Combo", attacker+TASK_COMBO)
if (g_survivor[attacker]) damage *= 1.5
else damage *= 1.3
g_damagedealt[attacker] += floatround(damage)
static ammodamage; ammodamage = 500
while (g_damagedealt[attacker] >= ammodamage) {
g_ammopacks[attacker]++
g_damagedealt[attacker] -= ammodamage
}
}
else {
if (g_nemesis[attacker]) {
if (inflictor == attacker) {
if (pev(attacker, pev_button) & IN_ATTACK) damage = 150.0
else if (pev(attacker, pev_button) & IN_ATTACK2) damage = 300.0
}
}
else {
if (inflictor == attacker) {
if (pev(attacker, pev_button) & IN_ATTACK) damage *= 1.2
else if (pev(attacker, pev_button) & IN_ATTACK2) damage *= 1.4
}
}
}
SetHamParamFloat(4, damage)
if (g_swarmround || g_plagueround || g_survround || g_nemround || fnGetHumans() == 1 || !g_zombie[attacker]) return HAM_IGNORED;
static Float:armor; pev(victim, pev_armorvalue, armor)
if (armor > 0.0) {
emit_sound(victim, CHAN_BODY, sound_armorhit[random_num(0, sizeof sound_armorhit - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM)
set_pev(victim, pev_armorvalue, floatmax(0.0, armor - damage))
return HAM_SUPERCEDE;
}
SendDeathMsg(attacker, victim)
FixDeadAttrib(victim)
UpdateFrags(attacker, victim, 1, 1, 1)
zombieme(victim, attacker, 0, 0)
return HAM_SUPERCEDE;
}
public Finish_Combo(taskid) {
if (!gCombo[ID_COMBO] & !g_hits[ID_COMBO]) return; new i
for (i = 0; i < sizeof(gComboInfo)-1; i++) {
if (gComboInfo[i+1][gCombos] > gCombo[ID_COMBO]) break;
}
static szBono; szBono = gCombo[ID_COMBO] * gComboInfo[i][gMulti]
set_hudmessage(255, 20, 147, -1.0, -1.0, 2, 6.0, 7.0)
ShowSyncHudMsg(ID_COMBO, g_finish, "Combo finalizado (%s) Multiplicado x%d^n%s Ammopacks^n",Add_Point(gCombo[ID_COMBO]), gComboInfo[i][gMulti], Add_Point(szBono))
g_ammopacks[ID_COMBO] += szBono
gComboDamage[ID_COMBO] = g_hits[ID_COMBO] = gCombo[ID_COMBO] = 0
SUBIRNIVEL(ID_COMBO) // ESTO ES EL CHECK LEVEL Q TENGAN USTEDES
}
Código PHP:
stock acortar(num, szNum[], len){
if (num <= -1000000 || num >= 1000000) formatex(szNum, len, "%.3fM", floatdiv(float(num), 1000000.0));
else if (num <= -1000 || num >= 1000) formatex(szNum, len, "%.2fK", floatdiv(float(num), 1000.0));
else num_to_str(num, szNum, len);
}
stock Add_Point(number) {
new szCount, szString[15], szString2[15], szLen
num_to_str(number, szString, charsmax(szString))
szLen = strlen(szString)
for (new i = 0; i < szLen; i++) {
if (i != 0 && ((szLen - i) %3 == 0)) {
add(szString2, charsmax(szString2), ".", 1)
szCount++
add(szString2[i+szCount], 1, szString[i], 1)
}
else add(szString2[i+szCount], 1, szString[i], 1)
}
return szString2;
}
Si van a tirar comentarios negativos, plis no mamen, si ven algun error en el code, avisen.. O posteen.
https://steamcommunity.com/id/adriancek1ng/
Aquellos que te critican quieren verte distinto,
Por que ven en ti lo que ellos no serán jamás.
Aquellos que te critican quieren verte distinto,
Por que ven en ti lo que ellos no serán jamás.