13.11.2016, 17:11
My server has 3 factions, and for some reason the first one(OG) is being bugged. Randomly the player will spawn with no weapons and armour due and the server will receive a warning "[debug] Run time error 4: "Array index out of bounds
I have tried what not but it seems pointless so I came here to see if somebody can help me out. This is the code:
Quote:
"[19:45:12] [debug] Accessing element at index 4 past array upper bound 2 [19:45:12] [debug] AMX backtrace: [19:45:12] [debug] #0 0000657c in public OnPlayerSpawn (playerid=0) at D:\testing this\gamemodes\daddy.pwn:1002" |
PHP код:
new Float:OGSP[3][4] = {
{2275.7551, 73.9329, 34.9834, 98.1074},
{2269.6616, 61.7941, 26.4844, 281.2002},
{2285.2012, 84.8202, 26.4844, 298.2320}
};
if(gTeam[playerid] == OG)
{
if(dead[playerid] == 0)
{
SetPlayerPos(playerid,OGSP[rand][0],OGSP[rand][1],OGSP[rand][2]); //1003rd line where I get the error from.
SetPlayerFacingAngle(playerid,OGSP[rand][3]);
SetPlayerArmour(playerid, 100);
SetCameraBehindPlayer(playerid);
GivePlayerWeapon(playerid, 24, 300);
return 1;
}