Ayuda crear clase humana con doble daño de cuchillo ZP
#1
Bueno, me gustaría que esta clase humana por ejemplo haga doble daño al golpear con el primario y triple al secundario, he visto un par de ejemplos por ahi pero ninguno me sirvió, ¿Podrían ayudarme porfavor?


Archivos adjuntos
.sma   Descargar AMXX / zpxp_1_humano_normal.sma (Tamaño: 2.21 KB / Descargas: 2)
No hay mejor maestro que la experiencia más amarga de uno mismo, todo parece imposible hasta que se hace.
Responder
#2
Código PHP:
/*================================================================================
Human Test
================================================================================*/

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta_util>
#include <cstrike>
#include <zombieplague>
#include <zombiexp>
#include <fun>

#define PLUGIN "Humano Principiante"
#define VERSION "1.0"
#define AUTHOR "Catalin"

// Human Attributes
new const hclass_name[] = { "Principiante" // name
new const hclass_info[] = { "Deagle, Elite y Fiveseven" // description
new const hclass_model[] = { "sas" // model
new const hclass_weapons[] = { WEAPON_DEAGLEWEAPON_ELITEWEAPON_FIVESEVEN // weapons
const hclass_health 100 // health
const hclass_speed 240 // speed
const Float:hclass_gravity 1.0 // gravity
const hclass_level // level required to use

// Class IDs
new g_humano_principiante

// Zombie Classes MUST be registered on plugin_precache
public plugin_precache()
{
    new 
registerText[32]
    
formatexregisterTextsizeof registerText 1"[ZP] %s"hclass_name)
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
    
register_plugin(registerText"1.0""Humano Principiante")
    
    
// Register the new class and store ID for reference
    
g_humano_principiante zpxp_register_human_class(hclass_namehclass_infohclass_modelhclass_weaponshclass_healthhclass_speedhclass_gravityhclass_level)
    
}

// User Infected forward
public zp_user_infected_post(idinfector)
{
    
// Check if the infected player is using our custom zombie class
    
if (zp_get_user_human_class(id) != g_humano_principiante) return;
    
    
// Undo any settings we have saved here
    
}

public 
zp_user_humanized_post(id)
{
    
// Check if the infected player is using our custom zombie class
    
if (zp_get_user_human_class(id) != g_humano_principiante) return;

    
// User turned human
    
if (zp_get_user_survivor(id) == 1)
    {
        
// He's survivor, remove any changes made in the plugin
        
zp_user_infected_post(id00)
    } else {
        
zp_round_started_human(id)
    }
}

//This is a forward from zpxp, as opposed to ZPs round_start (which is when infection begins) this is the true beginning of the round
public zp_round_started_human(id)
{
    if (
zp_get_user_human_class(id) != g_humano_principiante) return;
    
    
// Set our human's powers!
        
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamagebits)
{
    if(!
is_user_connected(victim) || !is_user_connected(attacker) || zp_get_user_human_class(attacker) != g_humano_principiante) return HAM_IGNORED
    
    SetHamParamFloat
(4damage 7); // Aqui el daño que quieres que aga
    
    
return HAM_IGNORED


Deberia de ir prueba
Responder
#3
(11/04/2020, 03:11 PM)Evilz escribió:
Código PHP:
/*================================================================================
Human Test
================================================================================*/

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta_util>
#include <cstrike>
#include <zombieplague>
#include <zombiexp>
#include <fun>

#define PLUGIN "Humano Principiante"
#define VERSION "1.0"
#define AUTHOR "Catalin"

// Human Attributes
new const hclass_name[] = { "Principiante" // name
new const hclass_info[] = { "Deagle, Elite y Fiveseven" // description
new const hclass_model[] = { "sas" // model
new const hclass_weapons[] = { WEAPON_DEAGLEWEAPON_ELITEWEAPON_FIVESEVEN // weapons
const hclass_health 100 // health
const hclass_speed 240 // speed
const Float:hclass_gravity 1.0 // gravity
const hclass_level // level required to use

// Class IDs
new g_humano_principiante

// Zombie Classes MUST be registered on plugin_precache
public plugin_precache()
{
    new 
registerText[32]
    
formatexregisterTextsizeof registerText 1"[ZP] %s"hclass_name)
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
    
register_plugin(registerText"1.0""Humano Principiante")
    
    
// Register the new class and store ID for reference
    
g_humano_principiante zpxp_register_human_class(hclass_namehclass_infohclass_modelhclass_weaponshclass_healthhclass_speedhclass_gravityhclass_level)
    
}

// User Infected forward
public zp_user_infected_post(idinfector)
{
    
// Check if the infected player is using our custom zombie class
    
if (zp_get_user_human_class(id) != g_humano_principiante) return;
    
    
// Undo any settings we have saved here
    
}

public 
zp_user_humanized_post(id)
{
    
// Check if the infected player is using our custom zombie class
    
if (zp_get_user_human_class(id) != g_humano_principiante) return;

    
// User turned human
    
if (zp_get_user_survivor(id) == 1)
    {
        
// He's survivor, remove any changes made in the plugin
        
zp_user_infected_post(id00)
    } else {
        
zp_round_started_human(id)
    }
}

//This is a forward from zpxp, as opposed to ZPs round_start (which is when infection begins) this is the true beginning of the round
public zp_round_started_human(id)
{
    if (
zp_get_user_human_class(id) != g_humano_principiante) return;
    
    
// Set our human's powers!
        
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamagebits)
{
    if(!
is_user_connected(victim) || !is_user_connected(attacker) || zp_get_user_human_class(attacker) != g_humano_principiante) return HAM_IGNORED
    
    SetHamParamFloat
(4damage 7); // Aqui el daño que quieres que aga
    
    
return HAM_IGNORED


Deberia de ir prueba

El daño es para todas las armas, como puedo solo para el knife?
No hay mejor maestro que la experiencia más amarga de uno mismo, todo parece imposible hasta que se hace.
Responder
#4
Código PHP:
if(!is_user_connected(victim) || !is_user_connected(attacker) || zp_get_user_human_class(attacker) != g_humano_principiante && get_user_weapon(attacker) != CSW_KNIFE) return HAM_IGNORED 
[Imagen: bvpq9q-6.png]

NO DOY AYUDA VIA MENSAJE PRIVADO

* Si requieres algún servicio de pago puedes contactarme vía MP o en mi facebook
Responder
#5
(11/04/2020, 06:36 PM)kikizon2 escribió:
Código PHP:
if(!is_user_connected(victim) || !is_user_connected(attacker) || zp_get_user_human_class(attacker) != g_humano_principiante && get_user_weapon(attacker) != CSW_KNIFE) return HAM_IGNORED 

No funciona, sigue haciendo daño con todas las armas.
No hay mejor maestro que la experiencia más amarga de uno mismo, todo parece imposible hasta que se hace.
Responder
#6
Prueba abr Whatdone

Código PHP:
public fw_TakeDamage(victiminflictorattackerFloat:damagedamagebits)
{
    if(!
is_user_connected(victim) || !is_user_connected(attacker) || zp_get_user_human_class(attacker) != g_humano_principiante) return HAM_IGNORED
    
    
new weapon get_user_weapon(attacker);
    new 
weaponType// 1 primaria, 2 secundaria, 3 cuchillo
    
    
switch(weapon) {
        case 
CSW_M3CSW_XM1014CSW_TMPCSW_MAC10CSW_MP5NAVYCSW_UMP45CSW_P90CSW_GALILCSW_FAMASCSW_AK47CSW_M4A1CSW_AUGCSW_SG552CSW_SG550CSW_G3SG1CSW_AWPCSW_SCOUTCSW_M249:
            
weaponType 1;
        case 
CSW_GLOCK18CSW_USPCSW_P228CSW_DEAGLECSW_FIVESEVENCSW_ELITE:
            
weaponType 2;
        case 
CSW_KNIFE:
            
weaponType 3;
    }
    
    
    
    if(
weaponType == 1)  // Check de que el arma con el que pego es un arma primaria
        
SetHamParamFloat(4damage 2); // Se va a multiplicar por 2 el daño
    
else if(weaponType == 2)  // Check de que el arma con el que pego es un arma secundaria
        
SetHamParamFloat(4damage 3); // Se va a multiplicar por 3 el daño
    
else if(weaponType == 3)  // Check de que el arma con el que pego es un machete 7u7
        
SetHamParamFloat(4damage 7); // Se va a multiplicar por 7 el daño
    
else 
        
SetHamParamFloat(4damage); // No se si sea necesario esto xD
        
    
return HAM_IGNORED

Estoy cansado de este sufrimiento llamado vivir en Venezuela
Okay
Responder
#7
(12/04/2020, 02:02 PM)samueldmq escribió: Prueba abr Whatdone

Código PHP:
public fw_TakeDamage(victiminflictorattackerFloat:damagedamagebits)
{
    if(!
is_user_connected(victim) || !is_user_connected(attacker) || zp_get_user_human_class(attacker) != g_humano_principiante) return HAM_IGNORED
    
    
new weapon get_user_weapon(attacker);
    new 
weaponType// 1 primaria, 2 secundaria, 3 cuchillo
    
    
switch(weapon) {
        case 
CSW_M3CSW_XM1014CSW_TMPCSW_MAC10CSW_MP5NAVYCSW_UMP45CSW_P90CSW_GALILCSW_FAMASCSW_AK47CSW_M4A1CSW_AUGCSW_SG552CSW_SG550CSW_G3SG1CSW_AWPCSW_SCOUTCSW_M249:
            
weaponType 1;
        case 
CSW_GLOCK18CSW_USPCSW_P228CSW_DEAGLECSW_FIVESEVENCSW_ELITE:
            
weaponType 2;
        case 
CSW_KNIFE:
            
weaponType 3;
    }
    
    
    
    if(
weaponType == 1)  // Check de que el arma con el que pego es un arma primaria
        
SetHamParamFloat(4damage 2); // Se va a multiplicar por 2 el daño
    
else if(weaponType == 2)  // Check de que el arma con el que pego es un arma secundaria
        
SetHamParamFloat(4damage 3); // Se va a multiplicar por 3 el daño
    
else if(weaponType == 3)  // Check de que el arma con el que pego es un machete 7u7
        
SetHamParamFloat(4damage 7); // Se va a multiplicar por 7 el daño
    
else 
        
SetHamParamFloat(4damage); // No se si sea necesario esto xD
        
    
return HAM_IGNORED


Código PHP:
public fw_TakeDamage(victiminflictorattackerFloat:damagedamagebits)
{
    if(!
is_user_connected(victim) || !is_user_connected(attacker) || zp_get_user_human_class(attacker) != g_humano_principiante) return HAM_IGNORED
    
    
new weapon get_user_weapon(attacker);
    
    switch(
weapon) {
        case 
CSW_M3CSW_XM1014CSW_TMPCSW_MAC10CSW_MP5NAVYCSW_UMP45CSW_P90CSW_GALILCSW_FAMASCSW_AK47CSW_M4A1CSW_AUGCSW_SG552CSW_SG550CSW_G3SG1CSW_AWPCSW_SCOUTCSW_M249:
            
SetHamParamFloat(4damage 2); // Se va a multiplicar por 2 el daño
        
case CSW_GLOCK18CSW_USPCSW_P228CSW_DEAGLECSW_FIVESEVENCSW_ELITE:
            
SetHamParamFloat(4damage 3); // Se va a multiplicar por 3 el daño
        
case CSW_KNIFE:
            
SetHamParamFloat(4damage 7); // Se va a multiplicar por 7 el daño
    
}
        
    return 
HAM_IGNORED


Podrías agregar default: SetHamParamFloat(4, damage); pero no es necesario

Responder
#8
Amigo sois unos genios, muchas gracias, me quedo con la solución de Skylar, ¿Como podría evitar que esta función afecte al survivor o a los demás modos del zombie plague? algún ejemplo?, porque si tengo esta clase seleccionada por ejemplo y me pongo el survivor el daño afecta al survivor. creo que era zp_is_survivor_round() o algo así

Código PHP:
public fw_TakeDamage(victiminflictorattackerFloat:damagedamagebits)
{
    if(!
is_user_connected(victim) || !is_user_connected(attacker) || zp_get_user_human_class(attacker) != g_humano_principiante) return HAM_IGNORED
    
    
new weapon get_user_weapon(attacker);
    
    switch(
weapon) {
        case 
CSW_M3CSW_XM1014CSW_TMPCSW_MAC10CSW_MP5NAVYCSW_UMP45CSW_P90CSW_GALILCSW_FAMASCSW_AK47CSW_M4A1CSW_AUGCSW_SG552CSW_SG550CSW_G3SG1CSW_AWPCSW_SCOUTCSW_M249:
            
SetHamParamFloat(4damage 2); // Se va a multiplicar por 2 el daño
        
case CSW_GLOCK18CSW_USPCSW_P228CSW_DEAGLECSW_FIVESEVENCSW_ELITE:
            
SetHamParamFloat(4damage 3); // Se va a multiplicar por 3 el daño
        
case CSW_KNIFE:
            
SetHamParamFloat(4damage 7); // Se va a multiplicar por 7 el daño
    
}
        
    return 
HAM_IGNORED

No hay mejor maestro que la experiencia más amarga de uno mismo, todo parece imposible hasta que se hace.
Responder
#9
(15/04/2020, 06:38 PM)Tig escribió: Amigo sois unos genios, muchas gracias, me quedo con la solución de Skylar, ¿Como podría evitar que esta función afecte al survivor o a los demás modos del zombie plague? algún ejemplo?, porque si tengo esta clase seleccionada por ejemplo y me pongo el survivor el daño afecta al survivor. creo que era zp_is_survivor_round() o algo así

Código PHP:
public fw_TakeDamage(victiminflictorattackerFloat:damagedamagebits)
{
    if(!
is_user_connected(victim) || !is_user_connected(attacker) || zp_get_user_human_class(attacker) != g_humano_principiante) return HAM_IGNORED
    
    
new weapon get_user_weapon(attacker);
    
    switch(
weapon) {
        case 
CSW_M3CSW_XM1014CSW_TMPCSW_MAC10CSW_MP5NAVYCSW_UMP45CSW_P90CSW_GALILCSW_FAMASCSW_AK47CSW_M4A1CSW_AUGCSW_SG552CSW_SG550CSW_G3SG1CSW_AWPCSW_SCOUTCSW_M249:
            
SetHamParamFloat(4damage 2); // Se va a multiplicar por 2 el daño
        
case CSW_GLOCK18CSW_USPCSW_P228CSW_DEAGLECSW_FIVESEVENCSW_ELITE:
            
SetHamParamFloat(4damage 3); // Se va a multiplicar por 3 el daño
        
case CSW_KNIFE:
            
SetHamParamFloat(4damage 7); // Se va a multiplicar por 7 el daño
    
}
        
    return 
HAM_IGNORED


Creo que es
Código PHP:
if(g_class[victim] == SURVIVOR) return HAM_IGNORED
 
// g_class[victim] == wesker/sniper,etc 
pdt: nunca me contestaste mp xD
Responder
#10
(15/04/2020, 06:43 PM)Nazy.- escribió:
(15/04/2020, 06:38 PM)Tig escribió: Amigo sois unos genios, muchas gracias, me quedo con la solución de Skylar, ¿Como podría evitar que esta función afecte al survivor o a los demás modos del zombie plague? algún ejemplo?, porque si tengo esta clase seleccionada por ejemplo y me pongo el survivor el daño afecta al survivor. creo que era zp_is_survivor_round() o algo así

Código PHP:
public fw_TakeDamage(victiminflictorattackerFloat:damagedamagebits)
{
    if(!
is_user_connected(victim) || !is_user_connected(attacker) || zp_get_user_human_class(attacker) != g_humano_principiante) return HAM_IGNORED
    
    
new weapon get_user_weapon(attacker);
    
    switch(
weapon) {
        case 
CSW_M3CSW_XM1014CSW_TMPCSW_MAC10CSW_MP5NAVYCSW_UMP45CSW_P90CSW_GALILCSW_FAMASCSW_AK47CSW_M4A1CSW_AUGCSW_SG552CSW_SG550CSW_G3SG1CSW_AWPCSW_SCOUTCSW_M249:
            
SetHamParamFloat(4damage 2); // Se va a multiplicar por 2 el daño
        
case CSW_GLOCK18CSW_USPCSW_P228CSW_DEAGLECSW_FIVESEVENCSW_ELITE:
            
SetHamParamFloat(4damage 3); // Se va a multiplicar por 3 el daño
        
case CSW_KNIFE:
            
SetHamParamFloat(4damage 7); // Se va a multiplicar por 7 el daño
    
}
        
    return 
HAM_IGNORED


Creo que es
Código PHP:
if(g_class[victim] == SURVIVOR) return HAM_IGNORED
 
// g_class[victim] == wesker/sniper,etc 
pdt: nunca me contestaste mp xD

¿Podrías hacer un ejemplo con el code?
No hay mejor maestro que la experiencia más amarga de uno mismo, todo parece imposible hasta que se hace.
Responder
#11
Cambiar esta línea debería solucionarlo:
Código PHP:
if(!is_user_connected(victim) || !is_user_connected(attacker) || zp_get_user_human_class(attacker) != g_humano_principiante || !zp_get_user_zombie(victim)) return HAM_IGNORED 
Responder
#12
No me funcionó, pero cambiando la linea de esta forma he conseguido que funcione bien, el survivor no le afecta teniendo la clase humana seleccionada, lo mismo no es la mejor solución pero funciona, que comenten los expertos que opinan de la solución, para que no intervenga en otras funciones del zombie plague ¿Estaría bien así?

Código PHP:
if(!is_user_connected(victim) || !is_user_connected(attacker) || zp_get_user_human_class(attacker) != g_humano_desarollado || zp_get_user_survivor(attacker)) return HAM_IGNORED 
No hay mejor maestro que la experiencia más amarga de uno mismo, todo parece imposible hasta que se hace.
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)