Raised This Month: $ Target: $400
 0% 

[HELP] Run Time Errors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Depresie
Veteran Member
Join Date: Nov 2013
Old 09-06-2015 , 10:42   [HELP] Run Time Errors
Reply With Quote #1

Lately im confronting with run time errors... i have no ideea how to fix most of them so im asking here for a little help

I will post others here aswell with time to avoid creating multiple topics

Here i have this Infection Bomb from ZP 5.0

The only edit i did was to add a Var to store the number of infected players and then print it to chat

The errors i recieve in the logs are listed below, i didn't recieve these erors before the edit, but still, i didnt edit anything related to the lines with problem

Errors:
Spoiler


Code with problems
Code:
public fw_ThinkGrenade(entity)
{
    // Invalid entity
    if (!pev_valid(entity)) return HAM_IGNORED;
    
    // Get damage time of grenade
    static Float:dmgtime
    pev(entity, pev_dmgtime, dmgtime)
    
    // 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(entity, PEV_NADE_TYPE))
    {
        case NADE_TYPE_INFECTION: // Infection Bomb
        {
            infection_explode(entity)
            return HAM_SUPERCEDE;
        }
    }
    
    return HAM_IGNORED;
}

// Infection Bomb Explosion
infection_explode(ent)
{
    // Round ended
    if (zp_gamemodes_get_current() == ZP_NO_GAME_MODE)
    {
        // Get rid of the grenade
        engfunc(EngFunc_RemoveEntity, ent)
        return;
    }
    
    // Get origin
    static Float:origin[3]
    pev(ent, pev_origin, origin)
    
    // Make the explosion
    create_blast(origin)
    
    // Infection nade explode sound
    static sound[SOUND_MAX_LENGTH]
    ArrayGetString(g_sound_grenade_infect_explode, random_num(0, ArraySize(g_sound_grenade_infect_explode) - 1), sound, charsmax(sound))
    emit_sound(ent, CHAN_WEAPON, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
    
    // Get attacker
    new attacker = pev(ent, pev_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_RemoveEntity, ent)
        return;
    }
    
    // Collisions
    new victim = -1
    
    while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, origin, NADE_EXPLOSION_RADIUS)) != 0)
    {
        // Only effect alive humans
        if (!is_user_alive(victim) || zp_core_is_zombie(victim) || !pev_valid(victim))
            continue;
        
        // Last human is killed
        if (zp_core_get_human_count() == 1)
        {
            ExecuteHamB(Ham_Killed, victim, attacker, 0)
            continue;
        }
        
        // Turn into zombie
        zp_core_infect(victim, attacker)
        g_victims++
        
        // Victim's sound
        ArrayGetString(g_sound_grenade_infect_player, random_num(0, ArraySize(g_sound_grenade_infect_player) - 1), sound, charsmax(sound))
        emit_sound(victim, CHAN_VOICE, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
    }
    
    if(g_victims > 0)
    {
        new name[32]
        get_user_name(attacker, name, 31)
        
        zp_ammopacks_set(attacker, zp_ammopacks_get(attacker) + g_victims * get_pcvar_num(cvar_infection_bonus))
        zp_colored_print(0, "Player^x04 %s^x01 infected^x04 %d^x01 Humans with^x04 Infection Bomb^x01", name, g_victims)
        
        g_victims = 0
    }
    
    // Get rid of the grenade
    engfunc(EngFunc_RemoveEntity, ent)
    
}
Full Code:
Spoiler

Last edited by Depresie; 09-07-2015 at 09:34.
Depresie 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 22:03.


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