Junior Member
|
03-29-2014
, 12:44
[REQ]Adapt 2 plugins to ZA
|
#1
|
Hi!, i want adapt 2 plugins to ZA, i try with the tutorial in the original post but i can't get the grenade when i buy the item.
The plugins are
https://forums.alliedmods.net/showthread.php?p=1123983 and https://forums.alliedmods.net/showth...12408?p=612408. The original post is this: https://forums.alliedmods.net/showthread.php?t=207308
I try with this:
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <engine>
#include <zombieapocalypse>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta_util>
#define PLUGIN "New Plug-In"
#define VERSION
#define AUTHOR
new const NameItem[] = "Drug nade"
const LevelItem = 7
const CostItem = 15
const TeamItem = ZP_TEAM_HUMAN
new gNewItem
new g_trailSpr, g_exploSpr;
new gmsg_SetFOV;
new Pcvar_tRed;
new Pcvar_tGreen;
new Pcvar_tBlue;
new Pcvar_bRed;
new Pcvar_bGreen;
new Pcvar_bBlue;
new const spr_grenade_ring[] = { "sprites/shockwave.spr" }
new const spr_grenade_trail[] = { "sprites/plasma.spr" }
public plugin_init() {
register_plugin("[ZA] New Extra-Item", "1.0", "ChileScripting")
// Add your code here...
gNewItem = za_register_extra_item(NameItem, LevelItem, CostItem, TeamItem)
/* R-G-B Max 255 */
Pcvar_tRed = register_cvar("amx_trail_red", "0")
Pcvar_tGreen = register_cvar("amx_trail_green","255")
Pcvar_tBlue = register_cvar("amx_trail_blue", "255")
Pcvar_bRed = register_cvar("amx_blast_red", "255")
Pcvar_bGreen = register_cvar("amx_blast_green","0")
Pcvar_bBlue = register_cvar("amx_blast_blue", "0")
gmsg_SetFOV = get_user_msgid("SetFOV")
}
public plugin_precache()
{
g_exploSpr = engfunc(EngFunc_PrecacheModel, spr_grenade_ring)
g_trailSpr = engfunc(EngFunc_PrecacheModel, spr_grenade_trail)
}
public fw_ThinkGrenade(entity)
{
static Float:dmgtime
pev(entity, pev_dmgtime, dmgtime)
if (dmgtime > get_gametime())
return HAM_IGNORED;
fov_explode(entity)
return HAM_SUPERCEDE;
}
public fw_SetModel(entity, const model[])
{
if (equal(model[7], "w_he", 4))
{
fm_set_rendering(entity, kRenderFxGlowShell, 0, 200, 0, kRenderNormal, 16);
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW) // TE id
write_short(entity) // entity
write_short(g_trailSpr) // sprite
write_byte(10) // life
write_byte(10) // width
write_byte(get_pcvar_num(Pcvar_tRed)) // r /*
write_byte(get_pcvar_num(Pcvar_tGreen)) // g sky-blue
write_byte(get_pcvar_num(Pcvar_tBlue)) // b /*
write_byte(500) // brightness
message_end()
set_pev(entity, pev_flTimeStepSound, 1111)
}
}
fov_explode(ent)
{
static Float:originF[3]
pev(ent, pev_origin, originF)
create_blast(originF)
static attacker
attacker = pev(ent, pev_owner)
static victim
victim = -1
new Tvictim = get_user_team(victim)
new Tattacker = get_user_team(attacker)
while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, 240.0)) != 0)
{
if(Tattacker == 1 || Tattacker == 2) // is attacker team ct or t
{
if(Tvictim == 1 || Tvictim == 2) // is victim team ct or t
{
message_begin( MSG_ONE, gmsg_SetFOV, { 0, 0, 0 }, victim) // Drugs
write_byte( 180 )
message_end( )
}
}
}
engfunc(EngFunc_RemoveEntity, ent)
}
create_blast(const Float:originF[3])
{
new r = get_pcvar_num(Pcvar_bRed)
new g = get_pcvar_num(Pcvar_bGreen)
new b = get_pcvar_num(Pcvar_bBlue)
// Smallest ring
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
engfunc(EngFunc_WriteCoord, originF[0]) // x axis
engfunc(EngFunc_WriteCoord, originF[1]) // y axis
engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
write_short(g_exploSpr) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(4) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(r) // red
write_byte(g) // green
write_byte(b) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
// Medium ring
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
engfunc(EngFunc_WriteCoord, originF[0]) // x axis
engfunc(EngFunc_WriteCoord, originF[1]) // y axis
engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
write_short(g_exploSpr) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(4) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(r) // red
write_byte(g) // green
write_byte(b) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
// Largest ring
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_BEAMCYLINDER) // TE id
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
engfunc(EngFunc_WriteCoord, originF[0]) // x axis
engfunc(EngFunc_WriteCoord, originF[1]) // y axis
engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
write_short(g_exploSpr) // sprite
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(4) // life
write_byte(60) // width
write_byte(0) // noise
write_byte(r) // red
write_byte(g) // green
write_byte(b) // blue
write_byte(200) // brightness
write_byte(0) // speed
message_end()
}
public zp_extra_item_selected(id, ITEM)
{
if(ITEM == gNewItem) // si el item seleccionado es el item gNewItem
{
static PlayerName[35] // crear variable 35 celdas
get_user_name(id, PlayerName, charsmax(PlayerName)) // obtener nombre de id
entity_set_float(id, EV_FL_health, entity_get_float(id, EV_FL_health) + HPAMMOUNT) // damos health points a id
entity_set_float(id, EV_FL_armorvalue, entity_get_float(id, EV_FL_armorvalue) + ARMORAMMOUNT) // armor
client_print(0, print_chat, "[BZ] %s ha comprado %s", PlayerName, NameItem) // print
client_cmd(id, "spk items/smallmedkit1.wav") // play the sound (default sound half life)
}
}
but i don't know to give me the item (this is to Drug Nade).
I try with:
PHP Code:
if(ITEM == gNewItem) // si el item seleccionado es el item gNewItem
{
static PlayerName[35] // crear variable 35 celdas
get_user_name(id, PlayerName, charsmax(PlayerName)) // obtener nombre de id
giveitem("")
client_print(0, print_chat, "[BZ] %s ha comprado %s", PlayerName, NameItem) // print
client_cmd(id, "spk items/smallmedkit1.wav") // play the sound (default sound half life)
}
but i don't know what write in the middle of the "".
Sorry for my english, i speak spanish.
Thanks in advance.
|
|