public native_core_infect(plugin_id, num_params) { new id = get_param(1)
if (!is_user_alive(id)) { log_error(AMX_ERR_NATIVE, "[ZP] Invalid Player (%d)", id) return false; }
if (flag_get(g_IsZombie, id)) { log_error(AMX_ERR_NATIVE, "[ZP] Player already infected (%d)", id) return false; }
new attacker = get_param(2)
if (attacker && !is_user_connected(attacker)) { log_error(AMX_ERR_NATIVE, "[ZP] Invalid Player (%d)", attacker) return false; }
InfectPlayer(id, attacker) return true; }
Infection Grenade Plugin
PHP Code:
public grenade_explode(ent) { // Get attacker new attacker = pev(ent, pev_owner)
// Infection bomb owner disconnected or not zombie anymore? if (!is_user_connected(attacker) || !zp_core_is_zombie(attacker)) { // Get rid of the grenade engfunc(EngFunc_RemoveEntity, ent) return; }
// Collisions new victim = -1
while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, origin, NADE_EXPLOSION_RADIUS)) != 0) { // Only effect alive humans if (!is_user_alive(victim) || zp_core_is_zombie(victim)) continue;
// Last human is killed if (zp_core_get_human_count() == 1) { ExecuteHamB(Ham_Killed, victim, attacker, 0) continue; }
// Turn into zombie zp_core_infect(victim, attacker) } }
Rewards plugin
PHP Code:
public zp_fw_core_infect_post(victim, attacker) { // display a message to attacker }
I want to add an optional, not mandatory third parameter to the forwards and the native, so i can use the third parameter in the infection bomb to tell in the rewards plugin that the infection was done with the bomb, and to not display the message
Example
Infection Grenade Plugin
PHP Code:
public grenade_explode(ent) { // Get attacker new attacker = pev(ent, pev_owner)
// Infection bomb owner disconnected or not zombie anymore? if (!is_user_connected(attacker) || !zp_core_is_zombie(attacker)) { // Get rid of the grenade engfunc(EngFunc_RemoveEntity, ent) return; }
// Collisions new victim = -1
while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, origin, NADE_EXPLOSION_RADIUS)) != 0) { // Only effect alive humans if (!is_user_alive(victim) || zp_core_is_zombie(victim)) continue;
// Last human is killed if (zp_core_get_human_count() == 1) { ExecuteHamB(Ham_Killed, victim, attacker, 0) continue; }
// Turn into zombie zp_core_infect(victim, attacker, 1) } }
Rewards plugin
PHP Code:
public zp_fw_core_infect_post(victim, attacker, condition) { if(condition = 1) return
// display a message to attacker }
Along with this, i want to be able to call the native and like this, in case i don't want to send the extra param -> zp_core_infect(victim, attacker)