Hi,
I have got an error
Debug :
Stats Command
Thnx in Advance :)
I have got an error
Debug :
Code:
[debug] Run time error 4: "Array index out of bounds"
[debug] Accessing element at negative index -1
[debug] AMX backtrace:
[debug] #0 00290fa4 in public cmd_stats (0, 2752580) from CCNR.amx
[debug] #1 002905ac in public cmd_stats (0, 2741220) from CCNR.amx
[debug] #2 native CallLocalFunction () from samp-server.exe
[debug] #3 0003eeb0 in public OnPlayerCommandText (0, 2741192) from CCNR.amx
PHP Code:
COMMAND:stats(playerid, params[]) //
{
new msg[1200];
new msg3[200];
new otherID, gID;
if(sscanf(params, "u", otherID))
{
format(msg, sizeof(msg), "%d", playerid);
cmd_stats(playerid, msg);
}
else
{
if(!isConnected(otherID))
{
if(Player[playerid][english])
//Server(playerid, "That player isn't logged in!.");
SendClientMessage(playerid,COLOR_RED,"The requested player is not connected.");
else
Server(playerid, "Player tidak login.");
return 1;
}
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nKills : "CHAT_YELLOW"%d", msg, Player[otherID][playerKills]);
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nDeaths : "CHAT_YELLOW"%d", msg, Player[otherID][playerDeaths]);
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nXP : "CHAT_YELLOW"%d", msg, Player[otherID][playerXP]);
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nScore : "CHAT_YELLOW"%d", msg, Player[otherID][playerScore]);
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nMoney : "CHAT_YELLOW"%s", msg, FormatNumber(Player[otherID][playerMoney]));
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nRob : "CHAT_YELLOW"%d", msg, Player[otherID][playerRob]);
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nWanted Level : "CHAT_YELLOW"%d", msg, Player[otherID][playerWanted]);
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nPilot Missions : "CHAT_YELLOW"%d", msg, Player[otherID][missions]);
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nDelivery Missions : "CHAT_YELLOW"%d", msg, Player[otherID][delivery]);
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nTaxi Missions : "CHAT_YELLOW"%d", msg, Player[otherID][taxi]);
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nBus Missions : "CHAT_YELLOW"%d", msg, Player[otherID][bus]);
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nPlayer Vehicles : "CHAT_YELLOW"%d", msg, countplayerVeh(otherID));
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nVIP : ", msg);
if(Player[otherID][vipLevel] > 0)
{
format(msg, sizeof(msg), "%s"CHAT_YELLOW"Yes", msg);
}
else
{
format(msg, sizeof(msg), "%s"CHAT_RED"No", msg);
}
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nJailed : ", msg);
if(Player[otherID][isJailed])
{
format(msg, sizeof(msg), "%s"CHAT_YELLOW"Yes", msg);
}
else
{
format(msg, sizeof(msg), "%s"CHAT_RED"No", msg);
}
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nAFK : ", msg);
if(Player[otherID][paused])
{
format(msg, sizeof(msg), "%s"CHAT_YELLOW"Yes", msg);
}
else
{
format(msg, sizeof(msg), "%s"CHAT_RED"No", msg);
}
format(msg, sizeof(msg), "%s"CHAT_WHITE"\nGang : ", msg);
if(inGang(otherID))
{
gID = findGang(otherID);
format(msg, sizeof(msg), "%s{%s}%s", msg, Gang[gID][gangColor], Gang[gID][gangName]);
}
else
{
format(msg, sizeof(msg), "%s"CHAT_RED"NO GANG", msg);
}
format(msg3, sizeof(msg3), "Viewing %s(%d)'s Statistics", GetName(otherID), playerid);
//ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, msg3 , msg, "Close", "");
}
ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, msg3 , msg, "Done", "");
return 1;
}