Raised This Month: $12 Target: $400
 3% 

Runtime Errors & Debug Trace Done By Satchel Charge


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shubhamgulati12
Senior Member
Join Date: Oct 2010
Location: Inida The Holy Place!!
Old 05-01-2012 , 05:37   Runtime Errors & Debug Trace Done By Satchel Charge
Reply With Quote #1

Hello friends
I had recently put in satchel charge [plugin page - http://forums.alliedmods.net/showthread.php?t=96755] in my zombie plague server.
Due to it my server stucks in between!
And when i checked log files I was really amazed to see that a log file .txt one had a size of around 13 mb in 1 day!!
and only 1 error was repeative Here it is :
PHP Code:
L 05/01/2012 00:40:15Start of error session.
L 05/01/2012 00:40:15Info (map "zm_infantry") (file "addons/amxmodx/logs/error_20120501.log")
L 05/01/2012 00:40:15: [AMXXDisplaying debug trace (plugin "zp_extra_satchel34.amxx")
L 05/01/2012 00:40:15: [AMXXRun time error 4index out of bounds 
L 05
/01/2012 00:40:15: [AMXX]    [0zp_extra_satchel34.sma::fw_RadioDeploy (line 448)
L 05/01/2012 00:41:08: [AMXXDisplaying debug trace (plugin "zp_extra_satchel34.amxx")
L 05/01/2012 00:41:08: [AMXXRun time error 4index out of bounds 
L 05
/01/2012 00:41:08: [AMXX]    [0zp_extra_satchel34.sma::fw_RadioDeploy (line 448)
L 05/01/2012 00:41:08: [AMXXDisplaying debug trace (plugin "zp_extra_satchel34.amxx")
L 05/01/2012 00:41:08: [AMXXRun time error 4index out of bounds 
L 05
/01/2012 00:41:08: [AMXX]    [0zp_extra_satchel34.sma::fw_RadioDeploy (line 448)
L 05/01/2012 00:41:19: [AMXXDisplaying debug trace (plugin "zp_extra_satchel34.amxx")
L 05/01/2012 00:41:19: [AMXXRun time error 4index out of bounds 
L 05
/01/2012 00:41:19: [AMXX]    [0zp_extra_satchel34.sma::fw_SatchelDeploy (line 425)
L 05/01/2012 00:41:19: [AMXXDisplaying debug trace (plugin "zp_extra_satchel34.amxx")
L 05/01/2012 00:41:19: [AMXXRun time error 4index out of bounds 
L 05
/01/2012 00:41:19: [AMXX]    [0zp_extra_satchel34.sma::fw_RadioDeploy (line 448
Though It is not crashing my server but making it lagg in between huge one when someone use it!
Any solution please tell
Scripting file in description!

Thanks & Regards
Attached Files
File Type: sma Get Plugin or Get Source (zp_extra_satchel34.sma - 570 views - 23.3 KB)
__________________

Join Free File hosting - http://db.tt/VvebKSSW
[Free 2 GB cloud storage]
shubhamgulati12 is offline
jc980
Veteran Member
Join Date: Jan 2010
Location: God is with us...
Old 05-01-2012 , 06:58   Re: Runtime Errors & Debug Trace Done By Satchel Charge
Reply With Quote #2

what ZP are you using? 4.3 or 5.0?
__________________
jc980 is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 05-01-2012 , 07:57   Re: Runtime Errors & Debug Trace Done By Satchel Charge
Reply With Quote #3

Try
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <zombieplague>

// Plugin stuff
new const PLUGIN[] = "[ZP] Extra Item: Satchel Charge"
new const VERSION[] = "3.4"
new const AUTHOR[] = "NiHiLaNTh"

// Satchel and satchel radio models
new const p_satchel[] = "models/p_satchel.mdl"
new const v_satchel[] = "models/v_satchel.mdl"
new const w_satchel[] = "models/w_satchel.mdl"
new const w_satchelT[] = "models/w_satchelt.mdl"
new const p_satchel_radio[] = "models/p_satchel_radio.mdl"
new const v_satchel_radio[] = "models/v_satchel_radio.mdl"

// Sprite
new const explode_sprite[] = "sprites/zerogxplode.spr"
new const smoke_sprite[] = "sprites/steam1.spr"

// Item cost
#define COST 15

// Cached sprite indexes
new g_exploSprg_smokeSpr

// Message ID
new g_msgScoreInfo

// CVAR Pointers
new cvar_dmgcvar_oneroundcvar_radiuscvar_knockback

// Item ID
new g_satchel

// Player variables
new g_hasRadio[33// has detonator
new g_hasSatchel[33// has S.Charge
new g_hasPlanted[33// has planted the bomb
new g_CanPlant[33// I had to do it
new g_CurrentWeapon[33// Current weapon player is holding

// Game variables
new g_maxplayers
new g_restarted

// Animations
// Satchel
enum
{
    
satchel_idle1 0,
    
satchel_fidget1,
    
satchel_draw,
    
satchel_drop
}

// Satchel Radio
enum
{
    
radio_idle1 0,
    
radio_fidget1,
    
radio_draw,
    
radio_fire,
    
radio_holster
}

// Chat messages(Translate here)
new const
    
NOTICE_USE1[] = { "[ZP] You got satchel charge.Press attack key to plant them." },
    
NOTICE_USE2[] = { "[ZP] Press secondary attack button to detonate Satchel." },
    
NOTICE_YOUPLANT[] = { "You already planted the bomb" },
    
NOTICE_PLANT[] = { "You planted a Satchel Charge" },
    
NOTICE_HAVE[] = { "Already have Satchel Charge" },
    
NOTICE_PLANT1[] = { "Cannot drop, because you planted Satchel" }
    
// Plugin precache
public plugin_precache()
{
    
// Precache models...
    
precache_model(p_satchel)
    
precache_model(v_satchel)
    
precache_model(w_satchel)
    
precache_model(w_satchelT)
    
precache_model(p_satchel_radio)
    
precache_model(v_satchel_radio)
    
    
// and sprites
    
g_exploSpr precache_model(explode_sprite)
    
g_smokeSpr precache_model(smoke_sprite)
}    

// Plugin initialization
public plugin_init()
{
    
// Register my new plugin
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar("zp_satchel_version"VERSIONFCVAR_SERVER|FCVAR_SPONLY)
    
    
// Register new extra item
    
g_satchel zp_register_extra_item("Satchel Charge"COSTZP_TEAM_HUMAN)
    
    
// Client command
    
register_clcmd("drop""clcmd_drop")
    
    
// Events
    
register_event("CurWeapon""Event_CurrentWeapon""b""1=1")
    
register_event("HLTV""Event_NewRound""a""1=0""2=0");
    
register_event("TextMsg""Event_GameRestart""a""2=#Game_Commencing""2=#Game_will_restart_in");
    
    
// Log Event
    
register_logevent("LogEvent_RoundEnd"2"1=Round_End")
    
    
// Forwards
    
register_forward(FM_CmdStart"fw_CmdStart")
    
RegisterHam(Ham_Item_Deploy"weapon_hegrenade""fw_SatchelDeploy"1)
    
RegisterHam(Ham_Item_Deploy"weapon_knife""fw_RadioDeploy"1)
    
//register_forward(FM_Touch, "fw_Touch")
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
    
    
// Register cvars
    
cvar_dmg register_cvar("zp_satchel_dmg""1000")
    
cvar_oneround register_cvar("zp_satchel_oneround""0")
    
cvar_radius register_cvar("zp_satchel_radius""300")    
    
cvar_knockback register_cvar("zp_satchel_knockback""10")
    
    
// Messages
    
g_msgScoreInfo get_user_msgid("ScoreInfo")

    
// Touch
    
register_touch("drop_satchel""player""satchel_touch")
    
    
// Store maxplayers in a global variable
    
g_maxplayers get_maxplayers()
}

// Client connected
public client_connect(id)
{
    
// Don't have satchel
    
g_hasSatchel[id] = false
    g_hasRadio
[id] = false
    g_hasPlanted
[id] = false
    g_CanPlant
[id] = false
}

// Drop command
public clcmd_drop(id)
{
    
// Has Satchel
    
if (g_hasSatchel[id] && g_CurrentWeapon[id] == CSW_HEGRENADE)
    {
        
// Drop it
        
drop_satchel(id)
        
        
// Fix
        
touch_fix(id)
        
        
// Force to loose HE grenade
        
ham_strip_weapon(id"weapon_hegrenade")
        
        
// Reset knife model
        
reset_user_knife(id)
        
        
// Reset vars
        
g_hasSatchel[id] = false
        g_hasPlanted
[id] = false
        g_hasRadio
[id] = false
        g_CanPlant
[id] = false
    
}
    
// Player planted Satchel - can't drop
    
if (g_hasPlanted[id] && g_CurrentWeapon[id] == CSW_KNIFE)
    {
        
client_print(idprint_chat"%s"NOTICE_PLANT1)
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}

// Buy some extra items
public zp_extra_item_selected(iditemid)
{
    
// Our extra item
    
if (itemid == g_satchel)
    {
        
// Already own Satchel
        
if (g_hasSatchel[id] || g_hasPlanted[id])
        {
            
// Warn
            
client_print(idprint_center"%s"NOTICE_HAVE)
            return 
ZP_PLUGIN_HANDLED
        
}
        else
        {
            
// Notices
            
client_print(idprint_chat"%s"NOTICE_USE1)
            
client_print(idprint_chat"%s",  NOTICE_USE2)
            
            
// Reset vars
            
g_hasSatchel[id] = true
            g_hasPlanted
[id] = false
            g_hasRadio
[id] = true
            g_CanPlant
[id] = true
            
            
// Give him hegrenade
            
give_item(id"weapon_hegrenade")
            
            
// Force to he grenade
            
engclient_cmd(id"weapon_hegrenade")
            
            
// Change weapon models
            
ChangeModelsSatchel(id)
            
            
// Play animation
            
UTIL_PlayWeaponAnimation(idsatchel_draw)    
        }
    }
    return 
PLUGIN_CONTINUE
}
    
// Someone has been injected    
public zp_user_infected_post(idinfector)
{
    
// Have Satchel
    
if (g_hasSatchel[id] || g_hasPlanted[id])
    {
        
// Reset vars
        
g_hasSatchel[id] = false
        g_hasRadio
[id] = false
        g_hasPlanted
[id] = false
        g_CanPlant
[id] = false
    
        
// Drop it
        
drop_satchel(id)
    
        
/************DONT TOUCH IT OR SERVER WILL CRASH ON RESTART***********/
        // Update Score
        //UpdateScore(infector, id, 0, 0, 1)
    
        // Fix
        
touch_fix(id)
        
        
// Reset knife model
        
reset_user_knife(id)
        
        
// Remove planted satchel
        
remove_planted_satchel()
    }
}

// Current weapon    
public Event_CurrentWeapon(id)
{
    
// Dead
    
if (!is_user_alive(id))
        return 
PLUGIN_CONTINUE
    
    
// Update array
    
g_CurrentWeapon[id] = read_data(2)
    
    return 
PLUGIN_CONTINUE
}    

// New round
public Event_NewRound()
{
    if (
g_restarted)
    {
        
// Make a loop
        
for (new 1<= get_maxplayers(); i++)
        {
            
// Strip from Satchel
            
if (g_hasSatchel[i] || g_hasPlanted[i])
            {
                
// Reset vars
                
g_hasSatchel[i] = false
                g_hasRadio
[i] = false
                g_CanPlant
[i] = false
                g_hasPlanted
[i] = false
            
}
        }
        
g_restarted false
    
}
}

// Restart event
public Event_GameRestart()
{
    
g_restarted true
}

public 
LogEvent_RoundEnd()
{
    
// One round only cvar enabled
    
if (get_pcvar_num(cvar_oneround) == 1)
    {
        
// Loop
        
for (new 1g_maxplayersi++)
        {
            
// Reset vars
            
g_hasSatchel[i] = false
            g_hasPlanted
[i] = false
            g_hasRadio
[i] = false
            g_CanPlant
[i] = false
        
}
    }
    
    
// Remove dropped satchels
    
remove_dropped_satchel()
    
    
// Remove planted satchel
    
remove_planted_satchel()
}

// Command start
public fw_CmdStart(iduc_handleseed)
{
    
// Dead/Zombie/Nemesis
    
if (!is_user_alive(id) || zp_get_user_zombie(id) || zp_get_user_nemesis(id))
        return 
FMRES_IGNORED

    
// Get weapon and player buttons
    
new weapon get_user_weapon(id)
    new 
buttons get_uc(uc_handleUC_Buttons)
    
    
// HE grenade(Satchel)
    
if (weapon == CSW_HEGRENADE)
    {
        
// Secondary attack
        
if (buttons IN_ATTACK2)
        {
            
// Already planted
            
if (g_hasPlanted[id])
            {
                
// Wanr
                
client_print(idprint_center"%s"NOTICE_YOUPLANT)
                return 
FMRES_IGNORED
            
}
            
// Can plant
            
else if (g_hasSatchel[id])
            {
                
// Plant satchel
                
plant_satchel(id)
            }
        }
    }
    
// Knife(Radio)
    
else if (weapon == CSW_KNIFE)
    {
        
// Primary attck
        
if (buttons IN_ATTACK)
        {
            
// Have planted or have radio
            
if (g_hasPlanted[id] || g_hasRadio[id])
            {
                
// Play animation
                
UTIL_PlayWeaponAnimation(idradio_fire)
                
                
// Detonate it
                
detonate_satchel(id)
            }
        }
    }
    return 
FMRES_IGNORED
}

// Satchel deploy
public fw_SatchelDeploy(iEnt)
{
    
// Get id
    
new id get_pdata_cbase(iEnt415)

    
// have satchel
    
if (g_hasSatchel[id])
    {
        
// Change models
        
ChangeModelsSatchel(id)
        
        
// Play animation
        
UTIL_PlayWeaponAnimation(idsatchel_draw)
    
        
// Modify time until next primary attack
        
set_pdata_float(iEnt469999.04);
        
        
// Modify time until next attack
        
set_pdata_float(id839999.0);
    }
}

// Radio deploy
public fw_RadioDeploy(iEnt)
{
    
// Get id
    
new id get_pdata_cbase(iEnt415)

    
// have satchel
    
if (g_hasPlanted[id] || g_hasRadio[id] )
    {
        
// Change radio models
        
ChangeModelsRadio(id)
        
        
// Play animation
        
UTIL_PlayWeaponAnimation(idradio_draw)
    
        
// Modify time until next primary attack
        
set_pdata_float(iEnt469999.04);
        
        
// Modify time until next attack
        
set_pdata_float(id839999.0);
    
    }
}    

// Player killed
public fw_PlayerKilled(victimattackershouldgib)
{
    
// Have satchel
    
if (g_hasSatchel[victim] || g_hasPlanted[victim])
    {
        
// Reset vars
        
g_hasSatchel[victim] = false
        g_hasPlanted
[victim] = false
        g_CanPlant
[victim] = false
        g_hasRadio
[victim] = false
        
        
// Drop satchel
        
drop_satchel(victim)
        
        
// Fix
        
touch_fix(victim)
        
        
// Remove planted satchel
        
remove_planted_satchel()
    }
}

// Plant satchel
public plant_satchel(id)
{
    
// Zombie/Nemesis/Dead
    
if (zp_get_user_zombie(id) || zp_get_user_nemesis(id) || !is_user_alive(id))
        return 
PLUGIN_CONTINUE
    
    
if(is_user_connected(id))
    {
    
// Now all is OK
    
set_task(0.1 ,"CreateBomb"id___)
        
    
// Strip from hegrenade
    
ham_strip_weapon(id"weapon_hegrenade")
        
    
// Change models    
    
ChangeModelsRadio(id)
    
    
// Switch to knife
    
engclient_cmd(id"weapon_knife")
    
    
// Reset stuff
    
g_hasPlanted[id] = true
    g_hasRadio
[id] = true
    g_hasSatchel
[id] = false
    g_CanPlant
[id] = false
    
}
    return 
PLUGIN_CONTINUE
    
}

// Create bomb
public CreateBomb(id)
{
    
// Play animation
    
UTIL_PlayWeaponAnimation(idsatchel_drop)
    
    
// Create entity
    
new iBomb create_entity("info_target")
    
    if(
iBomb == 0
        return 
PLUGIN_HANDLED
    
    
// Set it's classname
    
entity_set_string(iBombEV_SZ_classname"remote_bomb")
    
    
// Set it's model
    
entity_set_model(iBombw_satchel)
    
    
// Set it's size
    
entity_set_size(iBombFloat:{-2.0,-2.0,-1.0}, Float:{2.0,2.0,1.0})
    
    
entity_set_int(iBombEV_INT_movetypeMOVETYPE_TOSS)
    
entity_set_int(iBombEV_INT_solidSOLID_TRIGGER)
    
    
// Set it's gravity
    
entity_set_float(iBombEV_FL_gravity0.9)
    
    
// Drop it to flooe
    
engfunc(EngFunc_DropToFlooriBomb)
    
    
// Get origin and vector
    
new Float:iOrigin[3]
    
entity_get_vector(idEV_VEC_originiOrigin)
    
//iOrigin[1] += 50
    
    // Set angle
    
new Float:angles[3]
    
angles[0] += 180
    angles
[1] += 90
    angles
[2] += 90
    entity_set_vector
(iBombEV_VEC_anglesangles)
    
    
// Set origin and angles
    
entity_set_origin(iBombiOrigin)
    
    
// Get owner
    
entity_set_int(iBombEV_ENT_ownerid)
    
    
// Notice player
    
client_print(idprint_center ,"%s"NOTICE_PLANT)
    
    
// Play sound
    
emit_sound(idCHAN_WEAPON"weapons/c4_plant.wav"VOL_NORMATTN_NORM0PITCH_NORM)
    
    
// Next think
    
entity_set_float(iBombEV_FL_nextthinkhalflife_time() + 0.01)
    
    
// Reset
    //g_hasPlanted[id] = true
    //g_hasRadio[id] = true
    //g_CanPlant[id] = false 
    //g_hasSatchel[id] = false
    
    
return PLUGIN_HANDLED
}

// Detonate satchel
public detonate_satchel(id)
{
    
// Zombie/Nemesis/Dead
    
if (zp_get_user_zombie(id) || zp_get_user_nemesis(id) || !is_user_alive(id))
        return 
PLUGIN_CONTINUE
    
    
// Have planted
    
if (g_hasPlanted[id])
    {
        
// Find ent
        
new ent find_ent_by_class(id"remote_bomb")
        
        if (
ent)
        {    
            
// Create explosion
            
CreateExplosion(ent)
            
            
// Remove ent
            
remove_entity(ent)
            
            
// Force switch to knife
            
engclient_cmd(id"weapon_knife")
            
            
// Reset knife model
            
reset_user_knife(id)
            
            
// Reset vars
            
g_hasPlanted[id] = false
            g_hasRadio
[id] = false
            g_hasSatchel
[id] = false
            g_CanPlant
[id] = false
        
}
    }
    
    return  
PLUGIN_CONTINUE
}    

// Create explosion
public CreateExplosion(ent)
{
    
// Invalid entity
    
if (!pev_valid(ent))
        return
    
    
// Get it's origin
    
new Float:origin[3];pev(entpev_originorigin)
    
    
// Explosion
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte (TE_EXPLOSION// TE ID
    
engfunc(EngFunc_WriteCoordorigin[0]) // Position X
    
engfunc(EngFunc_WriteCoordorigin[1]) // Y
    
engfunc(EngFunc_WriteCoordorigin[2] + 30.0// Z
    
write_short(g_exploSpr// Sprite index
    
write_byte(30// Scale
    
write_byte(15// Framerate
    
write_byte(0// Explosion Flag:None
    
message_end()
    
    
// Smoke
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte (TE_SMOKE// TE ID
    
engfunc(EngFunc_WriteCoordorigin[0]) // Position X
    
engfunc(EngFunc_WriteCoordorigin[1]) // Y
    
engfunc(EngFunc_WriteCoordorigin[2] + 50.0// Z
    
write_short(g_smokeSpr// Sprite index
    
write_byte(100// Scale
    
write_byte(15// Framerate
    
message_end()
    
    
// Owner
    
new owner entity_get_int(entEV_ENT_owner)
    
    
// Make a loop
    
for (new 1g_maxplayersi++)
    {
        
// Classname
        
new szClassName[32]
        
entity_get_string(iEV_SZ_classnameszClassName32)
        
        
// Player
        
if (equal(szClassName"player"))
        {
            
// Alive/Don't have godmode
            
if (is_user_alive(i) == && get_user_godmode(i) == )
            {
                
// Zombie/Nemesis
                
if (zp_get_user_zombie(i) || zp_get_user_nemesis(i))
                {
                    
// Get origina and distance
                    
new Float:VictimOrigin[3], Float:distance_fdistance
                    pev
(ipev_originVictimOrigin)
                    
distance_f get_distance_f(originVictimOrigin)
                    
distance floatround(distance_f)
                    
                    if (
distance get_pcvar_num(cvar_radius))
                    {
                        
// Fake damage
                        
fakedamage(i"grenade"0.0DMG_BLAST)
                        
                        
// Get health/dmg/damage ratio
                        
new Float:dratiodamage
                        dratio 
floatdiv(float(distance),float(get_pcvar_num(cvar_radius)))
                        
damage get_pcvar_num(cvar_dmg) - floatround(floatmul(float(get_pcvar_num(cvar_dmg)), dratio))
                        new 
health get_user_health(i)
                        
                        
// Make some knockback
                        
new Float:knockback get_pcvar_float(cvar_knockback)
                        
make_knockback(ioriginknockback*damage)    
                        
                        if (
health damage >= 1)
                        {
                            
// New health
                            
set_user_health(ihealth damage)
                            
                            
// Create blood
                            //ShowSomeBlood(VictimOrigin)
                            
                            //client_print(owner, print_chat, "===>DAMADE %d<===", damage)
                        
}
                        else
                        {
                            
// Log this
                            
log_kill(owneri"grenade"0)
                            
                            
// Set ammo packs
                            
zp_set_user_ammo_packs(ownerzp_get_user_ammo_packs(owner) + 1)
                        }
                    }
                }
                
// Remove ent
                
set_pev(entpev_flagsFL_KILLME)
            }
        }
    }
}

// Remove planted satchels
public remove_planted_satchel()
{
    
// Find
    
new ent find_ent_by_class(-1"remote_bomb")
        
    
// And remove    
    
if (ent)
    {
        
engfunc(EngFunc_RemoveEntityent)
    }
}
    
// Remove dropped    
public remove_dropped_satchel()
{
    
// Find
    
new ent find_ent_by_class(-1"drop_satchel")
    
    
// And remove
    
if (ent)
    {
        
engfunc(EngFunc_RemoveEntityent)
    }
}    

// Drop satchel ent
public drop_satchel(id)
{
    
// Get aimvec and origin
    
static Float:flAim[3], Float:flOrigin[3]
    
VelocityByAim(id64flAim)
    
entity_get_vector(idEV_VEC_originflOrigin)
    
    
// Change them a bit
    
flOrigin[0] += flAim[0]
    
flOrigin[1] += flAim[1]
    
    
// New ent
    
new iEnt create_entity("info_target")
    
    
// Classname
    
entity_set_string(iEntEV_SZ_classname"drop_satchel")
    
    
// Origin
    
entity_set_origin(iEntflOrigin)
    
    
// Model
    
entity_set_model(iEntw_satchel)
    
    
// Size
    
new Float:mins[3] = {-1.0, -1.0, -1.0}
    new 
Float:maxs[3] = {1.01.01.0}
    
entity_set_vector(iEntEV_VEC_minsmins)
    
entity_set_vector(iEntEV_VEC_maxsmaxs)
    
    
// Interaction
    
entity_set_int(iEntEV_INT_solidSOLID_TRIGGER)
    
    
// Movetype
    
entity_set_int(iEntEV_INT_movetypeMOVETYPE_TOSS)
        
    
// Strip from HE Grenade    
    
ham_strip_weapon(id"weapon_hegrenade")
    
    
// Reset vars
    
g_hasSatchel[id] = false
    g_hasPlanted
[id] = false
    g_CanPlant
[id] = false
    g_hasRadio
[id] = false
}

// Someone touched dropped satchel
public satchel_touch(stchlent)
{
    
// Prevent invalid ent messages
    
if (!is_valid_ent(stchl) || !is_valid_ent(ent))
        return 
PLUGIN_CONTINUE
    
    
// Not allowed to touch    
    
if (zp_get_user_zombie(ent) || zp_get_user_nemesis(ent) || g_hasSatchel[ent] || g_hasRadio[ent])
        return 
PLUGIN_CONTINUE
    
    
// Reset vars
    
g_hasSatchel[ent] = true
    g_hasRadio
[ent] = true
    g_hasPlanted
[ent] = false
    g_CanPlant
[ent] = true
    
    
// Give awp
    
give_item(ent"weapon_hegrenade")
    
    
// Switch to he grenade
    
client_cmd(ent"weapon_hegrenade")
    
    
// Change models
    
ChangeModelsSatchel(ent)
    
    
// Remove crossbow on ground
    
remove_entity(stchl)
    
    return 
PLUGIN_CONTINUE
}

// Satchel Models
stock ChangeModelsSatchel(id)
{
    
set_pev(idpev_viewmodel2v_satchel)
    
set_pev(idpev_weaponmodel2p_satchel)
}

// Radio models
stock ChangeModelsRadio(id)
{
    
set_pev(idpev_viewmodel2v_satchel_radio)
    
set_pev(idpev_weaponmodel2p_satchel_radio)
}

// Play animation(Arkshine)
stock UTIL_PlayWeaponAnimation(const Player, const Sequence)
{
    
set_pev(Playerpev_weaponanimSequence);
    
    
message_begin(MSG_ONE_UNRELIABLESVC_WEAPONANIM, .player Player);
    
write_byte(Sequence);
    
write_byte(pev(Playerpev_body));
    
message_end();
}

// Log kill
stock log_kill(killervictimweapon[],headshot
{
    
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_SET)
    
ExecuteHamB(Ham_Killedvictimkiller2)
    
set_msg_block(get_user_msgid("DeathMsg"), BLOCK_NOT)
    
    
message_begin(MSG_ALLget_user_msgid("DeathMsg"), {0,0,0}, 0)
    
write_byte(killer)
    
write_byte(victim)
    
write_byte(headshot)
    
write_string(weapon)
    
message_end()
    
    new 
kname[32], vname[32], kauthid[32], vauthid[32], kteam[10], vteam[10]
    
    
get_user_name(killerkname31)
    
get_user_team(killerkteam9)
    
get_user_authid(killerkauthid31)
    
    
get_user_name(victimvname31)
    
get_user_team(victimvteam9)
    
get_user_authid(victimvauthid31)
    
    
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"%s^""
    
knameget_user_userid(killer), kauthidkteam
    
vnameget_user_userid(victim), vauthidvteamweapon)
    
    
UpdateScore(killervictim0,01)
    
    return 
PLUGIN_CONTINUE
}        

// Update score 
stock UpdateScore(attackervictimfragsdeathsscoreboard)
{
    
set_pev(attackerpev_fragsfloat(pev(attackerpev_frags) + frags))
    
    
cs_set_user_deaths(victimcs_get_user_deaths(victim) + deaths)
    
    if (
scoreboard)
    {
        
message_begin(MSG_BROADCASTg_msgScoreInfo)
        
write_byte(attacker// id
        
write_short(pev(attackerpev_frags)) // frags
        
write_short(cs_get_user_deaths(attacker)) // deaths
        
write_short(0// class?
        
write_short(get_user_team(attacker)) // team
        
message_end()
        
        
message_begin(MSG_BROADCASTg_msgScoreInfo)
        
write_byte(victim// id
        
write_short(pev(victimpev_frags)) // frags
        
write_short(cs_get_user_deaths(victim)) // deaths
        
write_short(0// class?
        
write_short(get_user_team(victim)) // team
        
message_end()
    }
}

// touch fix
public touch_fix(id)
{
    if (
g_hasSatchel[id])
    {
        
g_hasSatchel[id] = false
        g_hasRadio
[id] = false
        g_hasPlanted
[id] = false
        g_CanPlant
[id] = false
    
}
}

// Ham strip weapon
stock ham_strip_weapon(idweapon[])
{
    if(!
equal(weapon,"weapon_",7)) 
        return 
0
    
    
new wId get_weaponid(weapon)
    
    if(!
wId) return 0
    
    
new wEnt
    
    
while((wEnt find_ent_by_class(wEntweapon)) && entity_get_edict(wEntEV_ENT_owner) != id) {}
    
    if(!
wEnt) return 0
    
    
if(get_user_weapon(id) == wId
        
ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt);
    
    if(!
ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) 
        return 
0
        
    ExecuteHamB
(Ham_Item_KillwEnt)
    
    
entity_set_int(idEV_INT_weaponsentity_get_int(idEV_INT_weapons) & ~(1<<wId))

    return 
1
}
// Reset knife model
stock reset_user_knife(id)
{
    
// Execute weapon Deploy
    
if(user_has_weapon(idCSW_KNIFE))
        
ExecuteHamB(Ham_Item_Deployfind_ent_by_owner(-1"weapon_knife"id))
        
    
// Updating Model
    
engclient_cmd(id"weapon_knife")
    
emessage_begin(MSG_ONEget_user_msgid("CurWeapon"), _id)
    
ewrite_byte(1// active
    
ewrite_byte(CSW_KNIFE// weapon
    
ewrite_byte(-1// clip
    
emessage_end()
}

// Make knockback
stock make_knockback(victimFloat:origin[3], Float:maxspeed)
{
    
// Get and set velocity
    
new Float:fVelocity[3];
    
kickback(victimoriginmaxspeedfVelocity)
    
entity_set_vector(victimEV_VEC_velocityfVelocity);

    return (
1);
}

// Extra calulation for knockback
stock kickback(entFloat:fOrigin[3], Float:fSpeedFloat:fVelocity[3])
{
    
// Find origin
    
new Float:fEntOrigin[3];
    
entity_get_vectorentEV_VEC_originfEntOrigin );

    
// Do some calculations
    
new Float:fDistance[3];
    
fDistance[0] = fEntOrigin[0] - fOrigin[0];
    
fDistance[1] = fEntOrigin[1] - fOrigin[1];
    
fDistance[2] = fEntOrigin[2] - fOrigin[2];
    new 
Float:fTime = (vector_distancefEntOrigin,fOrigin ) / fSpeed);
    
fVelocity[0] = fDistance[0] / fTime;
    
fVelocity[1] = fDistance[1] / fTime;
    
fVelocity[2] = fDistance[2] / fTime;

    return (
fVelocity[0] && fVelocity[1] && fVelocity[2]);

__________________
H.RED.ZONE is offline
shubhamgulati12
Senior Member
Join Date: Oct 2010
Location: Inida The Holy Place!!
Old 05-01-2012 , 09:24   Re: Runtime Errors & Debug Trace Done By Satchel Charge
Reply With Quote #4

Quote:
Originally Posted by H.RED.ZONE View Post
Try
Ok bro will try this out thanks again
__________________

Join Free File hosting - http://db.tt/VvebKSSW
[Free 2 GB cloud storage]
shubhamgulati12 is offline
shubhamgulati12
Senior Member
Join Date: Oct 2010
Location: Inida The Holy Place!!
Old 05-06-2012 , 01:40   Re: Runtime Errors & Debug Trace Done By Satchel Charge
Reply With Quote #5

Quote:
Originally Posted by jc980 View Post
what ZP are you using? 4.3 or 5.0?
Sorry for so late reply
Yes it is zp 5 bro..
And i guess problem is solved using H.RED.ZONE's Sma file
Thanks
__________________

Join Free File hosting - http://db.tt/VvebKSSW
[Free 2 GB cloud storage]
shubhamgulati12 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:17.


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