10/04/2020, 08:01 AM (Última modificación: 10/04/2020, 08:01 AM por Tig. Edited 1 time in total.)
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?
No hay mejor maestro que la experiencia más amarga de uno mismo, todo parece imposible hasta que se hace.
/*================================================================================ Human Test ================================================================================*/
#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_DEAGLE, WEAPON_ELITE, WEAPON_FIVESEVEN } // weapons const hclass_health = 100 // health const hclass_speed = 240 // speed const Float:hclass_gravity = 1.0 // gravity const hclass_level = 1 // level required to use
// Class IDs new g_humano_principiante
// Zombie Classes MUST be registered on plugin_precache public plugin_precache() { new registerText[32] formatex( registerText, sizeof registerText - 1, "[ZP] %s", hclass_name) RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
// Register the new class and store ID for reference g_humano_principiante = zpxp_register_human_class(hclass_name, hclass_info, hclass_model, hclass_weapons, hclass_health, hclass_speed, hclass_gravity, hclass_level)
}
// User Infected forward public zp_user_infected_post(id, infector) { // 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(id, 0, 0) } 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;
11/04/2020, 03:38 PM (Última modificación: 11/04/2020, 04:54 PM por Tig. Edited 1 time in total.)
(11/04/2020, 03:11 PM)Evilz escribió:
Código PHP:
/*================================================================================ Human Test ================================================================================*/
#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_DEAGLE, WEAPON_ELITE, WEAPON_FIVESEVEN } // weapons const hclass_health = 100 // health const hclass_speed = 240 // speed const Float:hclass_gravity = 1.0 // gravity const hclass_level = 1 // level required to use
// Class IDs new g_humano_principiante
// Zombie Classes MUST be registered on plugin_precache public plugin_precache() { new registerText[32] formatex( registerText, sizeof registerText - 1, "[ZP] %s", hclass_name) RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
// Register the new class and store ID for reference g_humano_principiante = zpxp_register_human_class(hclass_name, hclass_info, hclass_model, hclass_weapons, hclass_health, hclass_speed, hclass_gravity, hclass_level)
}
// User Infected forward public zp_user_infected_post(id, infector) { // 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(id, 0, 0) } 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;
if(weaponType == 1) // Check de que el arma con el que pego es un arma primaria SetHamParamFloat(4, damage * 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(4, damage * 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(4, damage * 7); // Se va a multiplicar por 7 el daño else SetHamParamFloat(4, damage); // No se si sea necesario esto xD
return HAM_IGNORED }
Estoy cansado de este sufrimiento llamado vivir en Venezuela
if(weaponType == 1) // Check de que el arma con el que pego es un arma primaria SetHamParamFloat(4, damage * 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(4, damage * 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(4, damage * 7); // Se va a multiplicar por 7 el daño else SetHamParamFloat(4, damage); // No se si sea necesario esto xD
switch(weapon) { case CSW_M3, CSW_XM1014, CSW_TMP, CSW_MAC10, CSW_MP5NAVY, CSW_UMP45, CSW_P90, CSW_GALIL, CSW_FAMAS, CSW_AK47, CSW_M4A1, CSW_AUG, CSW_SG552, CSW_SG550, CSW_G3SG1, CSW_AWP, CSW_SCOUT, CSW_M249: SetHamParamFloat(4, damage * 2); // Se va a multiplicar por 2 el daño case CSW_GLOCK18, CSW_USP, CSW_P228, CSW_DEAGLE, CSW_FIVESEVEN, CSW_ELITE: SetHamParamFloat(4, damage * 3); // Se va a multiplicar por 3 el daño case CSW_KNIFE: SetHamParamFloat(4, damage * 7); // Se va a multiplicar por 7 el daño }
return HAM_IGNORED }
Podrías agregar default: SetHamParamFloat(4, damage); pero no es necesario
15/04/2020, 06:38 PM (Última modificación: 15/04/2020, 06:39 PM por Tig. Edited 2 times in total.)
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í
switch(weapon) { case CSW_M3, CSW_XM1014, CSW_TMP, CSW_MAC10, CSW_MP5NAVY, CSW_UMP45, CSW_P90, CSW_GALIL, CSW_FAMAS, CSW_AK47, CSW_M4A1, CSW_AUG, CSW_SG552, CSW_SG550, CSW_G3SG1, CSW_AWP, CSW_SCOUT, CSW_M249: SetHamParamFloat(4, damage * 2); // Se va a multiplicar por 2 el daño case CSW_GLOCK18, CSW_USP, CSW_P228, CSW_DEAGLE, CSW_FIVESEVEN, CSW_ELITE: SetHamParamFloat(4, damage * 3); // Se va a multiplicar por 3 el daño case CSW_KNIFE: SetHamParamFloat(4, damage * 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.
(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í
switch(weapon) { case CSW_M3, CSW_XM1014, CSW_TMP, CSW_MAC10, CSW_MP5NAVY, CSW_UMP45, CSW_P90, CSW_GALIL, CSW_FAMAS, CSW_AK47, CSW_M4A1, CSW_AUG, CSW_SG552, CSW_SG550, CSW_G3SG1, CSW_AWP, CSW_SCOUT, CSW_M249: SetHamParamFloat(4, damage * 2); // Se va a multiplicar por 2 el daño case CSW_GLOCK18, CSW_USP, CSW_P228, CSW_DEAGLE, CSW_FIVESEVEN, CSW_ELITE: SetHamParamFloat(4, damage * 3); // Se va a multiplicar por 3 el daño case CSW_KNIFE: SetHamParamFloat(4, damage * 7); // Se va a multiplicar por 7 el daño }
(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í
switch(weapon) { case CSW_M3, CSW_XM1014, CSW_TMP, CSW_MAC10, CSW_MP5NAVY, CSW_UMP45, CSW_P90, CSW_GALIL, CSW_FAMAS, CSW_AK47, CSW_M4A1, CSW_AUG, CSW_SG552, CSW_SG550, CSW_G3SG1, CSW_AWP, CSW_SCOUT, CSW_M249: SetHamParamFloat(4, damage * 2); // Se va a multiplicar por 2 el daño case CSW_GLOCK18, CSW_USP, CSW_P228, CSW_DEAGLE, CSW_FIVESEVEN, CSW_ELITE: SetHamParamFloat(4, damage * 3); // Se va a multiplicar por 3 el daño case CSW_KNIFE: SetHamParamFloat(4, damage * 7); // Se va a multiplicar por 7 el daño }
16/04/2020, 07:10 AM (Última modificación: 16/04/2020, 08:29 AM por Tig. Edited 1 time in total.)
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í?