Runtime Error -
DetoNater - 29.10.2016
What does this error mean? i use YSI timers by the way in Perplayertimer... and where could textdrawsetstring bring an error?? immediate help needed...
Код:
[28/10/2016 12:10:59] [connection] 89.164.121.40:55179 requests connection cookie.
[28/10/2016 12:11:06] [debug] Server crashed while executing bfsamp.amx
[28/10/2016 12:11:06] [debug] AMX backtrace:
[28/10/2016 12:11:06] [debug] Run time error 4: "Array index out of bounds"
[28/10/2016 12:11:06] [debug] #0 native TextDrawSetString () from samp03svr
[28/10/2016 12:11:06] [debug] Accessing element at index 19059536 past array upper bound 99
[28/10/2016 12:11:06] [debug] #1 0011a8d0 in ?? (19059536) from bfsamp.amx
[28/10/2016 12:11:06] [debug] #2 00114dec in public PerPlayerTimer () from bfsamp.amx
[28/10/2016 12:11:06] [debug] AMX backtrace:
[28/10/2016 12:11:06] [debug] #0 00103da8 in ?? (19059536) from bfsamp.amx
[28/10/2016 12:11:06] [debug] #1 00114dec in public PerPlayerTimer () from bfsamp.amx
[28/10/2016 12:11:06] [debug] Native backtrace:
[28/10/2016 12:11:06] [debug] #0 f740ee8b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[28/10/2016 12:11:06] [debug] #1 f7407bcf in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[28/10/2016 12:11:06] [debug] #2 f7408dbc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[28/10/2016 12:11:06] [debug] #3 f7409226 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[28/10/2016 12:11:06] [debug] #4 f740eadc in ?? () from plugins/crashdetect.so
[28/10/2016 12:11:06] [debug] #5 f7761410 in ?? ()
[28/10/2016 12:11:06] [debug] #6 f7761430 in ?? ()
[28/10/2016 12:11:06] [debug] #7 f7461667 in gsignal () from /lib/libc.so.6
[28/10/2016 12:11:06] [debug] #8 f7462ea3 in abort () from /lib/libc.so.6
[28/10/2016 12:11:06] [debug] #9 f769a79d in _ZN9__gnu_cxx27__verbose_terminate_handlerEv () from /lib/libstdc++.so.6
[28/10/2016 12:11:06] [debug] #10 f7698263 in ?? () from /lib/libstdc++.so.6
[28/10/2016 12:11:06] [debug] #11 f769829f in ?? () from /lib/libstdc++.so.6
[28/10/2016 12:11:06] [debug] #12 f7698508 in ?? () from /lib/libstdc++.so.6
[28/10/2016 12:11:06] [debug] #13 f7698b86 in _Znwj () from /lib/libstdc++.so.6
[28/10/2016 12:11:06] [debug] #14 f7698c3b in _Znaj () from /lib/libstdc++.so.6
[28/10/2016 12:11:06] [debug] #15 0805ff5f in ?? () from ./samp03svr
[28/10/2016 12:11:06] [debug] #16 0807db7c in ?? () from ./samp03svr
[28/10/2016 12:11:06] [debug] #17 080705bf in ?? () from ./samp03svr
[28/10/2016 12:11:06] [debug] #18 08074928 in ?? () from ./samp03svr
[28/10/2016 12:11:06] [debug] #19 080763fe in ?? () from ./samp03svr
[28/10/2016 12:11:06] [debug] #20 f7740b2c in ?? () from /lib/libpthread.so.0
[28/10/2016 12:11:06] [debug] #21 f752a77e in clone () from /lib/libc.so.6
Re: Runtime Error -
Threshold - 29.10.2016
Well, can you show us the code?
Re: Runtime Error -
Logic_ - 29.10.2016
Again this shitty gamemode is here.
Re: Runtime Error -
DetoNater - 29.10.2016
Код:
task PerPlayerTimer[1000]()
{
foreach(Player,i)
{
Anzeige2(i);
LevelUpdate(i);
Onlinegettime(i);
AntiCheat(i);
//Dschihad Armour check
if(UniqueClass[i] == 3)
{
new Float:Armour;
GetPlayerArmour(i,Armour);
if(GetPVarInt(i, "InClanWar") == 0 && duelJoined[i] == 0 && GetPVarInt(i,"join") != 2)
{
if(Armour > 1)
{
SetPlayerArmour(i,0);
}
}
}
if(IsPlayerInAnyVehicle(i)) ClassVehicleCheck(i);
//Goggles Take
if(GetPlayerWeapon(i) == 44 || GetPlayerWeapon(i) == 45)
{
SetPlayerHealth(i,0);
}
new Float:x,Float:y,Float:z;
GetPlayerPos(i,x,y,z);
SetPVarFloat(i, "x", x);
SetPVarFloat(i, "y", y);
SetPVarFloat(i, "z", z);
SpecPosInCw(i);
if(Mute[i] == gettime() && Mute[i] != 99999) TempUnmute(i);
BuggedCheck(i);
}
}
Re: Runtime Error -
Threshold - 29.10.2016
Which of the functions in that timer uses 'TextDrawSetString'? (and please show us that)
Re: Runtime Error -
DetoNater - 29.10.2016
only this function has textdraws
Код:
Anzeige2(playerid)
{
new string[255];
if(specing[playerid] == 1)
{
new Float:hp, Float:ar;
GetPlayerHealth(gSpectateID[playerid], hp);
GetPlayerArmour(gSpectateID[playerid], ar);
if(DonateLevel[gSpectateID[playerid]] < 7)
{
if(GetVehicleModel(GetPlayerVehicleID(gSpectateID[playerid])) == 520 || GetVehicleModel(GetPlayerVehicleID(gSpectateID[playerid])) == 425
|| GetVehicleModel(GetPlayerVehicleID(gSpectateID[playerid])) == 447)
{
new Float:VHealth;
GetVehicleHealth(GetPlayerVehicleID(gSpectateID[playerid]),VHealth);
format(string,sizeof(string),"~y~%s ~w~~h~~h~- ID:%d~n~~r~~h~HP: ~w~~h~~h~%0.1f ~b~~h~AR: ~w~~h~~h~%0.1f ~g~$%d~n~~w~~h~~h~VH: %.1f FUEL: %d", PlayerName(gSpectateID[playerid]),gSpectateID[playerid],hp,ar,GetPlayerMoney(gSpectateID[playerid]),VHealth, Gas[GetPlayerVehicleID(gSpectateID[playerid])]);
}
else
{
new Float:VHealth;
GetVehicleHealth(GetPlayerVehicleID(gSpectateID[playerid]),VHealth);
format(string,sizeof(string),"~y~%s ~w~~h~~h~- ID:%d~n~~r~~h~HP: ~w~~h~~h~%0.1f ~b~~h~AR: ~w~~h~~h~%0.1f ~g~$%d~n~~w~~h~~h~VH: %.1f", PlayerName(gSpectateID[playerid]),gSpectateID[playerid],hp,ar,GetPlayerMoney(gSpectateID[playerid]),VHealth);
}
}
else
{
new Float:VHealth;
if(IsPlayerInAnyVehicle(gSpectateID[playerid])) GetVehicleHealth(GetPlayerVehicleID(gSpectateID[playerid]),VHealth);
if(IsPlayerInAnyVehicle(gSpectateID[playerid])) format(string,sizeof(string),"~y~%s ~w~~h~~h~- ID:%d~n~~r~~h~HP: ~w~~h~~h~%0.1f ~b~~h~AR: ~w~~h~~h~%0.1f ~g~$%d~n~~w~~h~~h~VH: %.1f", PlayerName(gSpectateID[playerid]),gSpectateID[playerid],hp,ar,GetPlayerMoney(gSpectateID[playerid]),VHealth);
if(!IsPlayerInAnyVehicle(gSpectateID[playerid])) format(string,sizeof(string),"~y~%s ~w~~h~~h~- ID:%d~n~~r~~h~HP: ~w~~h~~h~%0.1f ~b~~h~AR: ~w~~h~~h~%0.1f ~g~$%d", PlayerName(gSpectateID[playerid]),gSpectateID[playerid],hp,ar,GetPlayerMoney(gSpectateID[playerid]));
}
TextDrawSetString(spectextdraw[playerid],string);
TextDrawShowForPlayer(playerid,spectextdraw[playerid]);
}
//fps checker
if(Spawned[playerid] == 1)
{
format(string,sizeof(string),"%d",pFPS[playerid]);
TextDrawSetString(FPS[playerid],string);
TextDrawShowForPlayer(playerid,FPS[playerid]);
}
else TextDrawHideForPlayer(playerid,FPS[playerid]);
}
Re: Runtime Error -
Threshold - 29.10.2016
I can't see anything that stands out in particular, but this could simply be a value error with crashdetect. I have seen abnormal out of bounds errors that showed values of unusual proportions before. This could be a simple invalid player ID being used as an index in one of your variables. Likely that gSpectateID[playerid] is INVALID_PLAYER_ID (65535) and the plugin is showing random numbers like '19059536' instead.
I've made a few alterations to your code nonetheless. Try this and see if the problem persists:
PHP код:
Anzeige2(playerid)
{
//fps checker
if(Spawned[playerid] == 1)
{
new string[4];
format(string, sizeof(string), "%d", pFPS[playerid]);
TextDrawSetString(FPS[playerid], string);
TextDrawShowForPlayer(playerid, FPS[playerid]);
}
else TextDrawHideForPlayer(playerid, FPS[playerid]);
if(specing[playerid] == 1)
{
if(!IsPlayerConnected(gSpectateID[playerid])) return 1;
new Float:hp, Float:ar, vid = GetPlayerVehicleID(gSpectateID[playerid]), string[145];
GetPlayerHealth(gSpectateID[playerid], hp);
GetPlayerArmour(gSpectateID[playerid], ar);
format(string, sizeof(string), "~y~%s ~w~~h~~h~- ID:%d~n~~r~~h~HP: ~w~~h~~h~%0.1f ~b~~h~AR: ~w~~h~~h~%0.1f ~g~$%d", PlayerName(gSpectateID[playerid]), gSpectateID[playerid], hp, ar, GetPlayerMoney(gSpectateID[playerid]));
if(vid)
{
new Float:vHealth;
GetVehicleHealth(vid, vHealth);
format(string, sizeof(string), "%s~n~~w~~h~~h~VH: %.1f", string, vHealth);
if(DonateLevel[gSpectateID[playerid]] < 7)
{
switch(GetVehicleModel(vid))
{
case 425, 447, 520:
format(string, sizeof(string), "%s FUEL: %d", string, Gas[vid]);
}
}
}
TextDrawSetString(spectextdraw[playerid], string);
TextDrawShowForPlayer(playerid, spectextdraw[playerid]);
}
return 1;
}
Sorry if this doesn't compile correctly. I did this on my phone and it's hard to see the indentation or spot typos, but I've proofread most of it and it looks okay at first glance. Basically you should always check that the variable is a valid value before using it as an index in an array. I accomplished this by using "if(!IsPlayerConnected(gSpectateID[playerid]))", simply because I don't know what default value you are assigning to this variable. Also made a few efficiency adjustments to help the code run more smoothly.