[13:00:43] [debug] Run time error 4: "Array index out of bounds" [13:00:43] [debug] Attempted to read/write array element at index 99 in array of size 16 [13:00:43] [debug] AMX backtrace: [13:00:43] [debug] #0 000df064 in public FailRob (0, 1) in BlankScript.amx [13:00:43] [debug] #1 000df330 in public AB_OnPlayerDeath (0, 65535, 255) in BlankScript.amx [13:00:43] [debug] #2 00035f24 in public OnPlayerDeathWeapons (0, 65535, 255) in BlankScript.amx [13:00:43] [debug] #3 000319f0 in public ac_OnPlayerDeath (0, 65535, 255) in BlankScript.amx [13:00:43] [debug] #4 0000d348 in public OnPlayerDeath (0, 65535, 255) in BlankScript.amx
new Robber[MAX_PLAYERS];
new BankRobber[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
if(Robber[playerid] != 0)
{
Robber[playerid] = 0;
if(BankRobber[playerid] == 1)
{
BankRobber[playerid] = 0;
FailRob(playerid,1);
}
}
return 1;
}
forward FailRob(playerid,robid);
public FailRob(playerid,robid)
{
if(robid == 1)
{
SendClientMessageToAll(-1,"Test String"); // worked!
DestroyDynamicCP(RobCps[playerid]); // not worked!
//
HideTimer(playerid); // not worked (this stock should hide some textdraws)
}
return 1;
}
new RobCps[MAX_PLAYERS];
new rand = random(sizeof(robberycheckpoints)); RobCps[playerid] = CreateDynamicCP(robberycheckpoints[rand][0],robberycheckpoints[rand][1],robberycheckpoints[rand][2],robberycheckpoints[rand][3], -1, -1, playerid, -1);
new Float: robberycheckpoints[3][4] =
{
{-751.9777,-131.2435,65.8281, 3.0 }, // 1
{-548.4982,-181.6734,78.4063, 3.0 }, // 2
{-520.1964,-544.4396,25.5234, 3.0 }, // 3
};
public FailRob(playerid,robid)
{
if(robid == 1)
{
new Float:X, Float:Y, Float:Z , string[300];
GetPlayerPos(playerid,X,Y,Z);
mbag = CreateObject(1550, X, Y, Z);
mbtxtdraw = Create3DTextLabel("Money Bag",COLOR_CYAN,X,Y,Z-0.8010, 15.0, 0, 0);
//
SendClientMessageToAll(-1,"Test String");
//
DestroyDynamicCP(RobCps[playerid]);
//
HideTimer(playerid);
}
return 1;
}
|
public FailRob(playerid,robid) { if(robid == 1) { SendClientMessageToAll(-1,"Test String"); // worked! DestroyDynamicCP(RobCps[playerid]); // not worked! // HideTimer(playerid); // not worked (this stock should hide some textdraws) } return 1; } |
|
public FailRob(playerid,robid) { if(robid == 1) { SendClientMessageToAll(-1,"Test String"); // worked! DestroyDynamicCP(RobCps[playerid]); // not worked! // HideTimer(playerid); // not worked (this stock should hide some textdraws) } return 1; } |
|
um, i cant send the full code here , i will send it as a private mssge to you and y_less!
|
|
We only need the code in `FailRob` function, not the whole script. If it is that long, upload to pastebin but do not limit the help to just two users.
|
public FailRob(playerid,robid)
{
if(robid == 1)
{
new Float:X, Float:Y, Float:Z , string[300];
GetPlayerPos(playerid,X,Y,Z);
mbag = CreateObject(1550, X, Y, Z);
mbtxtdraw = Create3DTextLabel("Money Bag",COLOR_CYAN,X,Y,Z-0.8010, 15.0, 0, 0);
//
SendClientMessageToAll(-1,"Test String");
//
DestroyDynamicCP(RobCps[playerid]);
//
HideTimer(playerid);
}
return 1;
}
|
i edited my post :
Code:
public FailRob(playerid,robid)
{
if(robid == 1)
{
new Float:X, Float:Y, Float:Z , string[300];
GetPlayerPos(playerid,X,Y,Z);
mbag = CreateObject(1550, X, Y, Z);
mbtxtdraw = Create3DTextLabel("Money Bag",COLOR_CYAN,X,Y,Z-0.8010, 15.0, 0, 0);
//
SendClientMessageToAll(-1,"Test String");
//
DestroyDynamicCP(RobCps[playerid]);
//
HideTimer(playerid);
}
return 1;
}
|