I'm getting errors in my console when the player dis/connect and i can't figure out why this happens.
This is the printed errors:
And when i connect back:
There is my OnPlayerConnect/Disconnect:
Anyone know why this keeps happens?
Thanks in advance.
This is the printed errors:
Code:
[17:10:39] [debug] Run time error 4: "Array index out of bounds"
[17:10:39] [debug] AMX backtrace:
[17:10:39] [debug] #0 00084cec in public _y_utils_OnPlayerDisconnect (playerid=0, reason=1) at C:\Users\_oMa37\Desktop\San Andreas Wars\gamemodes\SA-Wars.pwn:2134
[17:10:39] [debug] #1 00040230 in public SSCANF_OnPlayerDisconnect (playerid=0, reason=1) at C:\Users\_oMa37\Desktop\San Andreas Wars\pawno\include\YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\y_utils.inc:254
[17:10:39] [debug] #2 00032300 in public ac_OnPlayerDisconnect (playerid=0, reason=1) at C:\Users\_oMa37\Desktop\San Andreas Wars\pawno\include\sscanf2.inc:260
[17:10:39] [debug] #3 0000b6c4 in public Streamer_OnPlayerDisconnect (playerid=0, reason=1) at C:\Users\_oMa37\Desktop\San Andreas Wars\pawno\include\nex-ac.inc:2148
[17:10:39] [debug] #4 00000788 in OnPlayerDisconnect (playerid=0, reason=1, ... <1073741821 arguments>) at C:\Users\_oMa37\Desktop\San Andreas Wars\pawno\include\streamer.inc:325
[17:10:39] [debug] #5 00041930 in public OnPlayerDisconnect (... <2 arguments>) at C:\Users\_oMa37\Desktop\San Andreas Wars\pawno\include\YSI\..\YSI_Data\..\YSI_Coding\..\YSI_Internal\y_cgen.inc:30
Code:
[17:11:15] [debug] Run time error 4: "Array index out of bounds"
[17:11:15] [debug] AMX backtrace:
[17:11:15] [debug] #0 00082240 in public Hook_OnPlayerConnect (playerid=0) at C:\Users\_oMa37\Desktop\San Andreas Wars\gamemodes\SA-Wars.pwn:1970
[17:11:15] [debug] #1 native CallLocalFunction () from samp-server.exe
[17:11:15] [debug] #2 00078940 in public _y_utils_OnPlayerConnect (playerid=0) at C:\Users\_oMa37\Desktop\San Andreas Wars\pawno\include\antiafk.inc:101
[17:11:15] [debug] #3 000401a0 in public SSCANF_OnPlayerConnect (playerid=0) at C:\Users\_oMa37\Desktop\San Andreas Wars\pawno\include\YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\y_utils.inc:234
[17:11:15] [debug] #4 000322b4 in public ac_OnPlayerConnect (playerid=0) at C:\Users\_oMa37\Desktop\San Andreas Wars\pawno\include\sscanf2.inc:236
[17:11:15] [debug] #5 0000ac7c in public Streamer_OnPlayerConnect (playerid=0) at C:\Users\_oMa37\Desktop\San Andreas Wars\pawno\include\nex-ac.inc:2093
[17:11:15] [debug] #6 00000710 in OnPlayerConnect (playerid=0, ... <1073741822 arguments>) at C:\Users\_oMa37\Desktop\San Andreas Wars\pawno\include\streamer.inc:305
[17:11:15] [debug] #7 00041844 in public OnPlayerConnect (... <1 argument>) at C:\Users\_oMa37\Desktop\San Andreas Wars\pawno\include\YSI\..\YSI_Data\..\YSI_Coding\..\YSI_Internal\y_cgen.inc:30
PHP Code:
public OnPlayerConnect(playerid)
{
new pname[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s has joined the server", pname);
SendClientMessageToAll(0x999999FF, string);
PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/rx3og20szd/SA-Wars.mp3");
SetPVarInt(playerid, "SelectedObject",-1);
SetPVarString(playerid, "SettingTxt", "Click_to_set");
SetPVarString(playerid, "SettingTxd", "Click_to_set");
SetPVarInt(playerid, "SettingIdx", 0);
SetPVarInt(playerid, "SettingModel", 11111);
ObjTextdraw[playerid] = PlayerText:INVALID_TEXT_DRAW;
for(new i = 0; i < sizeof(objinfo[]); i ++) objinfo[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
//Map Icons
SetPlayerMapIcon(playerid, 1, 2516.1040, -1674.6230, 13.9011, 62, 0, MAPICON_LOCAL); // Grove
SetPlayerMapIcon(playerid, 2, 2169.1062, -1674.5245, 15.0859, 59, 0, MAPICON_LOCAL); // Ballas
SetPlayerMapIcon(playerid, 3, -2153.4622, 642.9787, 52.3672, 43, 0, MAPICON_LOCAL); // Triads
SetPlayerMapIcon(playerid, 4, 1552.5533, -1675.5951, 16.1953, 30, 0, MAPICON_LOCAL); // Police
SetPlayerMapIcon(playerid, 5, 1953.0042, -2035.9916, 13.5469, 58, 0, MAPICON_LOCAL); // Aztecas
SetPlayerMapIcon(playerid, 6, -1694.0681, 1323.3431, 7.1745, 61, 0, MAPICON_LOCAL); // Rifa
SetPlayerMapIcon(playerid, 7, 2352.0703, -1165.5958, 27.4588, 60, 0, MAPICON_LOCAL); // Vagos
SetPlayerMapIcon(playerid, 8, 2635.4812, 2345.1184, 10.6719, 52, 0, MAPICON_LOCAL); // Bikers
new playaname[MAX_PLAYER_NAME], query[128];
GetPlayerName(playerid, playaname, sizeof(playaname));
mysql_format(mysql, query, sizeof(query), "SELECT Password, ID FROM playerdata WHERE PlayerName = '%e' LIMIT 1", playaname);
mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid);
for(new i = 0; i <= 100; i++) SCM(playerid, -1, "");
return 1;
}
PHP Code:
public OnPlayerDisconnect(playerid, reason)
{
new query[520];
mysql_format(mysql, query, sizeof(query), "UPDATE playerdata SET Level = '%d', Money = '%d', Kills = '%d', Deaths = '%d', Hours = '%d', Minutes = '%d', Seconds = '%d', Marijuana = '%d', Cocaine = '%d', \
Premium = '%d', xLevel = '%d', XP = '%d', WantedLevel = '%d', Muted = '%d', Jailed = '%d', Hitman = '%d', ColoredText = '%x', ColoredName = '%x', MapHide = '%x', Skin = '%d' WHERE ID = '%d'",
Info[playerid][Level], GetPlayerMoney(playerid), Info[playerid][Kills], Info[playerid][Deaths], Info[playerid][Hours], Info[playerid][Minutes], Info[playerid][Seconds],
Info[playerid][Marijuana], Info[playerid][Cocaine], Info[playerid][Premium], Info[playerid][xLevel], Info[playerid][XP], GetPlayerWantedLevel(playerid), Info[playerid][Muted], Info[playerid][Jailed],
Info[playerid][Hitman], Info[playerid][ColoredText] >>> 8, GetPlayerColor(playerid) >>> 8, Info[playerid][MapHide], GetPlayerSkin(playerid), Info[playerid][ID]);
mysql_tquery(mysql, query);
OnObjectEditMode(playerid,false);
PlayerTextDrawDestroy(playerid, Textdraw2);
PlayerTextDrawDestroy(playerid, Textdraw3);
TextDrawHideForPlayer(playerid, ServerTime);
OnEvent[playerid] = 0;
Headshoot[playerid] = 0;
Info[playerid][InDM] = 0;
Info[playerid][DMZone] = 0;
GotJetpack[playerid] = 0;
Died[playerid] = 0;
KilledBy[playerid] = 0;
MaterialApplied[playerid] = 0;
if(gTeam[playerid])
{
gTeamCount[gTeam[playerid]] --;
UpdateTeamLabel(gTeam[playerid]);
}
if(Info[playerid][SpawnedCars] > 0)
{
for(new i=0; i<Info[playerid][SpawnedCars]; i++)
{
DestroyVehicle(Info[playerid][Cars][i]);
}
Info[playerid][SpawnedCars] = 0;
}
for(new VehicleID; VehicleID < MAX_VEHICLES; VehicleID++)
{
if(VehicleIsLocked[VehicleID] == 1 && VehicleLockedBy[VehicleID] == playerid)
{
VehicleIsLocked[VehicleID] = 0;
VehicleLockedBy[VehicleID] = 0;
}
}
new string[39 + MAX_PLAYER_NAME];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
switch(reason)
{
case 0: format(string, sizeof(string), "%s has left the server [Timeout]", pname);
case 1: format(string, sizeof(string), "%s has left the server", pname);
case 2: format(string, sizeof(string), "%s has left the server [Kicked]", pname);
}
SendClientMessageToAll(0x999999FF, string);
return 1;
}
Thanks in advance.