Wysłany: 2013-06-16, 16:56
Adrian1910
Wiek: 31 Na forum: 5821 dni Posty: 13
Nick w MP: Cannabis
Piwa : 5060
Kod: [18:45] [debug] Run time error 4: "Array index out of bounds"
[18:45] [debug] Accessing element at index 65535 past array upper bound 1499
[18:45] [debug] AMX backtrace:
[18:45] [debug] #0 00165a18 in public OnPlayerKeyStateChange (0x00000000, 0x00000010, 0x00000000) from gamemode.amx
Czy b??d tkwi w OnPlayerKeyStateChange ? czy gdzie? indziej ? A jak tak to gdzie i co mo?e by? b??dem ?
Wysłany: 2013-06-16, 19:41
B!4CK
Never give UP!
Wiek: 32 Na forum: 5809 dni Posty: 1047
Nick w MP: John
Piwa : 1891
Adrian1910 , poka? OnPlayerKeyStateChange
Podpis
Cześć
[you]
!
Projekt, który poruszy scenę platformy SA:MP!
Wysłany: 2013-06-16, 23:02
Adrian1910
Wiek: 31 Na forum: 5821 dni Posty: 13
Nick w MP: Cannabis
Piwa : 5060
Kod: public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new nazwa[32];
new playerState = GetPlayerState(playerid); // Get the killer's state
new vehiclesid = GetPlayerVehicleID(playerid);
if(vehiclesid != INVALID_VEHICLE_ID)
{
if(IsPlayerInAnyVehicle(playerid) && playerState == PLAYER_STATE_DRIVER)
{
if(GetPVarInt(playerid, "Tempomat_Enabled") == 1)
{
#if ENABLING == 2 || ENABLING == 3
if(newkeys & KEY_SUBMISSION)
return DisableCruiseControl(playerid);
#endif
if(newkeys & 8 || newkeys & 32 || newkeys & 128)
return DisableCruiseControl(playerid);
}
#if ENABLING == 2 || ENABLING == 3
else
{
if(newkeys & KEY_SUBMISSION)
return EnableCruiseControl(playerid);
}
#endif
}
if(IsPlayerInAnyVehicle(playerid) && playerState == PLAYER_STATE_DRIVER)
{
new iStatus = GetPVarInt(playerid, "IndicatorStatus"); // Getting the player variable and storing it into a local one.
new vehid = GetPlayerVehicleID(playerid); // Getting the players vehicle id and storing it into a local variable.
new model = GetVehicleModel(vehid); // Getting the vehicle model and storing it into the model variable.
new arraynum = CarModelToArray(model); // Getting the array number of the vehicle.
if(!isACar(model))
{
return 1;
}
if(newkeys & KEY_LOOK_LEFT)
{
if(iStatus == INDICATORS_OFF)
{
// Turn indicators left...
SetPVarInt(playerid, "IndicatorStatus", 1); // Setting the variable of indicators left.
gIndicator1[playerid][vehid] = CreateObject(19294,0,0,-1000,0,0,0,100); // Creating the object and assigning it.
gIndicator2[playerid][vehid] = CreateObject(19294,0,0,-1000,0,0,0,100); // Creating the object and assigning it.
AttachObjectToVehicle(gIndicator1[playerid][vehid], GetPlayerVehicleID(playerid), IndiPos[arraynum][0], IndiPos[arraynum][1], IndiPos[arraynum][2], 0.0, 0.0, 0.0); // Attaching it
AttachObjectToVehicle(gIndicator2[playerid][vehid], GetPlayerVehicleID(playerid), IndiPos[arraynum][3], IndiPos[arraynum][4], IndiPos[arraynum][5], 0.0, 0.0, 0.0); // Attaching it
}
else if(iStatus == INDICATORS_LEFT)
{
// Turn indicators off...
SetPVarInt(playerid, "IndicatorStatus", 0);
DestroyObject(gIndicator1[playerid][vehid]);
DestroyObject(gIndicator2[playerid][vehid]);
}
}
else if(newkeys & KEY_LOOK_RIGHT)
{
if(iStatus == INDICATORS_OFF)
{
// Turn indicators right...
SetPVarInt(playerid, "IndicatorStatus", 2);
gIndicator1[playerid][vehid] = CreateObject(19294,0,0,-1000,0,0,0,100);
gIndicator2[playerid][vehid] = CreateObject(19294,0,0,-1000,0,0,0,100);
AttachObjectToVehicle(gIndicator1[playerid][vehid], GetPlayerVehicleID(playerid), IndiPos[arraynum][6], IndiPos[arraynum][7], IndiPos[arraynum][8], 0.0, 0.0, 0.0);
AttachObjectToVehicle(gIndicator2[playerid][vehid], GetPlayerVehicleID(playerid), IndiPos[arraynum][9], IndiPos[arraynum][10], IndiPos[arraynum][11], 0.0, 0.0, 0.0);
}
else if(iStatus == INDICATORS_RIGHT)
{
// Turn indicators off...
SetPVarInt(playerid, "IndicatorStatus", 0); // Setting the variable to 0.
DestroyObject(gIndicator1[playerid][vehid]); // Destroying the object
DestroyObject(gIndicator2[playerid][vehid]); // Destroying the object
}
}
}
}
if(PlayerInfo[playerid][BW] != 0)
{
TogglePlayerControllable(playerid, true);
KillTimer(graczom[playerid]);
format(graczommm, sizeof(graczommm), "~r~~h~Brutally Wounded~n~~w~Aktualnie jestes w stanie nieprzytomnosci i nie mozesz tego zrobic!");
PlayerTextDrawShow(playerid, Graczom[playerid]);
PlayerTextDrawSetString(playerid, Graczom[playerid], graczommm);
graczom[playerid] = SetTimerEx("graczomm", 5000, false, "d", playerid);
ApplyAnimation(playerid, "PED", "FLOOR_hit", 4.1, 0, 1, 1, 1, 1);
return 1;
}
if(vehiclesid != INVALID_VEHICLE_ID)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(newkeys & KEY_JUMP)
{
if(PlayerInfo[playerid][RaceCreated] != 0)
{
new Float: x, Float: y, Float: z, str[64];
GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
PlayerInfo[playerid][RaceCreatedCP]++;
PlayerInfo[playerid][RaceCreated] = AddRace(x, y, z, PlayerInfo[playerid][RaceCreated], 0, PlayerInfo[playerid][UID], PlayerInfo[playerid][RaceCreatedName]);
format(str, sizeof(str), "~r~CheckPoint ~w~%d/40", PlayerInfo[playerid][RaceCreatedCP]);
GameTextForPlayer(playerid, str, 60000, 4);
}
}
}
}
if(TreningRunA[playerid] == 1 || TreningRun[playerid] == 1 || TreningRunS[playerid] == 1 || TreningRunPro[playerid] == 1)
{
if(newkeys & KEY_JUMP)
{
TogglePlayerControllable(playerid, true);
KillTimer(graczom[playerid]);
format(graczommm, sizeof(graczommm), "~r~~h~Wysilek fizyczny~n~~y~Nie mozesz oszukiwac podczas trenowania umiejetnosci fizycznych!");
PlayerTextDrawShow(playerid, Graczom[playerid]);
PlayerTextDrawSetString(playerid, Graczom[playerid], graczommm);
graczom[playerid] = SetTimerEx("graczomm", 5000, false, "d", playerid);
}
}
if(!IsPlayerInAnyVehicle(playerid) && IsAWeapon(playerid))
{
if (PRESSED( KEY_HANDBRAKE ))
{
if(PlayerInfo[playerid][Strzelanie] >= 0) SetPlayerDrunkLevel(playerid, 4999);
if(PlayerInfo[playerid][Strzelanie] >= 40) SetPlayerDrunkLevel(playerid, 4000);
if(PlayerInfo[playerid][Strzelanie] >= 50) SetPlayerDrunkLevel(playerid, 3500);
if(PlayerInfo[playerid][Strzelanie] >= 80) SetPlayerDrunkLevel(playerid, 3000);
if(PlayerInfo[playerid][Strzelanie] >= 90) SetPlayerDrunkLevel(playerid, 2500);
if(PlayerInfo[playerid][Strzelanie] == 100) SetPlayerDrunkLevel(playerid, 0);
cel[playerid] = 1;
}
else if (RELEASED( KEY_HANDBRAKE ))
{
SetPlayerDrunkLevel(playerid, 0);
cel[playerid] = 0;
}
}
if(vehiclesid != INVALID_VEHICLE_ID)
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(PRESSED(KEY_SPRINT))
{
if(PlayerInfo[playerid][Prowadzenie] >= 100)
{
return 1;
}
if(przycisk[playerid] == 1)
{
return 1;
}
timer[playerid] = 0;
przycisk[playerid] = 1;
//Dodawanie czasowo skil?w broni
}
else if(RELEASED(KEY_SPRINT))
{
if(PlayerInfo[playerid][Prowadzenie] >= 100)
{
return 1;
}
if(timer[playerid] == 1)
{
return 1;
}
timer[playerid] = 1;
SetTimerEx("prowadzenie", 9000, 0, "d", playerid);
}
}
}
if(PRESSED(KEY_HANDBRAKE + KEY_FIRE))
{
if(IsAWeapon(playerid))
{
if(PlayerInfo[playerid][Strzelanie] >= 100)
{
return 1;
}
//Dodawanie czasowo skil?w broni
if(przycisk[playerid] == 1)
{
return 1;
}
przycisk[playerid] = 1;
SetTimerEx("strzelanie", 9000, 0, "i", playerid);
}
}
if(HOLDING(KEY_JUMP))
{
if(przycisk[playerid] == 1)
{
return 1;
}
if(cwicz[playerid] == 5)
{
timer[playerid] = 0;
przycisk[playerid] = 1;
ApplyAnimation(playerid, "Freeweights", "gym_free_up_smooth", 4.5, 0, 1, 1, 1, 1, 1);
}
}
else if(RELEASED(KEY_JUMP))
{
if(PlayerInfo[playerid][Sila] >= 100)
{
return 1;
}
if(timer[playerid] == 1)
{
return 1;
}
if(cwicz[playerid] == 5)
{
timer[playerid] = 1;
SetTimerEx("hantla", 1000, 0, "i", playerid);
}
}
if(HOLDING(KEY_JUMP))
{
if(przycisk[playerid] == 1)
{
return 1;
}
if(cwicz[playerid] == 1)
{
timer[playerid] = 0;
przycisk[playerid] = 1;
ApplyAnimation(playerid, "GYMNASIUM", "gym_tread_walk", 4.1,0,1,1,1,1,1);
}
}
else if(RELEASED(KEY_JUMP))
{
if(timer[playerid] == 1)
{
return 1;
}
if(PlayerInfo[playerid][Sila] >= 100)
{
return 1;
}
if(cwicz[playerid] == 1)
{
timer[playerid] = 1;
SetTimerEx("bieznia", 200, 0, "i", playerid);
}
}
}
Tagi: crashdetect
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: