Raised This Month: $ Target: $400
 0% 

API Scripting Help Code error


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 02-07-2012 , 11:08   Code error
Reply With Quote #1

Why do i get this error?
PS: This is an eddited version of the inf. grenade.

Code:
L 02/07/2012 - 15:28:19: [ZP] Invalid Player (15)
L 02/07/2012 - 15:28:19: [AMXX] Displaying debug trace (plugin "zp50_item_infection_bomb.amxx")
L 02/07/2012 - 15:28:19: [AMXX] Run time error 10: native error (native "zp_core_infect")
L 02/07/2012 - 15:28:19: [AMXX]    [0] zp50_item_infection_bomb.sma::infection_explode (line 317)
L 02/07/2012 - 15:28:19: [AMXX]    [1] zp50_item_infection_bomb.sma::fw_ThinkGrenade (line 258)
Line 258

PHP Code:
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;
    
    
// Check if it's one of our custom nades
    
switch (pev(entityPEV_NADE_TYPE))
    {
        case 
NADE_TYPE_INFECTION// Infection Bomb
        
{
258 -->            infection_explode(entity)
            return 
HAM_SUPERCEDE;
        }
    }
    
    return 
HAM_IGNORED;

Line 317

PHP Code:
// Infection Bomb Explosion
infection_explode(ent)
{
    
// Round ended
    
if (zp_gamemodes_get_current() == ZP_NO_GAME_MODE)
    {
        
// Get rid of the grenade
        
engfunc(EngFunc_RemoveEntityent)
        return;
    }
    
    
// Get origin
    
static Float:origin[3]
    
pev(entpev_originorigin)
    
    
// Make the explosion
    
create_blast(origin)
    
    
// Infection nade explode sound
    
static sound[SOUND_MAX_LENGTH]
    
ArrayGetString(g_sound_grenade_infect_exploderandom_num(0ArraySize(g_sound_grenade_infect_explode) - 1), soundcharsmax(sound))
    
emit_sound(entCHAN_WEAPONsound1.0ATTN_NORM0PITCH_NORM)
    
    
// Get attacker
    
new attacker pev(entpev_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_RemoveEntityent)
        return;
    }
    
    
// Collisions
    
new victim = -1
    
    
while ((victim engfunc(EngFunc_FindEntityInSpherevictimoriginNADE_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_Killedvictimattacker0)
            continue;
        }
        
        
// Turn into zombie
317 -->        zp_core_infect(victimattacker)
        
        
// Victim's sound
        
ArrayGetString(g_sound_grenade_infect_playerrandom_num(0ArraySize(g_sound_grenade_infect_player) - 1), soundcharsmax(sound))
        
emit_sound(victimCHAN_VOICEsound1.0ATTN_NORM0PITCH_NORM)
    }
    
    
// Get rid of the grenade
    
engfunc(EngFunc_RemoveEntityent)

Attached Files
File Type: sma Get Plugin or Get Source (zp50_item_infection_bomb.sma - 640 views - 12.8 KB)
__________________

Last edited by H.RED.ZONE; 02-07-2012 at 11:09.
H.RED.ZONE is offline
 



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 01:22.


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