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

Invalid player errors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
F0RCE
Senior Member
Join Date: Oct 2010
Old 01-05-2013 , 13:30   Invalid player errors
Reply With Quote #1

Hello, I have some weird player errors in Zombie Plague.

PHP Code:
L 01/05/2013 10:36:21: [ZPInvalid Player (4)
L 01/05/2013 10:36:21: [AMXXDisplaying debug trace (plugin "zp50_item_infection_bomb.amxx")
L 01/05/2013 10:36:21: [AMXXRun time error 10native error (native "zp_core_infect")
L 01/05/2013 10:36:21: [AMXX]    [0zp50_item_infection_bomb.sma::infection_explode (line 323)
L 01/05/2013 10:36:21: [AMXX]    [1zp50_item_infection_bomb.sma::fw_ThinkGrenade (line 264
And here are functions :

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

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
        
zp_core_infect(victimattacker// 332 line
        
        // 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)


Anyone know how to fix that?
F0RCE is offline
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 01-05-2013 , 14:15   Re: Invalid player errors
Reply With Quote #2

zp_core_infect native
if you see the native, you see that this happens only if player is died. with your VICTIM_ID is dead.
PHP Code:

public native_core_infect(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_alive(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return 
false;
    }
    
    if (
flag_get(g_IsZombieid))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Player already infected (%d)"id)
        return 
false;
    }
    
    new 
attacker get_param(2)
    
    
InfectPlayer(idattacker)
    return 
true;

you can try before turning to zombie check
PHP Code:
if(is_user_alive(victim))
{
        
// Turn into zombie
        
zp_core_infect(victimattacker// 332 line
}
else
{
        continue;

why you need to double check if is_user_alive i can't answer.. maybe cause from first line to this line passed a some time when player get killed..
__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT

Last edited by AngeIII; 01-05-2013 at 14:31.
AngeIII is offline
Send a message via Skype™ to AngeIII
Reply



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 20:29.


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