Hier ist der Befehl:
Jeffry
COMMAND:startwar(playerid,params[])
{
#pragma unused params
new string[128],GegnerOnline = 0,TempZone = GetPlayerFightzone(playerid);
if(ImTutorial[playerid] != 0)return SendClientMessage(playerid,GRAU,"Du kannst keine Befehle nutzen,da du im Tutorial bist.");
if(GetPVarInt(playerid,"Eingeloggt") == 0)return SendClientMessage(playerid,GRAU,"Du bist nicht eingeloggt!");
if(Spieler[playerid][pAWAYFROMKEYBOARD] == 1)return SendClientMessage(playerid,WRONGCMD,"Du bist im AFK-Modus und kannst somit keine Befehle nutzen."),SendClientMessage(playerid,WRONGCMD,"BENUTZE: /back");
if(Spieler[playerid][pInPrison] == 1)return SendClientMessage(playerid,GRAU,"Du bist im Prison.");
if(Spieler[playerid][pFriedhof] == 1)return SendClientMessage(playerid,GRAU,"Du bist Tot.");
if(Spieler[playerid][pDeath] == 1)return SendClientMessage(playerid,GRAU,"Du bist verletzt.");
if(Spieler[playerid][pJailed] != 0)return SendClientMessage(playerid,GRAU,"Du bist im Gefängnis.");
if(Spieler[playerid][pTazerd] == 1)return SendClientMessage(playerid,GRAU,"Du bist K.O/getazert.");
if(Spieler[playerid][pCuffed] == 1)return SendClientMessage(playerid,GRAU,"Du bist gefesselt.");
if(isPlayerInFrakt(playerid,4) || isPlayerInFrakt(playerid,5) || isPlayerInFrakt(playerid,7) || isPlayerInFrakt(playerid,9) || isPlayerInFrakt(playerid,12) || isPlayerInFrakt(playerid,13) || isPlayerInFrakt(playerid,17) || isPlayerInFrakt(playerid,18))
{
gettime(stunde,minute,sekunde);
if(stunde<13||stunde>23)return SendClientMessage(playerid,GRAU,"Man kann ein Gangwar erst zwischen 13 - und 24 Uhr starten.");
if(!isPlayerAMember(playerid,6))return SendClientMessage(playerid,GRAU,"Du besitzt nicht den jeweiligen Rang.");
if(IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,GRAU,"Du bist in einem Fahrzeug!");
if(IsAFightFaction(GetPlayerFaction(playerid)))
{
for(new fs;fs<sizeof(GangwarZones);fs++)
{
if((GangwarZones[fs][GW_OwnerFaction] == GetPlayerFaction(playerid) && GangwarZones[fs][GW_FightTime]) || GangwarZones[fs][GW_AttackFaction] == GetPlayerFaction(playerid))
return SendClientMessage(playerid,GRAU,"Deine Gang / Mafia ist bereits in einem Fight.");
}
ForEachPlayer(i)
{
if(IsPlayerConnected(i))
{
if(isPlayerInFrakt(i,GangwarZones[TempZone][GW_OwnerFaction]))
{
GegnerOnline++;
}
}
}
if(GegnerOnline < 3)return SendClientMessage(playerid,GRAU,"Nicht genug Gegner Online. (mindestens 3 Gegner!)");
if(TempZone != -255)
{
if(GangwarZones[TempZone][GW_FightTimeCool] != 0)
{
format(string, sizeof(string), "Das Gebiet kann erst wieder in ca. %d Minuten erobert werden.", GangwarZones[TempZone][GW_FightTimeCool]);
return SendClientMessage(playerid, GRAU,string);
}
if(!IsAFightFaction(GangwarZones[TempZone][GW_OwnerFaction]))
return SendClientMessage(playerid,GRAU,"Gebiet wurde ausgeschaltet.");
if(GangwarZones[TempZone][GW_OwnerFaction] == GetPlayerFaction(playerid))
return SendClientMessage(playerid,GRAU,"Man greift nicht seine eigenen Leute an.");
if(GangwarZones[TempZone][GW_FightTime] || GangwarZones[TempZone][GW_AttackFaction] != -255)
return SendClientMessage(playerid,GRAU,"In diesem Gebiet wird bereits geschossen.");
if(GangwarZones[TempZone][GW_LastFight])
{
new fsText[178];
format(fsText,sizeof(fsText),"Ganggebiet: Dieses Ganggebiet wurde bereits Angegriffen, wartet noch: '%d' Minuten.",GangwarZones[TempZone][GW_LastFight]);
SendClientMessage(playerid,GRAU,fsText);
return 1;
}
for(new fs;fs<sizeof(GangwarZones);fs++)
{
if(GangwarZones[fs][GW_OwnerFaction] == GangwarZones[TempZone][GW_OwnerFaction] && (GangwarZones[fs][GW_FightTime] || GangwarZones[fs][GW_AttackFaction] != -255))
return SendClientMessage(playerid,GRAU,"Ganggebiet: Die gegnerische Fraktion hat bereits einen Kampf.");
}
new fsTextToOwner[255];
format(fsTextToOwner,sizeof(fsTextToOwner),"Ihr werdet von der Fraktion %s angegriffen! GebietInfo: %s",GetFactionNameOfFaction(GetPlayerFaction(playerid)),GangwarZones[TempZone][GW_Zone_Name]);
new fsName[MAX_PLAYER_NAME];
GetPlayerName(playerid,fsName,MAX_PLAYER_NAME);
new fsTextToAttack[255];
format(fsTextToAttack,sizeof(fsTextToAttack),"Gangfight: %s hat einen Kampf gegen die Fraktion %s gestartet.",GetFactionNameOfFaction(GetPlayerFaction(playerid)),GetFactionNameOfFaction(GangwarZones[TempZone][GW_OwnerFaction]));
new fsText[64];
format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(GangwarZones[TempZone][GW_OwnerFaction]));
TextDrawSetString(GangwarZones[TempZone][GW_WinFaction],fsText);
TextDrawSetString(GangwarZones[TempZone][GW_WinKills],"~y~0 Kills");
format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(GetPlayerFaction(playerid)));
TextDrawSetString(GangwarZones[TempZone][GW_LoseFaction],fsText);
TextDrawSetString(GangwarZones[TempZone][GW_LoseKills],"~y~0 Kills");
TextDrawSetString(GangwarZones[TempZone][GW_Time],"Verbl. Zeit: 60 Minuten");//ZEIT
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
GangZoneFlashForPlayer(i,GangwarZones[TempZone][GW_ZoneID],GetZoneColorOfFaction(GetPlayerFaction(playerid)));
if(GetPlayerFaction(i) == GangwarZones[TempZone][GW_OwnerFaction])
{
PlayerPlaySound(i,1058,0.0,0.0,0.0);
SendClientMessage(i,ROT,fsTextToOwner);
TextDrawShowForPlayer(i,Fight);
TextDrawShowForPlayer(i,FightUnderline);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_WinFaction]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_WinKills]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_LoseFaction]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_LoseKills]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_Time]);
}
if(GetPlayerFaction(i) == GetPlayerFaction(playerid))
{
PlayerPlaySound(i,1058,0.0,0.0,0.0);
SendClientMessageToAll(GW_COLOR_ORANGE,fsTextToAttack);
TextDrawShowForPlayer(i,Fight);
TextDrawShowForPlayer(i,FightUnderline);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_WinFaction]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_WinKills]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_LoseFaction]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_LoseKills]);
TextDrawShowForPlayer(i,GangwarZones[TempZone][GW_Time]);
}
}
}
GangwarZones[TempZone][GW_AttackFaction] = GetPlayerFaction(playerid);
GangwarZones[TempZone][GW_KillsOfOwner] = 0;
GangwarZones[TempZone][GW_KillsOfAttack] = 0;
GangwarZones[TempZone][GW_FightTime] = FIGHT_TIME;
GangwarZones[TempZone][GW_CtfOfOwner][0] = -255;
GangwarZones[TempZone][GW_CtfOfOwner][1] = 0;
GangwarZones[TempZone][GW_CtfOfAttack][0] = -255;
GangwarZones[TempZone][GW_CtfOfAttack][1] = 0;
GangwarZones[TempZone][GW_Started] = 1;
return 1;
}return SendClientMessage(playerid,GRAU,"Du bist in keinem Gebiet!");
}else SendClientMessage(playerid,GRAU,"Du bist in keiner Gang / Mafia."); return 1;
}return SendClientMessage(playerid,GRAU,"Du bist nicht in der jeweiligen Fraktion.");
}
Und hier der Crashdetect code:
[22:26:50] [debug] Run time error 4: "Array index out of bounds"
[22:26:50] [debug] Accessing element at negative index -255
[22:26:50] [debug] AMX backtrace:
[22:26:50] [debug] #0 001ad6a0 in public cmd_startwar (0x00000009, 0x00e3115c) from test.amx
[22:26:50] [debug] #1 native CallLocalFunction () [00472ef0] from samp-server.exe
[22:26:50] [debug] #2 00007ad0 in public OnPlayerCommandText (0x00000009, 0x00e31134) from test20.amx
Was genau ist zu beachten ?