OnPlayerSpawn Array index of Bounds
#3

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
A more readable version of this, i'll edit my comment soon.

Код:
[18:00:10] [debug] Run time error 4: "Array index out of bounds"
[18:00:10] [debug] Accessing element at index 193 past array upper bound 13
[18:00:10] [debug] AMX backtrace:
[18:00:10] [debug] #0 000c0c58 in ?? (0) from ESS2.amx
[18:00:10] [debug] #1 0002297c in public OnPlayerSpawn (0) from ESS2.amx
PHP код:
public OnPlayerSpawn(playerid)
{
    
ShowZonesForPlayer(playerid); 
    
God_Mode_Verify(playerid);
    
SetPlayerInterior(playerid0); 
    
SetPlayerSpecialAction(playerid0);
    
SetPlayerVirtualWorld(playerid0); 
    
SavePlayer(playerid);
    
CosminInfo[playerid][AFKBRB] = 0
    
CosminInfo[playerid][Spawned] = 1;
    
TextDrawHideForPlayer(playerid,BRB[0]);
    
ConnectTDHide(playerid);
    
PlayerPlaySound(playerid10630.00.00.0);
    if(
CosminInfo[playerid][HideTDS] == 0
        
TextDrawShowForPlayer(playeridWES_TD[0]), 
        
TextDrawShowForPlayer(playeridWES_TD[1]), 
        
TextDrawShowForPlayer(playeridWES_TD[2]), 
        
TextDrawShowForPlayer(playeridWES_TD[3]), 
        
TextDrawShowForPlayer(playeridWES_TD[4]), 
        
TextDrawShowForPlayer(playeridWES_TD[5]), 
        
TextDrawShowForPlayer(playeridliTeleTD); 
        
//TextDrawShowForPlayer(playerid, Pont[0]), TextDrawShowForPlayer(playerid, Pont[1]), TextDrawShowForPlayer(playerid, Pont[2]);
    
    //--------------------------------------------------------------------------
    
SetPlayerCheckpoint(playerid1319.1544,1249.3938,10.82032.0);
    
//--------------------------------------------------------------------------
    
    
switch(CosminInfo[playerid][Language])
    {
        case 
0PlayerTextDrawShow(playeridRandom_TD_Texts);
        case 
1PlayerTextDrawShow(playeridRandom_TD_Texts_RO);
    }
    
//--------------------------------------------------------------------------
    
    
if(ClanInfo[CosminInfo[playerid][ClanID]][SpawnX] != 0)
    {
        
SetPlayerPos(playeridClanInfo[CosminInfo[playerid][ClanID]][SpawnX], ClanInfo[CosminInfo[playerid][ClanID]][SpawnY], ClanInfo[CosminInfo[playerid][ClanID]][SpawnZ]);
        
SetPlayerFacingAngle(playeridClanInfo[CosminInfo[playerid][ClanID]][SpawnA]);
    }
    
//--------------------------------------------------------------------------
    
    
if(ClanInfo[CosminInfo[playerid][ClanID]][SpawnX] == 0)
    {
        new 
rSpawn random(; switch(rSpawn)
        {
            case 
0SetPlayerPos(playerid, -70.0371,2502.8616,16.6314 ); // AA
            
case 1SetPlayerPos(playerid1942.1929,-2383.1050,13.6628    ); // LSAir
            
case 2SetPlayerPos(playerid, -1369.4698,-478.3749,14.2305    ); // SFAir
            
case 3SetPlayerPos(playerid1315.9774,1277.6951,10.8203    ); // LVAir
            
case 4SetPlayerPos(playerid, -2340.3953,-1602.7417,483.7599 ); // Chilliad
            
case 5SetPlayerPos(playerid1420.3746,2773.9958,11.0972 ); // Stunt Golf
            
case 6SetPlayerPos(playerid, -2227.6587,2326.2891,7.5894 ); // Pimps
            
case 7SetPlayerPos(playerid, -2639.6819,1356.3484,7.1629 ); // Jizzy's
            
case 8SetPlayerPos(playerid356.9382,-1840.1594,3.7349 ); // Beach
        
}
    }
    
//--------------------------------------------------------------------------
    
    
if(CosminInfo[playerid][Jailed] != 0)
    {
        
SendClientMessage(playeridCOLOR_ULTRARED"You cannot escape from Jail! You have to wait a few minutes.");
        
SetTimerEx("Jailing"10000"i"playerid);
    }
   
    
//--------------------------------------------------------------------------
    
mysql_tquery(DB_Connect"SELECT * FROM `Clans`""LoadClans""");
    
//--------------------------------------------------------------------------
    
    
if(CosminInfo[playerid][GangID] != 0)
    {
        
SetupPlayerForGang(playeridCosminInfo[playerid][GangID]);
    }
    
//--------------------------------------------------------------------------
    
    
if(CosminInfo[playerid][ClanID] != 0)
    {
        
SetupPlayerForClan(playeridCosminInfo[playerid][ClanID]);
    }
    
    
//--------------------------------------------------------------------------
    
CheckDMInfo(playerid); 
    
SetPlayerScore(playeridGiveNote(playerid));
    
//--------------------------------------------------------------------------
    
return 1;

1- Indent your code
2- One function used per line
3- Show declarations for all the variables used in this public function.

I.e the variable ClanInfo and the enum used.
Does not work.


enum ClanData
{
Float:SpawnX, ClanName[30], Float:SpawnY, Float:SpawnZ, LeaderSkin, Skin, Name, Rank, Float:SpawnA,
Weap1, Weap2, Weap3, Weap4, Weap5, Weap6, Weap7, ClanColor, ID
};

new ClanInfo[MAX_CLANS][ClanData];

#define MAX_CLANS 1150
Reply


Messages In This Thread
OnPlayerSpawn Array index of Bounds - by Cezar98 - 04.08.2018, 16:10
Re: OnPlayerSpawn Array index of Bounds - by RogueDrifter - 04.08.2018, 17:59
Re: OnPlayerSpawn Array index of Bounds - by Cezar98 - 04.08.2018, 18:09
Re: OnPlayerSpawn Array index of Bounds - by RogueDrifter - 04.08.2018, 18:17
Re: OnPlayerSpawn Array index of Bounds - by Cezar98 - 04.08.2018, 18:22
Re: OnPlayerSpawn Array index of Bounds - by RogueDrifter - 04.08.2018, 18:27

Forum Jump:


Users browsing this thread: 1 Guest(s)