Help: Error CrashDetect.
#1

Hello guys, i need help... i compile perfectly with pawn, but crashdetect report this error. why??

PHP код:
[debugRun time error 4"Array index out of bounds"
[debug]  Attempted to read/write array element at negative index -1
[debugAMX backtrace:
[
debug#0 003c795c in public OnPlayerUpdate (playerid=2) at C:\Users\1320703\Desktop\GTA3\Server2\gamemodes\KoN.pwn:22859 
PHP код:
if (ud == KEY_UP)
{
 if(
GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
    new 
slot = -1;
    new 
Float:xFloat:yFloat:z;
    for(new 
0MAX_OBJi++)
        if(
dGunData[i][ObjData][0] > && IsValidObject(dGunData[i][ObjData][0]))
        {
            
GetObjectPos(dGunData[i][ObjData][0], xyz);
            if(
IsPlayerInRangeOfPoint(playerid2.0xyz))
            {
                
slot i;
                break;
            }
        }
    
    
    
DestroyObject(dGunData[slot][ObjData][0]);    // <--------------- 22859 Line Error
    
GivePlayerWeapon(playeriddGunData[slot][ObjData][1], dGunData[slot][ObjData][2]);
    
dGunData[slot][ObjData][0] = 0;
    new 
buffer[50];
    
format(buffersizeof(buffer), "%s"GunNames[dGunData[slot][ObjData][1]]);

Reply
#2

If no object found, slot would be -1. Put the last 5 lines in an if statement (slot != -1)
Reply
#3

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
If no object found, slot would be -1. Put the last 5 lines in an if statement (slot != -1)
very thx friend +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)