Hallo Brotfische,
Bei OnPlayerDeath bekomme ich immer Warnings (Wird unten angezeigt)... genau wie in "??" leider weiß ich nicht wo der Fehler liegt.
Warning Codes:
C
[23:41:06] [debug] Run time error 4: "Array index out of bounds"
[23:41:06] [debug] Accessing element at negative index -1
[23:41:06] [debug] AMX backtrace:
[23:41:06] [debug] #0 0007325c in ?? (0, 65535, 54) from script.amx
[23:41:06] [debug] #1 0000f2c0 in public OnPlayerDeath (0, 65535, 54) from script.amx
[23:43:09] [debug] Run time error 4: "Array index out of bounds"
[23:43:09] [debug] Accessing element at negative index -1
[23:43:09] [debug] AMX backtrace:
[23:43:09] [debug] #0 0007325c in ?? (1, 65535, 54) from script.amx
[23:43:09] [debug] #1 0000f2c0 in public OnPlayerDeath (1, 65535, 54) from script.amx
OnPlayerDeath:
C
public OnPlayerDeath(playerid, killerid, reason)
{
new Float:tot_x,Float:tot_y,Float:tot_z;
tot[playerid] = 1;
giveplayermoney(playerid,-GetPlayerScore(playerid)*50);
new namenstring[200];
format(namenstring,sizeof(namenstring),"†\n%s",getPlayerName(playerid));
if(GetPlayerVirtualWorld(playerid)==0)
{
if(GetPlayerInterior(playerid)==0)
{
for(new l = 0; l < MAX_LEICHEN; l++)
{
if(leichenInfo[l][existiert] == 1) continue;
GetPlayerPos(playerid,tot_x,tot_y,tot_z);
leichenInfo[l][l_x] = tot_x;
leichenInfo[l][l_y] = tot_y;
leichenInfo[l][l_z] = tot_z;
leichenInfo[l][pickup] = CreatePickup(1254,1,leichenInfo[l][l_x],leichenInfo[l][l_y],leichenInfo[l][l_z],0);
leichenInfo[l][NamenLabel] = Create3DTextLabel(namenstring,C_Weiß,leichenInfo[l][l_x],leichenInfo[l][l_y],leichenInfo[l][l_z],10.0,0,0);
leichenInfo[l][existiert] = 1;
break;
}
}
}
new Float: KrankenhausDistance[8],Float: tmp_distance = 9999999.0;
KrankenhausDistance[0] = GetPlayerDistanceFromPoint(playerid, 2034.1149,-1414.9154,16.9922);
KrankenhausDistance[1] = GetPlayerDistanceFromPoint(playerid, 1182.1077,-1324.0918,13.5815);
KrankenhausDistance[2] = GetPlayerDistanceFromPoint(playerid, 1244.3423,331.9934,19.5547);
KrankenhausDistance[3] = GetPlayerDistanceFromPoint(playerid, 1607.6090,1821.0934,10.8280);
KrankenhausDistance[4] = GetPlayerDistanceFromPoint(playerid, -317.0090,1056.6217,19.7422);
KrankenhausDistance[5] = GetPlayerDistanceFromPoint(playerid, -1514.7358,2527.0601,55.7455);
KrankenhausDistance[6] = GetPlayerDistanceFromPoint(playerid, -2661.2441,633.7098,14.4531);
KrankenhausDistance[7] = GetPlayerDistanceFromPoint(playerid, -2198.7803,-2306.5793,30.6250);
for (new i; i != sizeof (KrankenhausDistance); ++i)
{
if (KrankenhausDistance[i] < tmp_distance)
{
tmp_distance = KrankenhausDistance[i];
SetPVarInt(playerid, "i", i);
}
}
new string1[40],string2[30];
new gangzone = IsPlayerInGangZone(playerid);
if(gwInfo[gangzone][running] == 1) {
if(sInfo[playerid][fraktion] == gwInfo[gangzone][angreifer] && sInfo[killerid][fraktion] == gwInfo[gangzone][besitzer]) {
gwInfo[gangzone][punkteVerteidiger]++;
SendClientMessageToAllEx(-1,"gwInfo[gangzone][punkteVerteidiger]= %d",gwInfo[gangzone][punkteVerteidiger]);
SendClientMessageToAll(-1,"Punkte wurden angezeigt....");
format(string1,sizeof(string1),"%d",gwInfo[gangzone][punkteVerteidiger]);
for(new i; i < MAX_PLAYERS; i++)
{
if(sInfo[i][fraktion] == gwInfo[gangzone][angreifer] && sInfo[i][fraktion] == gwInfo[gangzone][besitzer])
{
PlayerTextDrawSetString(i,GangTD[i][PunkteFraktion1],string1);
}
}
}
else if(sInfo[playerid][fraktion] == gwInfo[gangzone][besitzer] && sInfo[killerid][fraktion] == gwInfo[gangzone][angreifer]) {
gwInfo[gangzone][punkteAngreifer]++;
SendClientMessageToAllEx(-1,"gwInfo[gangzone][punkteAngreifer]= %d",gwInfo[gangzone][punkteAngreifer]);
SendClientMessageToAll(-1,"Punkte wurden angezeigt....");
format(string2,sizeof(string2),"%d",gwInfo[gangzone][punkteAngreifer]);
for(new i; i < MAX_PLAYERS; i++)
{
if(sInfo[i][fraktion] == gwInfo[gangzone][besitzer] || sInfo[i][fraktion] == gwInfo[gangzone][angreifer])
{
PlayerTextDrawSetString(i,GangTD[i][PunkteFraktion2],string2);
}
}
}
return 1;
}
return 1;
}
Alles anzeigen
Ich hoffe es kann mir jemand helfen
MfG