AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Give the player burning effect (https://forums.alliedmods.net/showthread.php?t=271098)

Administrator 09-05-2015 05:49

Give the player burning effect
 
Hello.
Please tell me how to give the player a burning effect?

NiHiLaNTh 09-05-2015 07:11

Re: Give the player burning effect
 
look for the Napalm Grenade

Phant 09-05-2015 07:39

Re: Give the player burning effect
 
Or ATAC Plugin.

Vancold 09-05-2015 12:28

Re: Give the player burning effect
 
Hey!

Usually you'd need a fire sprite and sound to make it realistic.

Do you have a sprite effect and a sound?

If yes i could code you a simple example on how to do those effects correctly.


Vancold

Administrator 09-06-2015 03:19

Re: Give the player burning effect
 
And if you use the standard used in the ATAC?

Administrator 09-10-2015 05:55

Re: Give the player burning effect
 
UP :)

NiHiLaNTh 09-11-2015 04:19

Re: Give the player burning effect
 
lol we told you the plugins, I still suggest you Napalm Grenades.

Administrator 09-11-2015 11:47

Re: Give the player burning effect
 
Here is a man offered to give the code ...
I just need to make the switch button on \ off the effect of combustion

Administrator 09-12-2015 07:04

Re: Give the player burning effect
 
I do not understand in Napalm Grenades, a lot of code, specifically where to catch fire?

PHP Code:

/*================================================================================
    
    ------------------------
    -*- Napalm Nades 1.3 -*-
    ------------------------
    
    ~~~~~~~~~~~~~~~
    - Description -
    ~~~~~~~~~~~~~~~
    
    This plugin turns one of the default grenades into a napalm bomb that
    can set players on fire. Basically a CS port of the "fire grenades"
    I originally developed for Zombie Plague, at the request of some people
    and since there were no similiar plugins around. Have fun!
    
    ~~~~~~~~~~~~~~~~
    - Requirements -
    ~~~~~~~~~~~~~~~~
    
    * Mods: Counter-Strike 1.6 or Condition-Zero
    * AMXX: Version 1.8.0 or later
    
    ~~~~~~~~~~~~~~~~
    - Installation -
    ~~~~~~~~~~~~~~~~
    
    * Extract .amxx file to your plugins folder, and add its name to plugins.ini
    * Extract flame.spr to the "sprites" folder on your server
    * To change models or sounds, open up the .sma with any text editor and look
       for the customization section. When you're done, recompile.
    
    ~~~~~~~~~~~~
    - Commands -
    ~~~~~~~~~~~~
    
    * say /napalm - Buy a napalm grenade (when override is off)
    
    ~~~~~~~~~
    - CVARS -
    ~~~~~~~~~
    
    * napalm_on <0/1> - Enable/Disable Napalm Nades
    * napalm_affect <1/2/3> - Which nades should be napalms (1-HE // 2-FB // 3-SG)
    * napalm_team <0/1/2> - Determines which team can buy/use napalm nades
       (0-both teams // 1-Terrorists only // 2-CTs only)
    * napalm_override <0/1> - If enabled, grenades will automatically become
       napalms without players having to buy them
    * napalm_price <1000> - Money needed to buy a napalm (when override is off)
    * napalm_buyzone <0/1> - If enabled, players need to be in a buyzone to
       purchase a napalm (when override is off)
    * napalm_carrylimit <1> - How many napalms can be carried at once
    
    * napalm_radius <240> - Napalm explosion radius
    * napalm_hitself <0/1> - If enabled, napalms will also affect their owner
    * napalm_ff <0/1> - If enabled, napalms will also affect teammates
    * napalm_spread <0/1> - If enabled, players will be able to catch fire
       from others when they touch
    * napalm_keepexplosion <0/1> - Wether to keep the default CS explosion
    
    * napalm_duration <5> - How long the burning lasts in seconds
    * napalm_damage <2> - How much damage the burning does (every 0.2 secs)
    * napalm_cankill <0/1> - If set, burning will be able to kill the victim
    * napalm_slowdown <0.5> - Burning slow down, set between: 0.1 (slower) and
       0.9 (faster). Use 0 to disable.
    * napalm_screamrate <20> - How often players will scream when on fire
       (lower values = more screams). Use 0 to disable.
    
    ~~~~~~~~~~~~~
    - Changelog -
    ~~~~~~~~~~~~~
    
    * v1.0: (Jul 26, 2008)
       - First release
    
    * v1.1: (Aug 15, 2008)
       - Grenades now explode based on their pev_dmgtime (means the
          plugin is now compatible with Nade Modes)
       - Changed method to identify napalm nades when override is off
       - Fire spread feature now fully working with CZ bots
    
    * v1.1b: (Aug 23, 2008)
       - Optimized bandwidth usage for temp entity messages
    
    * v1.1c: (Aug 26, 2008)
       - Fixed possible bugs with plugins that change a player's team
          after throwing a napalm nade
    
    * v1.2: (Oct 05, 2008)
       - Added a few cvars that allow more customization
       - Optimized the code a bit
       - Fixed a bug where buying 2 napalms too quick would sometimes
          result in the second acting as a normal nade

    * v1.3: (Feb 17, 2009)
       - Added ability to carry multiple napalms at once (+CVAR)
    
    * v1.3a: (Mar 16, 2009)
       - Code optimized (+CVARs now cached at round start)
    
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <xs>

/*================================================================================
 [Plugin Customization]
=================================================================================*/

// Uncomment the following if you wish to set custom models for napalms
//#define USE_NAPALM_CUSTOM_MODELS

#if defined USE_NAPALM_CUSTOM_MODELS // Then set your custom models here
new const g_model_napalm_view[] = "models/v_hegrenade"
new const g_model_napalm_player[] = "models/p_hegrenade.mdl"
new const g_model_napalm_world[] = "models/w_hegrenade.mdl"
#endif

// Explosion sounds
new const grenade_fire[][] = { "weapons/hegrenade-1.wav" }

// Player burning sounds
new const grenade_fire_player[][] = { "scientist/sci_fear8.wav""scientist/sci_pain1.wav""scientist/scream02.wav" }

// Grenade sprites
new const sprite_grenade_fire[] = "sprites/flame.spr"
new const sprite_grenade_smoke[] = "sprites/black_smoke3.spr"
new const sprite_grenade_trail[] = "sprites/laserbeam.spr"
new const sprite_grenade_ring[] = "sprites/shockwave.spr"

// Glow and trail colors (red, green, blue)
const NAPALM_R 200
const NAPALM_G 0
const NAPALM_B 0

/*===============================================================================*/

// Burning task
const TASK_BURN 1000
#define ID_BURN (taskid - TASK_BURN)
#define BURN_DURATION args[0]
#define BURN_ATTACKER args[1]

// CS Player PData Offsets (win32)
const OFFSET_CSTEAMS 114
const OFFSET_CSMONEY 115
const OFFSET_MAPZONE 235
new const AFFECTED_BPAMMO_OFFSETS[] = { 388387389 }
const 
OFFSET_LINUX // offsets +5 in Linux builds

// CS Player CBase Offsets (win32)
const OFFSET_ACTIVE_ITEM 373

// CS Weapon PData Offsets (win32)
const OFFSET_WEAPONID 43
const OFFSET_LINUX_WEAPONS // weapon offsets are only 4 steps higher on Linux

// CS Weapon CBase Offsets (win32)
const OFFSET_WEAPONOWNER 41

// Some constants
const PLAYER_IN_BUYZONE = (1<<0)

// pev_ field used to store custom nade types and their values
const PEV_NADE_TYPE pev_flTimeStepSound
const NADE_TYPE_NAPALM 681856

// pev_ field used to store napalm's custom ammo
const PEV_NAPALM_AMMO pev_flSwimTime

// Weapons that can be napalms
new const AFFECTED_NAMES[][] = { "HE""FB""SG" }
new const 
AFFECTED_CLASSNAMES[][] = { "weapon_hegrenade""weapon_flashbang""weapon_smokegrenade" }
new const 
AFFECTED_MODELS[][] = { "w_he""w_fl""w_sm" }
new const 
AFFECTED_AMMOID[] = { 121113 }
#if defined USE_NAPALM_CUSTOM_MODELS
new const AFFECTED_WEAPONS[] = { CSW_HEGRENADECSW_FLASHBANGCSW_SMOKEGRENADE }
#endif

// CS Sounds
new const sound_buyammo[] = "items/9mmclip1.wav"

// Whether ham forwards are registered for CZ bots
new g_hamczbots

// Precached sprites indices
new g_flameSprg_smokeSprg_trailSprg_exploSpr

// Messages
new g_msgDamageg_msgMoneyg_msgBlinkAcctg_msgAmmoPickup

// CVAR pointers
new cvar_radiuscvar_pricecvar_hitselfcvar_durationcvar_slowdowncvar_override,
cvar_damagecvar_oncvar_buyzonecvar_ffcvar_cankillcvar_spreadcvar_botquota,
cvar_teamrestrictcvar_screamratecvar_keepexplosioncvar_affectcvar_carrylimit

// Cached stuff
new g_maxplayersg_ong_affectg_overrideg_allowedteamg_keepexplosiong_spread,
g_ffg_durationg_buyzoneg_priceg_carrylimitg_hitselfg_screamrateg_damage,
Float:g_slowdowng_cankillFloat:g_radius

// Precache all custom stuff
public plugin_precache()
{
    new 
i
    
for (0sizeof grenade_firei++)
        
engfunc(EngFunc_PrecacheSoundgrenade_fire[i])
    for (
0sizeof grenade_fire_playeri++)
        
engfunc(EngFunc_PrecacheSoundgrenade_fire_player[i])
    
    
g_flameSpr engfunc(EngFunc_PrecacheModelsprite_grenade_fire)
    
g_smokeSpr engfunc(EngFunc_PrecacheModelsprite_grenade_smoke)
    
g_trailSpr engfunc(EngFunc_PrecacheModelsprite_grenade_trail)
    
g_exploSpr engfunc(EngFunc_PrecacheModelsprite_grenade_ring)
    
    
// CS sounds (just in case)
    
engfunc(EngFunc_PrecacheSoundsound_buyammo)
    
#if defined USE_NAPALM_CUSTOM_MODELS
    
engfunc(EngFunc_PrecacheModelg_model_napalm_view)
    
engfunc(EngFunc_PrecacheModelg_model_napalm_player)
    
engfunc(EngFunc_PrecacheModelg_model_napalm_world)
#endif
}

public 
plugin_init()
{
    
// Register plugin call
    
register_plugin("Napalm Nades""1.3a""MeRcyLeZZ")
    
    
// Events
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
    
// Forwards
    
register_forward(FM_SetModel"fw_SetModel")
    
RegisterHam(Ham_Think"grenade""fw_ThinkGrenade")
    
RegisterHam(Ham_Touch"player""fw_TouchPlayer")
#if defined USE_NAPALM_CUSTOM_MODELS
    
for (new 0sizeof AFFECTED_CLASSNAMESi++)
        
RegisterHam(Ham_Item_DeployAFFECTED_CLASSNAMES[i], "fw_Item_Deploy_Post"1)
#endif
    
    // Client commands
    
register_clcmd("say napalm""buy_napalm")
    
register_clcmd("say /napalm""buy_napalm")
    
    
// CVARS
    
cvar_on register_cvar("napalm_on""1")
    
cvar_affect register_cvar("napalm_affect""1")
    
cvar_teamrestrict register_cvar("napalm_team""0")
    
cvar_override register_cvar("napalm_override""0")
    
cvar_price register_cvar("napalm_price""1000")
    
cvar_buyzone register_cvar("napalm_buyzone""1")
    
cvar_carrylimit register_cvar("napalm_carrylimit""1")
    
    
cvar_radius register_cvar("napalm_radius""240")
    
cvar_hitself register_cvar("napalm_hitself""1")
    
cvar_ff register_cvar("napalm_ff""0")
    
cvar_spread register_cvar("napalm_spread""1")
    
cvar_keepexplosion register_cvar("napalm_keepexplosion""0")
    
    
cvar_duration register_cvar("napalm_duration""5")
    
cvar_damage register_cvar("napalm_damage""2")
    
cvar_cankill register_cvar("napalm_cankill""1")
    
cvar_slowdown register_cvar("napalm_slowdown""0.5")
    
cvar_screamrate register_cvar("napalm_screamrate""20")
    
    
cvar_botquota get_cvar_pointer("bot_quota")
    
g_maxplayers get_maxplayers()
    
    
// Message ids
    
g_msgDamage get_user_msgid("Damage")
    
g_msgMoney get_user_msgid("Money")
    
g_msgBlinkAcct get_user_msgid("BlinkAcct")
    
g_msgAmmoPickup get_user_msgid("AmmoPickup")
}

public 
plugin_cfg()
{
    
// Cache CVARs after configs are loaded
    
set_task(0.5"event_round_start")
}

// Round Start Event
public event_round_start()
{
    
// Cache CVARs
    
g_on get_pcvar_num(cvar_on)
    
g_affect get_pcvar_num(cvar_affect)
    
g_override get_pcvar_num(cvar_override)
    
g_allowedteam get_pcvar_num(cvar_teamrestrict)
    
g_keepexplosion get_pcvar_num(cvar_keepexplosion)
    
g_spread get_pcvar_num(cvar_spread)
    
g_ff get_pcvar_num(cvar_ff)
    
g_duration get_pcvar_num(cvar_duration)
    
g_buyzone get_pcvar_num(cvar_buyzone)
    
g_price get_pcvar_num(cvar_price)
    
g_carrylimit get_pcvar_num(cvar_carrylimit)
    
g_hitself get_pcvar_num(cvar_hitself)
    
g_screamrate get_pcvar_num(cvar_screamrate)
    
g_slowdown get_pcvar_float(cvar_slowdown)
    
g_damage floatround(get_pcvar_float(cvar_damage), floatround_ceil)
    
g_cankill get_pcvar_num(cvar_cankill)
    
g_radius get_pcvar_float(cvar_radius)
    
    
// Stop any burning tasks on players
    
for (new id 1id <= g_maxplayersid++)
        
remove_task(id+TASK_BURN);
}

// Client joins the game
public client_putinserver(id)
{
    
// CZ bots seem to use a different "classtype" for player entities
    // (or something like that) which needs to be hooked separately
    
if (!g_hamczbots && cvar_botquota && is_user_bot(id))
    {
        
// Set a task to let the private data initialize
        
set_task(0.1"register_ham_czbots"id)
    }
}

// Set Model Forward
public fw_SetModel(entity, const model[])
{
    
// Napalm grenades disabled
    
if (!g_on) return FMRES_IGNORED;
    
    
// Get damage time of grenade
    
static Float:dmgtime
    pev
(entitypev_dmgtimedmgtime)
    
    
// Grenade not yet thrown
    
if (dmgtime == 0.0)
        return 
FMRES_IGNORED;
    
    
// Not an affected grenade
    
if (!equal(model[7], AFFECTED_MODELS[g_affect-1], 4))
        return 
FMRES_IGNORED;
    
    
// Get owner of grenade and napalm weapon entity
    
static ownernapalm_weaponent
    owner 
pev(entitypev_owner)
    
napalm_weaponent fm_get_user_current_weapon_ent(owner)
    
    
// Not a napalm grenade (because the weapon entity of its owner doesn't have the flag set)
    
if (!g_override && pev(napalm_weaponentPEV_NADE_TYPE) != NADE_TYPE_NAPALM)
        return 
FMRES_IGNORED;
    
    
// Get owner's team
    
static owner_team
    owner_team 
fm_get_user_team(owner)
    
    
// Player is on a restricted team
    
if (g_allowedteam && g_allowedteam != owner_team)
        return 
FMRES_IGNORED;
    
    
// Give it a glow
    
fm_set_rendering(entitykRenderFxGlowShellNAPALM_RNAPALM_GNAPALM_BkRenderNormal16)
    
    
// And a colored trail
    
message_begin(MSG_BROADCASTSVC_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(NAPALM_R// r
    
write_byte(NAPALM_G// g
    
write_byte(NAPALM_B// b
    
write_byte(200// brightness
    
message_end()
    
    
// Reduce napalm ammo
    
static napalm_ammo
    napalm_ammo 
pev(napalm_weaponentPEV_NAPALM_AMMO)
    
set_pev(napalm_weaponentPEV_NAPALM_AMMO, --napalm_ammo)
    
    
// Run out of napalms?
    
if (napalm_ammo 1)
    {
        
// Remove napalm flag from the owner's weapon entity
        
set_pev(napalm_weaponentPEV_NADE_TYPE0)
    }
    
    
// Set grenade type on the thrown grenade entity
    
set_pev(entityPEV_NADE_TYPENADE_TYPE_NAPALM)
    
    
// Set owner's team on the thrown grenade entity
    
set_pev(entitypev_teamowner_team)
    
#if defined USE_NAPALM_CUSTOM_MODELS
    // Set custom model and supercede the original forward
    
engfunc(EngFunc_SetModelentityg_model_napalm_world)
    return 
FMRES_SUPERCEDE;
#else
    
return FMRES_IGNORED;
#endif
}

// Grenade Think Forward
public fw_ThinkGrenade(entity)
{
    
// Invalid entity
    
if (!pev_valid(entity)) return HAM_IGNORED;
    
    
// Get damage time of grenade
    
static Float:dmgtime
    pev
(entitypev_dmgtimedmgtime)
    
    
// Check if it's time to go off
    
if (dmgtime get_gametime())
        return 
HAM_IGNORED;
    
    
// Not a napalm grenade
    
if (pev(entityPEV_NADE_TYPE) != NADE_TYPE_NAPALM)
        return 
HAM_IGNORED;
    
    
// Explode event
    
napalm_explode(entity)
    
    
// Keep the original explosion?
    
if (g_keepexplosion)
    {
        
set_pev(entityPEV_NADE_TYPE0)
        return 
HAM_IGNORED;
    }
    
    
// Get rid of the grenade
    
engfunc(EngFunc_RemoveEntityentity)
    return 
HAM_SUPERCEDE;
}

// Player Touch Forward
public fw_TouchPlayer(selfother)
{
    
// Spread cvar disabled or not touching a player
    
if (!g_spread || !is_user_alive(other))
        return;
    
    
// Toucher not on fire or touched player already on fire
    
if (!task_exists(self+TASK_BURN) || task_exists(other+TASK_BURN))
        return;
    
    
// Check if friendly fire is allowed
    
if (!g_ff && fm_get_user_team(self) == fm_get_user_team(other))
        return;
    
    
// Heat icon
    
message_begin(MSG_ONE_UNRELIABLEg_msgDamage_other)
    
write_byte(0// damage save
    
write_byte(0// damage take
    
write_long(DMG_BURN// damage type
    
write_coord(0// x
    
write_coord(0// y
    
write_coord(0// z
    
message_end()
    
    
// Our task params
    
static params[2]
    
params[0] = g_duration // duration (reduced a bit)
    
params[1] = self // attacker
    
    // Set burning task on victim
    
set_task(0.1"burning_flame"other+TASK_BURNparamssizeof params)
}

#if defined USE_NAPALM_CUSTOM_MODELS
// Ham Weapon Deploy Forward
public fw_Item_Deploy_Post(entity)
{
    
// Napalm grenades disabled
    
if (!g_on) return;
    
    
// Not a napalm grenade (because the weapon entity of its owner doesn't have the flag set)
    
if (!g_override && pev(entityPEV_NADE_TYPE) != NADE_TYPE_NAPALM)
        return;
    
    
// Get weapon's id
    
static weaponid
    weaponid 
fm_get_weapon_ent_id(entity)
    
    
// Not an affected grenade
    
if (weaponid != AFFECTED_WEAPONS[g_affect-1])
        return;
    
    
// Get weapon's owner
    
static owner
    owner 
fm_get_weapon_ent_owner(entity)
    
    
// Player is on a restricted team
    
if (g_allowedteam && g_allowedteam != fm_get_user_team(owner))
        return;
    
    
// Replace models
    
set_pev(ownerpev_viewmodel2g_model_napalm_view)
    
set_pev(ownerpev_weaponmodel2g_model_napalm_player)
}
#endif

// Napalm purchase command
public buy_napalm(id)
{
    
// Napalm grenades disabled
    
if (!g_on) return PLUGIN_CONTINUE;
    
    
// Check if override setting is enabled instead
    
if (g_override)
    {
        
client_print(idprint_center"Just buy a %s grenade and get a napalm automatically!"AFFECTED_NAMES[g_affect-1])
        return 
PLUGIN_HANDLED;
    }
    
    
// Check if player is alive
    
if (!is_user_alive(id))
    {
        
client_print(idprint_center"You can't buy when you're dead!")
        return 
PLUGIN_HANDLED;
    }
    
    
// Check if the player is on a restricted team
    
if (g_allowedteam && g_allowedteam != fm_get_user_team(id))
    {
        
client_print(idprint_center"Your team cannot buy napalm nades!")
        return 
PLUGIN_HANDLED;
    }
    
    
// Check if player needs to be in a buyzone
    
if (g_buyzone && !fm_get_user_buyzone(id))
    {
        
client_print(idprint_center"You are not in a buyzone!")
        return 
PLUGIN_HANDLED;
    }
    
    
// Check that player has the money
    
if (fm_get_user_money(id) < g_price)
    {
        
client_print(idprint_center"#Cstrike_TitlesTXT_Not_Enough_Money")
        
        
// Blink money
        
message_begin(MSG_ONE_UNRELIABLEg_msgBlinkAcct_id)
        
write_byte(2// times
        
message_end()
        
        return 
PLUGIN_HANDLED;
    }
    
    
// Get napalm weapon entity
    
static napalm_weaponent
    napalm_weaponent 
fm_get_napalm_entity(idg_affect)
    
    
// Does the player have a napalm already?
    
if (napalm_weaponent != 0)
    {
        
// Retrieve napalm ammo
        
static napalm_ammo
        napalm_ammo 
pev(napalm_weaponentPEV_NAPALM_AMMO)
        
        
// Check if allowed to have this many napalms
        
if (napalm_ammo g_carrylimit)
        {
            
// Increase napalm ammo
            
set_pev(napalm_weaponentPEV_NAPALM_AMMO, ++napalm_ammo)
            
            
// Increase player's backpack ammo
            
set_pdata_int(idAFFECTED_BPAMMO_OFFSETS[g_affect-1], get_pdata_int(idAFFECTED_BPAMMO_OFFSETS[g_affect-1]) + 1OFFSET_LINUX)
            
            
// Flash ammo in hud
            
message_begin(MSG_ONE_UNRELIABLEg_msgAmmoPickup_id)
            
write_byte(AFFECTED_AMMOID[g_affect-1]) // ammo id
            
write_byte(1// ammo amount
            
message_end()
            
            
// Play clip purchase sound
            
engfunc(EngFunc_EmitSoundidCHAN_ITEMsound_buyammo1.0ATTN_NORM0PITCH_NORM)
            
            
// Set napalm flag on the weapon entity (bugfix)
            
set_pev(napalm_weaponentPEV_NADE_TYPENADE_TYPE_NAPALM)
        }
        else
        {
            
client_print(idprint_center"You cannot carry any more napalms!")
            return 
PLUGIN_HANDLED;
        }
    }
    else
    {
        
// Give napalm
        
fm_give_item(idAFFECTED_CLASSNAMES[g_affect-1])
        
        
// Get napalm weapon entity now it exists
        
napalm_weaponent fm_get_napalm_entity(idg_affect)
        
        
// Set napalm flag on the weapon entity
        
set_pev(napalm_weaponentPEV_NADE_TYPENADE_TYPE_NAPALM)
        
        
// Set napalm ammo
        
set_pev(napalm_weaponentPEV_NAPALM_AMMO1)
    }
    
    
// Calculate new money amount
    
static newmoney
    newmoney 
fm_get_user_money(id) - g_price
    
    
// Update money offset
    
fm_set_user_money(idnewmoney)
    
    
// Update money on HUD
    
message_begin(MSG_ONEg_msgMoney_id)
    
write_long(newmoney// amount
    
write_byte(1// flash
    
message_end()
    
    return 
PLUGIN_HANDLED;
}

// Napalm Grenade Explosion
napalm_explode(ent)
{
    
// Get attacker and its team
    
static attackerattacker_team
    attacker 
pev(entpev_owner)
    
attacker_team pev(entpev_team)
    
    
// Get origin
    
static Float:originF[3]
    
pev(entpev_originoriginF)
    
    
// Custom explosion effect
    
create_blast2(originF)
    
    
// Napalm explosion sound
    
engfunc(EngFunc_EmitSoundentCHAN_WEAPONgrenade_fire[random_num(0sizeof grenade_fire 1)], 1.0ATTN_NORM0PITCH_NORM)
    
    
// Collisions
    
static victim
    victim 
= -1
    
    
while ((victim engfunc(EngFunc_FindEntityInSpherevictimoriginFg_radius)) != 0)
    {
        
// Only effect alive players
        
if (!is_user_alive(victim))
            continue;
        
        
// Check if myself is allowed
        
if (!g_hitself && victim == attacker)
            continue;
        
        
// Check if friendly fire is allowed
        
if (!g_ff && victim != attacker && attacker_team == fm_get_user_team(victim))
            continue;
        
        
// Heat icon
        
message_begin(MSG_ONE_UNRELIABLEg_msgDamage_victim)
        
write_byte(0// damage save
        
write_byte(0// damage take
        
write_long(DMG_BURN// damage type
        
write_coord(0// x
        
write_coord(0// y
        
write_coord(0// z
        
message_end()
        
        
// Our task params
        
static params[2]
        
params[0] = g_duration // duration
        
params[1] = attacker // attacker
        
        // Set burning task on victim
        
set_task(0.1"burning_flame"victim+TASK_BURNparamssizeof params)
    }
}

// Burning Task
public burning_flame(args[2], taskid)
{
    
// Player died/disconnected
    
if (!is_user_alive(ID_BURN))
        return;
    
    
// Get player origin and flags
    
static Float:originF[3], flags
    pev
(ID_BURNpev_originoriginF)
    
flags pev(ID_BURNpev_flags)
    
    
// In water or burning stopped
    
if ((flags FL_INWATER) || BURN_DURATION 1)
    {
        
// Smoke sprite
        
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
        
write_byte(TE_SMOKE// TE id
        
engfunc(EngFunc_WriteCoordoriginF[0]) // x
        
engfunc(EngFunc_WriteCoordoriginF[1]) // y
        
engfunc(EngFunc_WriteCoordoriginF[2]-50.0// z
        
write_short(g_smokeSpr// sprite
        
write_byte(random_num(1520)) // scale
        
write_byte(random_num(1020)) // framerate
        
message_end()
        
        return;
    }
    
    
// Randomly play burning sounds
    
if (g_screamrate && random_num(1g_screamrate) == 1)
        
engfunc(EngFunc_EmitSoundID_BURNCHAN_VOICEgrenade_fire_player[random_num(0sizeof grenade_fire_player 1)], 1.0ATTN_NORM0PITCH_NORM)
    
    
// Fire slow down
    
if (g_slowdown 0.0 && (flags FL_ONGROUND))
    {
        static 
Float:velocity[3]
        
pev(ID_BURNpev_velocityvelocity)
        
xs_vec_mul_scalar(velocityg_slowdownvelocity)
        
set_pev(ID_BURNpev_velocityvelocity)
    }
    
    
// Get victim's health
    
static health
    health 
pev(ID_BURNpev_health)
    
    
// Take damage from the fire
    
if (health g_damage 0)
        
set_pev(ID_BURNpev_healthfloat(health g_damage))
    else if (
g_cankill)
    {
        
// Kill victim
        
ExecuteHamB(Ham_KilledID_BURNBURN_ATTACKER0)
        
        
// Smoke sprite
        
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
        
write_byte(TE_SMOKE// TE id
        
engfunc(EngFunc_WriteCoordoriginF[0]) // x
        
engfunc(EngFunc_WriteCoordoriginF[1]) // y
        
engfunc(EngFunc_WriteCoordoriginF[2]-50.0// z
        
write_short(g_smokeSpr// sprite
        
write_byte(random_num(1520)) // scale
        
write_byte(random_num(1020)) // framerate
        
message_end()
        
        return;
    }
    
    
// Flame sprite
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(TE_SPRITE// TE id
    
engfunc(EngFunc_WriteCoordoriginF[0]+random_float(-5.05.0)) // x
    
engfunc(EngFunc_WriteCoordoriginF[1]+random_float(-5.05.0)) // y
    
engfunc(EngFunc_WriteCoordoriginF[2]+random_float(-10.010.0)) // z
    
write_short(g_flameSpr// sprite
    
write_byte(random_num(510)) // scale
    
write_byte(200// brightness
    
message_end()
    
    
// Decrease task cycle count
    
BURN_DURATION -= 1;
    
    
// Keep sending flame messages
    
set_task(0.2"burning_flame"taskidargssizeof args)
}

// Napalm Grenade: Fire Blast (originally made by Avalanche in Frostnades)
create_blast2(const Float:originF[3])
{
    
// Smallest ring
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(TE_BEAMCYLINDER// TE id
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y
    
engfunc(EngFunc_WriteCoordoriginF[2]) // z
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x axis
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y axis
    
engfunc(EngFunc_WriteCoordoriginF[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(200// red
    
write_byte(100// green
    
write_byte(0// blue
    
write_byte(200// brightness
    
write_byte(0// speed
    
message_end()
    
    
// Medium ring
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(TE_BEAMCYLINDER// TE id
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y
    
engfunc(EngFunc_WriteCoordoriginF[2]) // z
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x axis
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y axis
    
engfunc(EngFunc_WriteCoordoriginF[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(200// red
    
write_byte(50// green
    
write_byte(0// blue
    
write_byte(200// brightness
    
write_byte(0// speed
    
message_end()
    
    
// Largest ring
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(TE_BEAMCYLINDER// TE id
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y
    
engfunc(EngFunc_WriteCoordoriginF[2]) // z
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x axis
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y axis
    
engfunc(EngFunc_WriteCoordoriginF[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(200// red
    
write_byte(0// green
    
write_byte(0// blue
    
write_byte(200// brightness
    
write_byte(0// speed
    
message_end()
}

// Register Ham Forwards for CZ bots
public register_ham_czbots(id)
{
    
// Make sure it's a CZ bot and it's still connected
    
if (g_hamczbots || !get_pcvar_num(cvar_botquota) || !is_user_connected(id))
        return;
    
    
RegisterHamFromEntity(Ham_Touchid"fw_TouchPlayer")
    
    
// Ham forwards for CZ bots succesfully registered
    
g_hamczbots true;
}

// Set entity's rendering type (from fakemeta_util)
stock fm_set_rendering(entityfx kRenderFxNone255255255render kRenderNormalamount 16)
{
    static 
Float:color[3]
    
color[0] = float(r)
    
color[1] = float(g)
    
color[2] = float(b)
    
    
set_pev(entitypev_renderfxfx)
    
set_pev(entitypev_rendercolorcolor)
    
set_pev(entitypev_rendermoderender)
    
set_pev(entitypev_renderamtfloat(amount))
}

// Give an item to a player (from fakemeta_util)
stock fm_give_item(id, const item[])
{
    static 
ent
    ent 
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocStringitem));
    if (!
pev_valid(ent)) return;
    
    static 
Float:originF[3]
    
pev(idpev_originoriginF);
    
set_pev(entpev_originoriginF);
    
set_pev(entpev_spawnflagspev(entpev_spawnflags) | SF_NORESPAWN);
    
dllfunc(DLLFunc_Spawnent);
    
    static 
save
    save 
pev(entpev_solid);
    
dllfunc(DLLFunc_Touchentid);
    if (
pev(entpev_solid) != save)
        return;
    
    
engfunc(EngFunc_RemoveEntityent);
}

// Find entity by its owner (from fakemeta_util)
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
    while ((
entity engfunc(EngFunc_FindEntityByStringentity"classname"classname)) && pev(entitypev_owner) != owner) {}
    
    return 
entity;
}

// Finds napalm grenade weapon entity of a player
stock fm_get_napalm_entity(idg_affect)
{
    return 
fm_find_ent_by_owner(-1AFFECTED_CLASSNAMES[g_affect-1], id);
}

// Get User Current Weapon Entity
stock fm_get_user_current_weapon_ent(id)
{
    return 
get_pdata_cbase(idOFFSET_ACTIVE_ITEMOFFSET_LINUX);
}

// Get Weapon Entity's CSW_ ID
stock fm_get_weapon_ent_id(ent)
{
    return 
get_pdata_int(entOFFSET_WEAPONIDOFFSET_LINUX_WEAPONS);
}

// Get Weapon Entity's Owner
stock fm_get_weapon_ent_owner(ent)
{
    return 
get_pdata_cbase(entOFFSET_WEAPONOWNEROFFSET_LINUX_WEAPONS);
}

// Get User Money
stock fm_get_user_money(id)
{
    return 
get_pdata_int(idOFFSET_CSMONEYOFFSET_LINUX);
}

// Set User Money
stock fm_set_user_money(idamount)
{
    
set_pdata_int(idOFFSET_CSMONEYamountOFFSET_LINUX);
}

// Get User Team
stock fm_get_user_team(id)
{
    return 
get_pdata_int(idOFFSET_CSTEAMSOFFSET_LINUX);
}

// Returns whether user is in a buyzone
stock fm_get_user_buyzone(id)
{
    if (
get_pdata_int(idOFFSET_MAPZONE) & PLAYER_IN_BUYZONE)
        return 
1;
    
    return 
0;


How to me to write in chat / Fire and I caught fire without losing a life, wrote / offfire and I ceased to burn?

Administrator 09-14-2015 10:04

Re: Give the player burning effect
 
UP :(


All times are GMT -4. The time now is 22:07.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.