Runtime Error 4
#1

Help me in this how to fix this one

Код:
ug] Run time error 4: "Array index out of bounds"
[14:57:40] [debug]  Attempted to read/write array element at index 65535 in array of size 2000
[14:57:40] [debug] AMX backtrace:
[14:57:40] [debug] #0 005081d4 in LockGangVehicle (family=1, carid=65535, type=2) at C:\Users\Popong\Desktop\Linux\gamemodes\MC-RP.pwn:85455
[14:57:40] [debug] #1 00406588 in public OnVehicleSpawn (vehicleid=228) at C:\Users\Popong\Desktop\Linux\gamemodes\MC-RP.pwn:66001
[14:57:40] [debug] #2 native SetVehicleToRespawn () from samp-server.exe
[14:57:40] [debug] #3 00307ff4 in public LRAPID_OnGameModeInit () at C:\Users\Popong\Desktop\Linux\gamemodes\MC-RP.pwn:57481
[14:57:40] [debug] #4 0001a86c in public Audio_OnGameModeInit () at C:\Users\Popong\Desktop\Linux\pawno\include\rapidfire.inc:91
[14:57:40] [debug] #5 native CallLocalFunction () from samp-server.exe
[14:57:40] [debug] #6 00011a70 in public SSCANF_OnGameModeInit () at C:\Users\Popong\Desktop\Linux\pawno\include\audio.inc:119
[14:57:40] [debug] #7 0000af30 in public Timers_OnScriptInit () at C:\Users\Popong\Desktop\Linux\pawno\include\sscanf2.inc:205
[14:57:40] [debug] #8 native CallLocalFunction () from samp-server.exe
[14:57:40] [debug] #9 00005aa8 in public zcmd_OnGameModeInit () at C:\Users\Popong\Desktop\Linux\pawno\include\YSI/y_timers.inc:224
[14:57:40] [debug] #10 native CallLocalFunction () from samp-server.exe
[14:57:40] [debug] #11 000045d0 in public Itter_OnGameModeInit () at C:\Users\Popong\Desktop\Linux\pawno\include\ZCMD.inc:68
[14:57:40] [debug] #12 native CallLocalFunction () from samp-server.exe
[14:57:40] [debug] #13 00001c4c in public OnGameModeInit () at C:\Users\Popong\Desktop\Linux\pawno\include\foreach.inc:667
#0 005081d4 in LockGangVehicle (family=1, carid=65535, type=2) at C:\Users\Popong\Desktop\Linux\gamemodes\MC-RP.pwn:85455

PHP код:
LockGangVehicle(familycaridtype)
{
    new 
GetGangVehicle(familycarid);
    if(
FamilyVehicleInfo[family][v][fvId] == carid && type == 2)
    {
        
LockStatus[carid] = 1;
        
vehicle_lock_doors(carid);
    }
}
UnLockGangVehicle(familycaridtype)
{
    new 
GetGangVehicle(familycarid);
    if(
FamilyVehicleInfo[family][v][fvId] == carid && type == 2)
    {
        
LockStatus[carid] = 0;
        
vehicle_unlock_doors(carid);
    }

PHP код:
public OnVehicleSpawn(vehicleid) {
    
VehicleStatus{vehicleid} = 0;
       
TruckContents[vehicleid] = 0;
    
VehicleRadioStation[vehicleid] = 0;
    for(new 
0sizeof(FamilyInfo); i++) {
        for(new 
MAX_GANG_VEHICLESd++) {
            if(
FamilyVehicleInfo[i][d][fvLocked] != && FamilyVehicleInfo[i][d][fvLock] > 0)
                
LockGangVehicle(iFamilyVehicleInfo[i][d][fvId], FamilyVehicleInfo[i][d][fvLock]);
        }
    }
    switch(
GetVehicleModel(vehicleid)) {
        case 
427428432601528SetTimerEx("DelayedVehHealth"1000false"d"vehicleid);
    }
    new 
v;
    foreach(
Playeri)
    {
        
GetPlayerVehicle(ivehicleid);
        if(
!= -1)
        {
             if(
PlayerVehicleInfo[i][v][pvId] == vehicleid && GetVehicleModel(vehicleid) != PlayerVehicleInfo[i][v][pvModelId])
              {
                   
DestroyVehicle(vehicleid);
                   
VehicleRadioStation[vehicleid] = 0;
                
PlayerVehicleInfo[i][v][pvId] = CreateVehicle(PlayerVehicleInfo[i][v][pvModelId], PlayerVehicleInfo[i][v][pvPosX], PlayerVehicleInfo[i][v][pvPosY], PlayerVehicleInfo[i][v][pvPosZ], PlayerVehicleInfo[i][v][pvPosAngle],PlayerVehicleInfo[i][v][pvColor1], PlayerVehicleInfo[i][v][pvColor2], -1);
                if(
PlayerVehicleInfo[i][v][pvLocked] == 1LockPlayerVehicle(iPlayerVehicleInfo[i][v][pvId], PlayerVehicleInfo[i][v][pvLock]);
                
ChangeVehiclePaintjob(PlayerVehicleInfo[i][v][pvId], PlayerVehicleInfo[i][v][pvPaintJob]);
                
ChangeVehicleColor(PlayerVehicleInfo[i][v][pvId], PlayerVehicleInfo[i][v][pvColor1], PlayerVehicleInfo[i][v][pvColor2]);
                for(new 
0MAX_MODSm++)
                   {
                       if(
PlayerVehicleInfo[i][v][pvMods][m] >= 1000 && PlayerVehicleInfo[i][v][pvMods][m] <= 1193)
                       {
                           if(
InvalidModCheck(GetVehicleModel(vehicleid), PlayerVehicleInfo[i][v][pvMods][m]))
                          {
                              
AddVehicleComponent(PlayerVehicleInfo[i][v][pvId], PlayerVehicleInfo[i][v][pvMods][m]);
                          }
                          else
                          {
                              
//printf("Removing invalid mod %d from %d of %s", PlayerVehicleInfo[i][v][pvMods][m], GetVehicleModel(vehicleid), GetPlayerNameEx(i));
                              
PlayerVehicleInfo[i][v][pvMods][m] = 0;
                          }
                    }
                  }
             }
             else
            {
                
ChangeVehiclePaintjob(vehicleidPlayerVehicleInfo[i][v][pvPaintJob]);
                
ChangeVehicleColor(vehicleidPlayerVehicleInfo[i][v][pvColor1], PlayerVehicleInfo[i][v][pvColor2]);
                for(new 
0MAX_MODSm++)
                {
                    if(
PlayerVehicleInfo[i][v][pvMods][m] >= 1000 && PlayerVehicleInfo[i][v][pvMods][m] <= 1193)
                       {
                        if(
InvalidModCheck(GetVehicleModel(vehicleid), PlayerVehicleInfo[i][v][pvMods][m]))
                        {
                            
AddVehicleComponent(PlayerVehicleInfo[i][v][pvId], PlayerVehicleInfo[i][v][pvMods][m]);
                        }
                        else
                        {
                            
//printf("Removing invalid mod %d from %d of %s", PlayerVehicleInfo[i][v][pvMods][m], GetVehicleModel(vehicleid), GetPlayerNameEx(i));
                            
PlayerVehicleInfo[i][v][pvMods][m] = 0;
                        }
                    }
                }
                if(
PlayerVehicleInfo[i][v][pvLocked] == 1LockPlayerVehicle(iPlayerVehicleInfo[i][v][pvId], PlayerVehicleInfo[i][v][pvLock]);
            }
            new 
string[128];
            
format(string,sizeof(string),"Your %s has been sent to the location at which you last parked it.",GetVehicleName(vehicleid));
            
SendClientMessage(iCOLOR_GRAD1string);
        }
    }
    if(
LockStatus[vehicleid])
    {
        foreach(
Playeri)
        {
            if(
PlayerInfo[i][pLockCar] == vehicleid)
            {
                
PlayerInfo[i][pLockCar] = INVALID_VEHICLE_ID;
            }
        }
    }
    if(
VehicleBomb{vehicleid} == 1)
    {
        foreach(
Playeri)
        {
            if(
PlayerInfo[i][pFaction] == || PlayerInfo[i][pLeader] == 4)
            {
                if(
PlacedVehicleBomb[i] == vehicleid)
                {
                    
VehicleBomb{vehicleid} = 0;
                      
PlacedVehicleBomb[i] = INVALID_VEHICLE_ID;
                    
PickUpC4(i);
                    
PlayerInfo[i][pC4Used] = 0;
                    
PlayerInfo[i][pC4Get] = 1;
                }
            }
        }
    }
    return 
1;

#3 00307ff4 in public LRAPID_OnGameModeInit () at C:\Users\Popong\Desktop\Linux\gamemodes\MC-RP.pwn:57481
PHP код:
    for(new x;x<sizeof(SANVehicles);x++) {
        
format(stringsizeof(string), "SAN %d"SANVehicles[x]);
        
SetVehicleNumberPlate(SANVehicles[x], string);
        
SetVehicleToRespawn(SANVehicles[x]);
    } 
Help me to fix this
Reply
#2

Код:
LockGangVehicle(family, carid, type) 
{ 
	if(!IsValidVehicle(vehicleid)) // Check if vehicle is valid / created
		return;

    new v = GetGangVehicle(family, carid); 
    if(FamilyVehicleInfo[family][v][fvId] == carid && type == 2) 
    { 
        LockStatus[carid] = 1; 
        vehicle_lock_doors(carid); 
    } 
} 

UnLockGangVehicle(family, carid, type) 
{ 
	if(!IsValidVehicle(vehicleid)) // Check if vehicle is valid / created
		return;

    new v = GetGangVehicle(family, carid); 
    if(FamilyVehicleInfo[family][v][fvId] == carid && type == 2) 
    { 
        LockStatus[carid] = 0; 
        vehicle_unlock_doors(carid); 
    } 
}
Reply
#3

Код:
C:\Users\Popong\Desktop\Linux\gamemodes\MC-RP.pwn(84797) : error 017: undefined symbol "IsValidVehicle"
C:\Users\Popong\Desktop\Linux\gamemodes\MC-RP.pwn(84810) : error 017: undefined symbol "IsValidVehicle"
C:\Users\Popong\Desktop\Linux\gamemodes\MC-RP.pwn(85458) : error 017: undefined symbol "IsValidVehicle"
C:\Users\Popong\Desktop\Linux\gamemodes\MC-RP.pwn(85471) : error 017: undefined symbol "IsValidVehicle"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
ived got this error
Reply
#4

https://sampwiki.blast.hk/wiki/IsValidVehicle

it states that "isvalidvehicle" function is not defined in the include. So, I would recommend you to add

Код:
native IsValidVehicle(vehicleid);
On top in your script with all the other variables you might have there.

Then try to recompile. Next time - use ****** for this


btw i found a mistake in the code above. Instead of carid he had used vehicleid, which is not an entering parameter for the function:

PHP код:
LockGangVehicle(familycaridtype

    if(!
IsValidVehicle(carid)) // replaced vehicleid with carid
        
return;
    new 
GetGangVehicle(familycarid); 
    if(
FamilyVehicleInfo[family][v][fvId] == carid && type == 2
    { 
        
LockStatus[carid] = 1
        
vehicle_lock_doors(carid); 
    } 

UnLockGangVehicle(familycaridtype

    if(!
IsValidVehicle(carid)) // replaced vehicleid with carid
        
return;
    new 
GetGangVehicle(familycarid); 
    if(
FamilyVehicleInfo[family][v][fvId] == carid && type == 2
    { 
        
LockStatus[carid] = 0
        
vehicle_unlock_doors(carid); 
    } 

Reply
#5

Thanks to you man its work but i have one problem !!

Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[16:05:26] 
[16:05:26] Server Plugins
[16:05:26] --------------
[16:05:26]  Loading plugin: crashdetect.dll
[16:05:26]   CrashDetect v4.17 is OK.
[16:05:26]   Loaded.
[16:05:26]  Loading plugin: streamer.dll
[16:05:26] 

*** Streamer Plugin v2.8.2 by Incognito loaded ***

[16:05:26]   Loaded.
[16:05:26]  Loading plugin: sscanf.dll
[16:05:26] 

[16:05:26]  ===============================

[16:05:26]       sscanf plugin loaded.     

[16:05:26]          Version:  2.8.2        

[16:05:26]    © 2012 Alex "******" Cole  

[16:05:26]  ===============================

[16:05:26]   Loaded.
[16:05:26]  Loading plugin: Whirlpool.dll
[16:05:26]  
[16:05:26]  ==================
[16:05:26]  
[16:05:26]   Whirlpool loaded
[16:05:26]  
[16:05:26]  ==================
[16:05:26]  
[16:05:26]   Loaded.
[16:05:26]  Loading plugin: audio.dll
[16:05:26] 

*** Audio Plugin v0.5 R2 by Incognito loaded ***

[16:05:26]   Loaded.
[16:05:26]  Loaded 5 plugins.

[16:05:26] 
[16:05:26] Filterscripts
[16:05:26] ---------------
[16:05:26]   Loading filterscript 'anims.amx'...
[16:05:26]   Loading filterscript 'yom_buttons.amx'...
[16:05:26]   Loading filterscript 'zmapping.amx'...
[16:05:27]   Loaded 3 filterscripts.

[16:05:27] *** Audio Plugin: Started TCP server on port 7777
[16:05:27] test.
[16:07:23] 
----------------------------------
[16:07:23] MetroCity Roleplay PH
[16:07:23] ----------------------------------

[16:07:23] Number of vehicle models: 111
[16:08:27] [connection] 192.168.1.10:59460 requests connection cookie.
[16:08:28] [connection] incoming connection: 192.168.1.10:59460 id: 0
[16:08:29] [join] Vladimir_Hercov has joined the server (0:192.168.1.10)
Everytime i connect im crashing but when i connect to other server its not crashing and its work perfectly to other server what is the problem in this

Sorry for bad english
Reply
#6

please help me this one this is my last problem
Reply
#7

Everything is fine there.. Anything from crashdetect log??
Reply
#8

i have no errors from crashdetect my problem is i cant connect and im crashing from server
Reply
#9

Well why don't you get server up online. Try with friend. If he is crashing too then problem might be in your OnPlayerSpawn or OnPlayerConnect. If he is not crashing problem is with you..
Reply
#10

im trying to online now but streamer and sscanf updated to 2.8.2 is failed to load but in test server streamer and sscanf is well done loading . im hosting in vortex server
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)