[debug] Run time error 4: "Array index out of bounds" [debug] Accessing element at index 4 past array upper bound 3 [debug] AMX backtrace: [debug] #0 00018294 in ?? (0) from hagakure_script.amx [debug] #1 0000f0c8 in public inc_Ven_OnPlayerConnect (0) from hagakure_script.amx [debug] #2 0000bfa8 in public SSCANF_OnPlayerConnect (0) from hagakure_script.amx [debug] #3 0000509c in public Iter_OnPlayerConnect (0) from hagakure_script.amx [debug] #4 native CallLocalFunction () from samp-server.exe [debug] #5 00002f18 in public f3_KBROnPlayerConnect (0) from hagakure_script.amx [debug] #6 000023fc in public AB_OnPlayerConnect (0) from hagakure_script.amx [debug] #7 00000684 in public OnPlayerConnect (0) from hagakure_script.amx
public OnPlayerConnect(playerid)
{
new query[128];
SetPlayerColor(playerid, 0xFFFFFFFF);
TogglePlayerControllable(playerid, false);
AddPlayerTextdraws(playerid);
mysql_format(mysql, query, sizeof(query), "SELECT `pPass`, `pID` FROM `accs` WHERE `pName` = '%e' LIMIT 1", PlayerName(playerid));
mysql_tquery(mysql, query, "OnAccountCheck", "d", playerid);
ResetPlayerVariables(playerid);
return 1;
}
forward OnAccountCheck(playerid); public OnAccountCheck(playerid)
{
SetPlayerColor(playerid, 0xFFFFFFFF);
new rows, fields;
cache_get_data(rows, fields, mysql);
if(rows)
{
cache_get_field_content(0, "pPass", pData[playerid][pPass], mysql, 129);
pData[playerid][pID] = cache_get_field_content_int(0, "pID");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{69FFA2}HAGAKURE's Reallife Server Login", "We could find your Account in our database, please type in your password:", "{69FFA2}Login", "{FF6347}Exit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "HAGAKURE's Reallife Server Register", "We couldn't find your Account in our database. Please register", "{69FFA2}Register", "{FF6347}Exit");
}
return 1;
}
|
Hello!
Can you show us your functions AddPlayerTextdraws and ResetPlayerVariables. ![]() |
stock AddPlayerTextdraws(playerid)
{
topbar[playerid] = CreatePlayerTextDraw(playerid,690.000000, 0.000000, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~");
PlayerTextDrawBackgroundColor(playerid,topbar[playerid], 255);
PlayerTextDrawFont(playerid,topbar[playerid], 1);
PlayerTextDrawLetterSize(playerid,topbar[playerid], 0.500000, 1.200000);
PlayerTextDrawColor(playerid,topbar[playerid], -1);
PlayerTextDrawSetOutline(playerid,topbar[playerid], 0);
PlayerTextDrawSetProportional(playerid,topbar[playerid], 1);
PlayerTextDrawSetShadow(playerid,topbar[playerid], 1);
PlayerTextDrawUseBox(playerid,topbar[playerid], 1);
PlayerTextDrawBoxColor(playerid,topbar[playerid], 255);
PlayerTextDrawTextSize(playerid,topbar[playerid], -37.000000, 4.000000);
PlayerTextDrawSetSelectable(playerid,topbar[playerid], 0);
bottombar[playerid] = CreatePlayerTextDraw(playerid,690.000000, 346.000000, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~");
PlayerTextDrawBackgroundColor(playerid,bottombar[playerid], 255);
PlayerTextDrawFont(playerid,bottombar[playerid], 1);
PlayerTextDrawLetterSize(playerid,bottombar[playerid], 0.500000, 1.200000);
PlayerTextDrawColor(playerid,bottombar[playerid], -1);
PlayerTextDrawSetOutline(playerid,bottombar[playerid], 0);
PlayerTextDrawSetProportional(playerid,bottombar[playerid], 1);
PlayerTextDrawSetShadow(playerid,bottombar[playerid], 1);
PlayerTextDrawUseBox(playerid,bottombar[playerid], 1);
PlayerTextDrawBoxColor(playerid,bottombar[playerid], 255);
PlayerTextDrawTextSize(playerid,bottombar[playerid], -37.000000, 4.000000);
PlayerTextDrawSetSelectable(playerid,bottombar[playerid], 0);
centerHUDInfo[playerid] = CreatePlayerTextDraw(playerid,314.000000, 352.000000, "");
PlayerTextDrawAlignment(playerid,centerHUDInfo[playerid], 2);
PlayerTextDrawBackgroundColor(playerid,centerHUDInfo[playerid], 255);
PlayerTextDrawFont(playerid,centerHUDInfo[playerid], 1);
PlayerTextDrawLetterSize(playerid,centerHUDInfo[playerid], 0.600000, 3.000000);
PlayerTextDrawColor(playerid,centerHUDInfo[playerid], -1);
PlayerTextDrawSetOutline(playerid,centerHUDInfo[playerid], 0);
PlayerTextDrawSetProportional(playerid,centerHUDInfo[playerid], 1);
PlayerTextDrawSetShadow(playerid,centerHUDInfo[playerid], 1);
PlayerTextDrawSetSelectable(playerid,centerHUDInfo[playerid], 0);
}
stock ResetPlayerVariables(playerid)
{
pData[playerid][pID] = 0;
format(pData[playerid][pName], 1, "");
pData[playerid][pLevel] = 0;
format(pData[playerid][pPass], 1, "");
format(pData[playerid][pRegisterIP], 1, "");
pData[playerid][pAdmin] = 0;
pData[playerid][pMoney] = 0;
pData[playerid][pHoursPlayed] = 0;
pData[playerid][pSkin] = 0;
pData[playerid][pGender] = 0;
pData[playerid][pInterior] = 0;
pData[playerid][pVirtualWorld] = 0;
pData[playerid][pMask] = 0;
pData[playerid][pVIP] = 0;
pData[playerid][pRadioChannel] = 0;
pData[playerid][pRadio] = 0;
pData[playerid][pHelper] = 0;
pData[playerid][pHospital] = 0;
pData[playerid][pHospitalLevel] = 0;
pData[playerid][pPhNumber] = 0;
pData[playerid][pPhCase] = 0;
pData[playerid][pHasBankCard] = 0;
pData[playerid][pBankMoney] = 0;
pData[playerid][pBanned] = 0;
pData[playerid][pBanAppealable] = 0;
format(pData[playerid][pBanReason], 1, "");
pData[playerid][pBannedBy] = 0;
format(pData[playerid][pBanDate], 1, "");
pData[playerid][pWarnings] = 0;
pData[playerid][pMuted] = 0;
pData[playerid][pFrozen] = 0;
pData[playerid][pPassport] = 0;
pData[playerid][pDriversLicense] = 0;
pData[playerid][pFlyingLicense] = 0;
pData[playerid][pTaxiLicense] = 0;
pData[playerid][pWeaponLicense] = 0;
pData[playerid][pBoatLicense] = 0;
format(pData[playerid][pRegisterDate], 1, "");
format(pData[playerid][pLastLoginDate], 1, "");
pData[playerid][pUpgradesLeft] = 0;
pData[playerid][pStrengthUpgrade] = 0;
pData[playerid][pHealthUpgrade] = 0;
pData[playerid][pWalkStyle] = 0;
pData[playerid][pChatStyle] = 0;
pData[playerid][pFaction] = 0;
pData[playerid][pFactionRank] = 0;
pData[playerid][pFactionSkin] = 0;
pData[playerid][pUsingFactionSkin] = 0;
pData[playerid][pCanManageFaction] = 0;
pData[playerid][pBadge] = 0;
pData[playerid][pWearsBadge] = 0;
pData[playerid][pPosX] = 0;
pData[playerid][pPosY] = 0;
pData[playerid][pPosZ] = 0;
pData[playerid][pPosA] = 0;
moneytimer[playerid] = -1;
paccsavetimr[playerid] = -1;
gPlayerFirstSpawn[playerid] = 0;
gPlayerLogged[playerid] = 0;
displayingText[playerid] = 0;
hideCenterHUDTimerID[playerid] = -1;
MaskID[playerid] = 0;
for(new i = 0; i < 5; i++)
{
heditinside[playerid][i] = 0;
heditoutside[playerid][i] = 0;
}
heditingoutside[playerid] = 0;
heditinginside[playerid] = 0;
hprice[playerid] = 0;
hMaxFurn[playerid] = 0;
houtsideinterior[playerid] = 0;
houtsidevirtualworld[playerid] = 0;
hinsideinterior[playerid] = 0;
}
new Float:heditinside[MAX_PLAYERS][4], Float:heditoutside[MAX_PLAYERS][4], hprice[MAX_PLAYERS], hMaxFurn[MAX_PLAYERS], houtsideinterior[MAX_PLAYERS], houtsidevirtualworld[MAX_PLAYERS], hinsideinterior[MAX_PLAYERS], heditingoutside[MAX_PLAYERS], heditinginside[MAX_PLAYERS];
for(new i = 0; i < sizeof heditinside[]; i++)
|
The size of the second dimension is 4, that means that 0-3 are the valid indexes and any other will result to a run time error 4.
When it is not an enum-array, you better use sizeof so it will determinate the size itself. Using: pawn Код:
|