18.05.2017, 14:27

[debug] Run time error 4: "Array index out of bounds" [debug] Attempted to read/write array element at index 3 in array of size 3 [debug] AMX backtrace: [debug] #0 00062ee8 in public ELC_AC_OnPlayerStateChange (0, 2, 1) from PRP.amx [debug] #1 native CallLocalFunction () from samp-server.exe [debug] #2 00019528 in public OnPlayerStateChange (0, 2, 1) from PRP.amx [debug] Run time error 4: "Array index out of bounds" [debug] Attempted to read/write array element at index 3 in array of size 3 [debug] AMX backtrace: [debug] #0 00062ee8 in public ELC_AC_OnPlayerStateChange (0, 2, 1) from PRP.amx [debug] #1 native CallLocalFunction () from samp-server.exe [debug] #2 00019528 in public OnPlayerStateChange (0, 2, 1) from PRP.amx |
[debug] Run time error 4: "Array index out of bounds" [debug] Attempted to read/write array element at index 3 in array of size 3 [debug] AMX backtrace: [debug] #0 0007d710 in public ELC_AC_OnPlayerStateChange (playerid=0, newstate=2, oldstate=1) at C:\Users\Saint\Desktop\PRP\gamemodes\PRP.pwn:4775 [debug] #1 native CallLocalFunction () from samp-server.exe [debug] #2 0001fa24 in public OnPlayerStateChange (playerid=0, newstate=2, oldstate=1) at C:\Users\Saint\Desktop\PRP\pawno\include\ELC_AC_BA SE.inc:1079 |
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)// If the player's state changes to a vehicle state we'll have to spec the vehicle.
{
if(IsBeingSpeced[playerid] == 1)//If the player being spectated, enters a vehicle, then let the spectator spectate the vehicle.
{
foreach(Player,i)
{
if(spectatorid[i] == playerid)
{
PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));// Letting the spectator, spectate the vehicle of the player being spectated (I hope you understand this xD)
}
}
}
}
if(newstate == PLAYER_STATE_ONFOOT)
{
if(IsBeingSpeced[playerid] == 1)//If the player being spectated, exists a vehicle, then let the spectator spectate the player.
{
foreach(Player,i)
{
if(spectatorid[i] == playerid)
{
PlayerSpectatePlayer(i, playerid);// Letting the spectator, spectate the player who exited the vehicle.
}
}
}
}
if(IsPlayerInAnyVehicle(playerid) && !IsBicycle(GetPlayerVehicleID(playerid)))
{
//TextDrawShowForPlayer(playerid, SpeedoBox);
TextDrawShowForPlayer(playerid, SpeedoText[playerid]);
if(VehicleSecurity[vehicleid] == 1)
{
ToggleAlarm(vehicleid, VEHICLE_PARAMS_ON);
SetTimerEx("StopAlarm", ALARM_TIME, false, "d", vehicleid);
}
}
else
{
//TextDrawHideForPlayer(playerid, SpeedoBox);
TextDrawHideForPlayer(playerid, SpeedoText[playerid]);
}
if(newstate == PLAYER_STATE_PASSENGER)
{
if(GetPlayerWeapon(playerid) == 24 || GetPlayerWeapon(playerid) == 23 || GetPlayerWeapon(playerid) == 26 || GetPlayerWeapon(playerid) == 34)
{
SetPlayerArmedWeapon(playerid, 0);
}
}
if(newstate == PLAYER_STATE_DRIVER)
{
SetPlayerArmedWeapon(playerid, 0);
}
if(newstate == PLAYER_STATE_DRIVER)
{
new id = GetVehicleID(vehicleid);
if(IsValidVehicle(id))
{
if(VehicleCreated[id] == VEHICLE_DEALERSHIP)
{
SetPVarInt(playerid, "DialogValue1", id);
ShowDialog(playerid, DIALOG_VEHICLE_BUY);
return 1;
}
}
if(IsBicycle(vehicleid))
{
ToggleEngine(vehicleid, VEHICLE_PARAMS_ON);
}
if(Fuel[vehicleid] <= 0)
{
ToggleEngine(vehicleid, VEHICLE_PARAMS_OFF);
}
}
if(newstate == PLAYER_STATE_DRIVER)
{
for(new i=0; i<4; i++)
{
if(IsPlayerInVehicle(playerid, DMVcar[i]))
{
if(PlayerInfo[playerid][pDriverLicense] == 0)
{
if(TakingDriverLicense[playerid] == true)
{
if(DMVcp[playerid] == 0)
{
SetPlayerCheckpoint(playerid, 2045.7646,-1930.0442,13.0410, 3.0);
DMVcp[playerid] = 1;
SCM(playerid, COLOR_WHITE, "* Drive through all of the checkpoints slowly to pass the test. Check your mini-map if you can't see the checkpoints.");
SCM(playerid, COLOR_WHITE, "* If you leave the vehicle it will respawn.");
}
else
{
LeftDMVCar[playerid] = 0;
}
}
else
{
RemovePlayerFromVehicle(playerid);
SCM(playerid, COLOR_LIGHTRED, "You are not taking a driver-license test.");
}
}
else
{
RemovePlayerFromVehicle(playerid);
SCM(playerid, COLOR_LIGHTRED, "You already have a drivers license.");
}
}
}
}
if(newstate == PLAYER_STATE_DRIVER)
{
for(new i=0; i<6; i++)
{
if(IsPlayerInVehicle(playerid, JunkCar[i]))
{
if(WorkingJunk[playerid] == true)
{
SetPlayerCheckpoint(playerid, -1843.1804,-1647.9569,21.4182, 3.0);
JunkCP[playerid] = 1;
SCM(playerid, COLOR_WHITE, "Drive through all of the checkpoints to complete your shift.");
SCM(playerid, COLOR_WHITE, "If you leave the vehicle the job will restart and the vehicle will respawn.");
SCM(playerid, COLOR_WHITE, "Try not to damage the vehicle.");
}
else
{
RemovePlayerFromVehicle(playerid);
SCM(playerid, COLOR_LIGHTRED, "You are not working.");
}
}
if(IsPlayerInVehicle(playerid, TrashCar[i]))
{
if(WorkingTrash[playerid] == true)
{
SetPlayerCheckpoint(playerid, 2319.2988,-1934.7290,14.0085, 3.0);
TrashCP[playerid] = 1;
SCM(playerid, COLOR_WHITE, "Drive through all of the checkpoints to complete your shift.");
SCM(playerid, COLOR_WHITE, "If you leave the vehicle the job will restart and the vehicle will respawn.");
SCM(playerid, COLOR_WHITE, "Try not to damage the vehicle.");
}
else
{
RemovePlayerFromVehicle(playerid);
SCM(playerid, COLOR_LIGHTRED, "You are not working.");
}
}
if(IsPlayerInVehicle(playerid, PizzaBike[i]))
{
if(WorkingPizza[playerid] == true)
{
new rand = random(sizeof(PizzaCP));
SetPlayerCheckpoint(playerid,PizzaCP[rand][0],PizzaCP[rand][1],PizzaCP[rand][2],PizzaCP[rand][3]);
EndPizzaCP[playerid] = 1;
SCM(playerid, COLOR_WHITE, "Begin delivering pizzas to complete your shift.");
SCM(playerid, COLOR_WHITE, "If you leave the bike the job will restart and the bike will respawn.");
SCM(playerid, COLOR_WHITE, "Try not to damage the bike.");
}
else
{
RemovePlayerFromVehicle(playerid);
SCM(playerid, COLOR_LIGHTRED, "You are not working.");
}
}
}
}
if(newstate == PLAYER_STATE_DRIVER)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 487 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 488 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 497 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 513 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 512 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 511 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 519 ||
GetVehicleModel(GetPlayerVehicleID(playerid)) == 520 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 548 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 553 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 563 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 577 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 592 ||
GetVehicleModel(GetPlayerVehicleID(playerid)) == 593 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 417 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 425 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 476 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 469)
{
GivePlayerWeapon(playerid, 46, 1);
GivePlayerWeapon(playerid, 46, 0);
}
}
if(newstate == PLAYER_STATE_DRIVER)
{
for(new i=0; i<MAX_LUMBERCARS; i++)
{
if(IsPlayerInVehicle(playerid, LumberCar[i]))
{
if(WorkingLumber[playerid] == true)
{
if(LumberCP[playerid] == 0)
{
SetPlayerCheckpoint(playerid, -2219.23193, -2165.13379, 41.66151, 1.0);
LumberCP[playerid] = 1;
SCM(playerid, COLOR_WHITE, "Drive to the checkpoint.");
}
}
else
{
RemovePlayerFromVehicle(playerid);
SCM(playerid, COLOR_LIGHTRED, "You are not working.");
}
}
}
}
if(newstate == PLAYER_STATE_DRIVER)
{
for(new i=0; i<MAX_COPCARS; i++)
{
if(IsPlayerInVehicle(playerid, PoliceCar[i]))
{
if(PlayerInfo[playerid][pFaction] != 2)
{
RemovePlayerFromVehicle(playerid);
}
}
}
}
if(newstate == PLAYER_STATE_DRIVER)
{
for(new i=0; i<MAX_GOVCARS; i++)
{
if(IsPlayerInVehicle(playerid, GovCar[i]))
{
if(PlayerInfo[playerid][pFaction] != 1)
{
RemovePlayerFromVehicle(playerid);
}
}
}
}
if(newstate == PLAYER_STATE_DRIVER)// If the player's state changes to a vehicle state we'll have to spec the vehicle.
{
if(PlayerInfo[playerid][pDriverLicense] == 0)
{
if(!IsBicycle(vehicleid))
{
SCM(playerid, COLOR_LIGHTRED, "You do not have a driving license yet. Pass a driving test to obtain one.");
return 1;
}
}
}
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)// If the player's state changes to a vehicle state we'll have to spec the vehicle.
{
if(IsBeingSpeced[playerid] == 1)//If the player being spectated, enters a vehicle, then let the spectator spectate the vehicle.
{
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
{
if(spectatorid[i] == playerid)
{
PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));// Letting the spectator, spectate the vehicle of the player being spectated (I hope you understand this xD)
}
}
}
}
if(newstate == PLAYER_STATE_ONFOOT)
{
if(IsBeingSpeced[playerid] == 1)//If the player being spectated, exists a vehicle, then let the spectator spectate the player.
{
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
{
if(spectatorid[i] == playerid)
{
PlayerSpectatePlayer(i, playerid);// Letting the spectator, spectate the player who exited the vehicle.
}
}
}
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(CheatPlayerInfo[playerid][elc_AntiVehicleTelportHack]>=1&&CheatPlayerInfo[playerid][elc_PlayerEnterVeh]!=GetPlayerVehicleID(playerid))
{
CheatPlayerInfo[playerid][elc_PlayerEnterTime] = GetTickCount();
new elc_vehicleid=GetPlayerVehicleID(playerid);
if(elc_vehicleid!=0)
{
CheatPlayerInfo[playerid][elc_PlayerEnterVeh]=elc_vehicleid;
CheatVehicleInfo[elc_vehicleid][elc_vStatut]=1;
}
}
}
else if(oldstate == PLAYER_STATE_DRIVER)
{//220 def
if(CheatPlayerInfo[playerid][elc_PlayerEnterTime]!=0&&(GetTickCount()-CheatPlayerInfo[playerid][elc_PlayerEnterTime]) < 220)//player entered and exited vehicle faster than 220 ms.
{
//if(CheatPlayerInfo[playerid][elc_PlayerEnterVeh]!=0)SetVehiclePos(CheatPlayerInfo[playerid][elc_PlayerEnterVeh], CheatVehicleInfo[CheatPlayerInfo[playerid][elc_PlayerEnterVeh]][elc_vX], CheatVehicleInfo[CheatPlayerInfo[playerid][elc_PlayerEnterVeh]][elc_vY], CheatVehicleInfo[CheatPlayerInfo[playerid][elc_PlayerEnterVeh]][elc_vZ]);
ELC_SendCheatWarning(playerid,9);
}
CheatPlayerInfo[playerid][elc_PlayerEnterTime]=0;
}
#if defined INCLUDE_BASE_MODE
return CallLocalFunction("ELC_AC_OnPlayerStateChange", "ddd",playerid, newstate, oldstate);
#else
return 1;
#endif
}