Run time error 4: "Array index out of bounds (more then 6/7:C)
#6

OnVehicleDeath, you must check killerid before using it to avoid run time 4 error, same in OnPlayerDeath
PHP код:
public OnVehicleDeath(vehicleidkillerid)
{
    if(
killerid != INVALID_PLAYER_ID)
    {
        new 
text[128];
        if(
IsCapturing[killerid][usapro] == 1)
        {
            if(
vehicleid == usapro)
            {
            
DisablePlayerCheckpoint(killerid);
                
IsCapturing[killerid][usapro] = 0;
                    
format(textsizeof(text), "%s has failed to capture the USA Prototype."pName(killerid));
                            
SendClientMessageToAllREDtext);
                            
TogglePlayerAllDynamicCPs(killerid1);
            }
        }
        if(
IsCapturing[killerid][auspro] == 1)
        {
            if(
vehicleid == auspro)
            {
            
DisablePlayerCheckpoint(killerid);
                
IsCapturing[killerid][auspro] = 0;
                    
format(textsizeof(text), "%s has failed to capture the Australian Prototype."pName(killerid));
                            
SendClientMessageToAllREDtext);
                            
TogglePlayerAllDynamicCPs(killerid1);
            }
        }
        if(
IsCapturing[killerid][sovpro] == 1)
        {
            if(
vehicleid == sovpro)
            {
            
DisablePlayerCheckpoint(killerid);
                
IsCapturing[killerid][sovpro] = 0;
                        
format(textsizeof(text), "%s has failed to capture the Arabian Prototype."pName(killerid));
                            
SendClientMessageToAllREDtext);
                            
TogglePlayerAllDynamicCPs(killerid1);
            }
        }
        if(
IsCapturing[killerid][eurapro] == 1)
        {
            if(
vehicleid == eurapro)
            {
            
DisablePlayerCheckpoint(killerid);
                
IsCapturing[killerid][eurapro] = 0;
        
format(textsizeof(text),"%s has failed to capture the Arabian Prototype."pName(killerid));
                            
SendClientMessageToAllREDtext);
                            
TogglePlayerAllDynamicCPs(killerid1);
            }
        }
        new 
Float:P[3]; GetVehiclePos(vehicleidP[0], P[1], P[2]);
            if(
P[2] <= 0.4) return true;
            new 
model GetVehicleModel(vehicleid);
            switch(
model)
            {
                case 
PLANES: return true;
                case 
HELIS: return true;
                default:
                {
                    new
                                    
ht random(EFFECT_RANDOM),
                                    
xang random(EFFECT_RANDOM)-EFFECT_FIX_DEFAULT,
                                    
yang random(EFFECT_RANDOM)-EFFECT_FIX_DEFAULT,
                                    
zang random(EFFECT_RANDOM)
                            ;
                            
GetVehiclePos(vehicleidP[0], P[1], P[2]);
                            
CreateExplosion(P[0], P[1], P[2]+EFFECT_EXPLOSIONOFFSETEFFECT_EXPLOSIONTYPEEFFECT_EXPLOSIONRADIUS);
                            
SetVehicleAngularVelocity(vehicleidxang*EFFECT_MULTIPLIERyang*EFFECT_MULTIPLIERzang*EFFECT_FIX_Z);
                            
GetVehicleVelocity(vehicleidP[0], P[1], P[2]);
                            
SetVehicleVelocity(vehicleidP[0], P[1], P[2] + (ht*EFFECT_FIX_Z) );
                }
            }
    }
    return 
1;

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)