PHP Code:
/*=======================================================
*******************
- Incendiary Bullets
- v1.0
- Kiske
*******************
[ZP] Item: Incendiary Bullets
Copyright (C) 2012 by Kiske, Buenos Aires, Argentina
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
In addition, as a special exception, the author gives permission to
link the code of this program with the Half-Life Game Engine ("HL
Engine") and Modified Game Libraries ("MODs") developed by Valve,
L.L.C ("Valve"). You must obey the GNU General Public License in all
respects for all of the code used other than the HL Engine and MODs
from Valve. If you modify this file, you may extend this exception
to your version of the file, but you are not obligated to do so. If
you do not wish to do so, delete this exception statement from your
version.
=======================================================*/
#include <amxmodx>
#include <fun>
#include <engine>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#include <zp50_core>
#include <zp50_class_nemesis>
#include <zp50_class_survivor>
#include <zp50_gamemodes>
#include <zp50_grenade_fire>
#include <zp50_items>
/*
=================
= Customization =
=================
*/
#define ITEM_NAME "Incendiary Bullets"
#define ITEM_COST 20
/*
===========================================================
= Customizble part end here. Editing anything beyond here =
= is not officially supported. Proceed at your own risk.. =
===========================================================
*/
#define flag_get(%1,%2) (%1 & (1 << (%2 & 31)))
#define flag_set(%1,%2) %1 |= (1 << (%2 & 31))
#define flag_unset(%1,%2) %1 &= ~(1 << (%2 & 31))
new g_IncendiaryBullets;
new g_ItemID;
new g_GameModeNemesisID;
new g_pCVAR_ItemEnable;
new g_pCVAR_InB_Accumulate;
new g_pCVAR_InB_ExtraDmgMult;
new g_pCVAR_InB_Nemesis;
public plugin_init()
{
register_plugin("[ZP] Item: Incendiary Bullets", "v1.0", "Kiske");
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled");
RegisterHam(Ham_TakeDamage, "player", "fw_PlayerTakeDamage");
g_pCVAR_ItemEnable = register_cvar("zp_inb_enable", "1");
g_pCVAR_InB_Accumulate = register_cvar("zp_inb_accumulate", "0");
g_pCVAR_InB_ExtraDmgMult = register_cvar("zp_inb_extra_damage_mult", "2");
g_pCVAR_InB_Nemesis = register_cvar("zp_inb_nemesis", "0");
g_ItemID = zp_items_register(ITEM_NAME, ITEM_COST);
}
public plugin_cfg()
{
g_GameModeNemesisID = zp_gamemodes_get_id("Nemesis Mode");
}
public client_disconnect(id)
{
flag_unset(g_IncendiaryBullets, id);
}
public zp_fw_items_select_pre(id, itemid, ignorecost)
{
if(itemid == g_ItemID)
{
if(!get_pcvar_num(g_pCVAR_ItemEnable))
return ZP_ITEM_DONT_SHOW;
if(zp_core_is_zombie(id) || zp_class_survivor_get(id) || zp_class_nemesis_get(id))
return ZP_ITEM_DONT_SHOW;
new iCurrentGameMode = zp_gamemodes_get_current();
if(!get_pcvar_num(g_pCVAR_InB_Nemesis) && iCurrentGameMode == g_GameModeNemesisID)
return ZP_ITEM_DONT_SHOW;
if(iCurrentGameMode == ZP_NO_GAME_MODE)
return ZP_ITEM_NOT_AVAILABLE;
if(flag_get(g_IncendiaryBullets, id))
return ZP_ITEM_NOT_AVAILABLE;
}
return ZP_ITEM_AVAILABLE;
}
public zp_fw_items_select_post(id, itemid, ignorecost)
{
if(itemid != g_ItemID)
return;
flag_set(g_IncendiaryBullets, id);
}
public fw_PlayerKilled(victim, attacker, shouldgib)
{
flag_unset(g_IncendiaryBullets, victim);
}
public fw_PlayerTakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
if(victim == attacker || !is_user_alive(attacker))
return HAM_IGNORED;
if(flag_get(g_IncendiaryBullets, attacker) && get_user_weapon(attacker) != CSW_KNIFE)
{
if((zp_grenade_fire_get(victim) && get_pcvar_num(g_pCVAR_InB_Accumulate)) || !zp_grenade_fire_get(victim))
{
zp_grenade_fire_set(victim, 1);
}
if(get_pcvar_float(g_pCVAR_InB_ExtraDmgMult) == 1.00)
return HAM_IGNORED;
damage *= get_pcvar_float(g_pCVAR_InB_ExtraDmgMult);
SetHamParamFloat(4, damage);
}
return HAM_IGNORED;
}
public zp_fw_core_spawn_post(id)
{
flag_unset(g_IncendiaryBullets, id);
}
public zp_fw_core_cure_post(id, attacker)
{
flag_unset(g_IncendiaryBullets, id);
}
error logs
[AMXX] Run time error 10: native error (native "zp_grenade_fire_get")
[AMXX] [0] zp_incendiary_bullets.sma::fw_PlayerTakeDamag e (line 151)
[ZP] Invalid Player (9)