Gangfight System Bug

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Hallo liebes Breadfish Forum,
    habe ein Problem mit meinem Gangfight System.
    Wenn ich eine Zone erobere, steht da NoN Gang obwohl ich Grove Street, Ballas, Yakuza, La Cosa Nostra angegeben habe. Könnte jemand weiterhelfen?


    if(strcmp(cmdtext,"/capture",true)==0){
    if(IsAFightFaction(GetPlayerFaction(playerid))){
    for(new fs;fs<sizeof(FightSystem);fs++){
    if((FightSystem[fs][fsOwnerFaction] == GetPlayerFaction(playerid) && FightSystem[fs][fsFightTime]) || FightSystem[fs][fsAttackFaction] == GetPlayerFaction(playerid))
    return SendClientMessage(playerid,FS_COL_GREY,"** Deine Gang / Mafia ist bereits in einem Fight.");
    }
    new TempZone = GetPlayerFightzone(playerid);
    if(TempZone != -255){
    if(!IsAFightFaction(FightSystem[TempZone][fsOwnerFaction]))
    return SendClientMessage(playerid,FS_COL_GREY,"Gebiet wurde ausgeschaltet.");
    if(FightSystem[TempZone][fsOwnerFaction] == GetPlayerFaction(playerid))
    return SendClientMessage(playerid,FS_COL_GREY,"** Man greift nicht seine eigenen Leute an.");
    if(FightSystem[TempZone][fsFightTime] || FightSystem[TempZone][fsAttackFaction] != -255)
    return SendClientMessage(playerid,FS_COL_GREY,"** In diesem Gebiet wird bereits geschossen.");
    if(FightSystem[TempZone][fsLastFight]){
    new fsText[178];
    format(fsText,sizeof(fsText),"Ganggebiet: Dieses Ganggebiet wurde bereits Angegriffen, wartet noch: '%d' Minuten.",FightSystem[TempZone][fsLastFight]);
    SendClientMessage(playerid,FS_COL_GREY,fsText);
    return 1;
    }
    for(new fs;fs<sizeof(FightSystem);fs++){
    if(FightSystem[fs][fsOwnerFaction] == FightSystem[TempZone][fsOwnerFaction] && FightSystem[fs][fsAttackFaction] != -255)
    return SendClientMessage(playerid,FS_COL_GREY,"Ganggebiet: Die Gang / Mafia der das Ganggebiet gehört hat bereits ein Kampf.");
    }
    new fsTextToOwner[255];
    format(fsTextToOwner,sizeof(fsTextToOwner),">>> Fight <<< | Ihr werden von: %s angegriffen, setzt euch zur wehr!",GetFactionNameOfFaction(GetPlayerFaction(playerid)));
    new fsName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,fsName,MAX_PLAYER_NAME);
    new fsTextToAttack[255];
    format(fsTextToAttack,sizeof(fsTextToAttack),">>> Fight <<< | %s hat ein Kampf mit: %s begonnen, macht sie Platt!",fsName,GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
    new fsText[64];
    format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
    TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
    TextDrawSetString(FightSystem[TempZone][fsWinKills],"~y~00 Kills");
    format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(GetPlayerFaction(playerid)));
    TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
    TextDrawSetString(FightSystem[TempZone][fsLoseKills],"~y~00 Kills");
    TextDrawSetString(FightSystem[TempZone][fsTime],"Verbl. Zeit: 60 Minuten");//ZEIT
    for(new i;i<MAX_PLAYERS;i++){
    if(IsPlayerConnected(i)){
    GangZoneFlashForPlayer(i,FightSystem[TempZone][fsZoneID],GetZoneColorOfFaction(GetPlayerFaction(playerid)));
    if(GetPlayerFaction(i) == FightSystem[TempZone][fsOwnerFaction]){
    PlayerPlaySound(i,1058,0.0,0.0,0.0);
    SendClientMessage(i,FS_COL_YELLOW,fsTextToOwner);
    TextDrawShowForPlayer(i,Fight);
    TextDrawShowForPlayer(i,FightUnderline);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinFaction]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinKills]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseFaction]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseKills]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsTime]);
    }
    if(GetPlayerFaction(i) == GetPlayerFaction(playerid)){
    PlayerPlaySound(i,1058,0.0,0.0,0.0);
    SendClientMessage(i,FS_COL_YELLOW,fsTextToAttack);
    TextDrawShowForPlayer(i,Fight);
    TextDrawShowForPlayer(i,FightUnderline);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinFaction]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinKills]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseFaction]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseKills]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsTime]);
    }
    }
    }
    FightSystem[TempZone][fsAttackFaction] = GetPlayerFaction(playerid);
    FightSystem[TempZone][fsKillsOfOwner] = 0;
    FightSystem[TempZone][fsKillsOfAttack] = 0;
    FightSystem[TempZone][fsFightTime] = 60;//ZEIT
    FightSystem[TempZone][fsCTF][0] = -255;
    FightSystem[TempZone][fsCTF][1] = 0;
    FightSystem[TempZone][fsCTF][2] = 0;
    return 1;
    }return SendClientMessage(playerid,FS_COL_GREY,"** Du bist in keinem Gebiet!");
    }else SendClientMessage(playerid,FS_COL_GREY,"** Du bist in keiner Gang / Mafia.");
    return 1;
    }return 0;
    }


    stock GetZoneColorOfFaction(Faction){
    if(Faction == 5) return 0x00FF78FF; //LCN
    else if(Faction == 5) return 0x00FF78FF; //LCN
    else if(Faction == 13) return 0x4BBC00FF; //GS
    else if(Faction == 14) return 0x6E00FFFF; //Ballas
    else if(Faction == 6) return 0xFFABFFFF; //Yakuza
    else return 0x009BFFFF; //NoN-Gang
    }
    stock GetFactionNameOfFaction(Faction){
    new FactionName[64];
    if(Faction == 5) format(FactionName,sizeof(FactionName),"La Cosa Nostra");
    else if(Faction == 6) format(FactionName,sizeof(FactionName),"Yakuza");
    else if(Faction == 13) format(FactionName,sizeof(FactionName),"Grove Street");
    else if(Faction == 14) format(FactionName,sizeof(FactionName),"Ballas");
    else format(FactionName,sizeof(FactionName),"NoN-Gang");
    return FactionName;
    }


    Ich besitze das Godfather WOS Script von K3VIN, und mein enum vom Script lautet alles ein p davor z.b pLeader oder pMember
    Habe das so gemacht weiß aber nicht ob das genau stimmt..
    stock GetPlayerFaction(playerid){
    new Member = CallRemoteFunction("pInfo[playerid][pMember]","i",playerid);
    if(Member)
    return Member;
    new Leader = CallRemoteFunction("pInfo[playerid][pLeader]","i",playerid);
    if(Leader)
    return Leader;
    return 0;
    }


    Weiß jemand was da nicht genau funktioniert? :/ würde mich sehr um positive Antworten freuen.


    Mit freundlichen Grüßen,
    Matze :thumbup:

  • Ich nehme mal an, das Gangfight System ist nicht im gleichen Code, als die pInfo Deklaration, richtig?


    Ändere das zu:
    stock GetPlayerFaction(playerid){
    new Member = CallRemoteFunction("GetpMember","i",playerid);
    if(Member)
    return Member;
    new Leader = CallRemoteFunction("GetpLeader","i",playerid);
    if(Leader)
    return Leader;
    return 0;
    }



    Und füge in dem Code, in dem pInfo deklariert ist das ein, ganz unten.
    forward GetpMember(playerid);
    public GetpMember(playerid)
    {
    return pInfo[playerid][pMember];
    }


    forward GetpLeader(playerid);
    public GetpLeader(playerid)
    {
    return pInfo[playerid][pLeader];
    }


    Denn du kannst keine Variablen mit "CallRemoteFunction" aufrufen, sondern nur "forward"-Funktionen.

  • Kriege Errors.


    0\filterscripts\Gangfight.pwn(784) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
    0\filterscripts\Gangfight.pwn(784) : warning 215: expression has no effect
    0\filterscripts\Gangfight.pwn(784) : error 001: expected token: ";", but found "]"
    0\filterscripts\Gangfight.pwn(784) : error 029: invalid expression, assumed zero
    0\filterscripts\Gangfight.pwn(784) : fatal error 107: too many error messages on one line


    Zeile: 784:


    forward GetpMember(playerid);
    public GetpMember(playerid)
    {
    Zeile: 784: return pInfo[playerid][pMember];
    }

  • Achso okay, habe mich anscheinend verlesen.
    Ich habe das gemacht, aber da kommen ebenfalls immernoch Errors.
    Habe das ganz unten eingefügt. Ebenfalls treten Errors auf.



    Würde mich sehr um weitere Hilfe freuen.

  • Hmm das?
    enum pInfo
    {
    pKey[128],
    pLevel,
    pAdmin,
    pSupporter,
    pDonateRank,
    gPupgrade,
    pConnectTime,
    pNeuling,
    pReg,
    pSex,
    pAge,
    pOrigin,
    pCK,
    pMuted,
    pKnast,
    pExp,
    pCash,
    pAccount,
    pPlayerKreditDauer,
    pPlayerKredit,
    pCrimes,
    pKills,
    pJailed,
    pJailTime,
    pDeaths,
    pArrested,
    pWantedDeaths,
    pPhoneBook,
    pLottoNr,
    pFishes,
    pBiggestFish,
    pJob,
    pPayCheck,
    pRest,
    pHeadValue,
    pGangJailed,
    pMauled,
    pMats,
    pDrugs,
    pLeader,
    pMember,
    pFMember,
    pRank,
    pChar,
    pContractTime,
    pDetSkill,
    pSexSkill,
    pBoxSkill,
    pLawSkill,
    pMechSkill,
    pJackSkill,
    pCarSkill,
    pNewsSkill,
    pDrugsSkill,
    pCookSkill,
    pFishSkill,
    Float:pHealth,
    Float:pSHealth,
    pInt,
    pLocal,
    pTeam,
    pModel,
    pPnumber,
    pPhousekey,
    pPbiskey,
    Float:pPos_x,
    Float:pPos_y,
    Float:pPos_z,
    pCarLic,
    pNewLic,
    pFlyLic,
    pBoatLic,
    pFishLic,
    pGunLic, //Definition des Scheines zb die Aufgabe später
    pLKWLic,
    pRollerLic,
    pMotoLic,
    pBikeP,
    pCarP,
    pZig,
    pKekse,
    pZigSucht,
    pGun1,
    pGun2,
    pGun3,
    pGun4,
    pAmmo1,
    pAmmo2,
    pAmmo3,
    pAmmo4,
    pCarTime,
    pMulltime,
    pPayDay,
    pPayDayHad,
    pCDPlayer,
    pWins,
    pLoses,
    pAlcoholPerk,
    pDrugPerk,
    pMiserPerk,
    pPainPerk,
    pTraderPerk,
    pTut,
    pRadio,
    pWarns,
    Float:pGWD,
    pAdjustable,
    pFuel,
    pMarried,
    pMarriedTo[128],
    pInvWeapon,
    pInvAmmo,
    pInvWeapon2,
    pInvAmmo2,
    pInvDrugs,
    pInvMats,
    pFlugTime,
    pRoadblock,
    pPlayMinutes,
    pGesamtMinutes,
    pMinutesSinceLogin,
    pMinutesSinceAn,
    pSFPASS,
    pLVPASS,
    pHandyGeld,
    pHandyVer,
    pUhrID,
    pHandyID,
    pOwnPerso,
    pOwnAntrag,
    pPersoStop,
    pGehalt,
    pFrakSperre,
    pBoxMats,
    pBoxDrugs,
    pban,
    Text:LetterboxTop,Text:LetterboxBottom2, Text:LetterboxBottom,
    pFarmTime,
    pGDeaths,
    pGKills,
    pMeldung,
    pHouseKey,
    pRentHouseKey
    };

  • Meinst du das so?
    Habe das gefunden:


    new PlayerInfo[MAX_PLAYERS][pInfo];


    danach eingefügt.


    forward GetpMember(playerid);
    public GetpMember(playerid)
    {
    return PlayerInfo[MAX_PLAYERS][pInfo];
    }


    forward GetpLeader(playerid);
    public GetpLeader(playerid)
    {
    return PlayerInfo[MAX_PLAYERS][pInfo];
    }


    Kommen aber Errors.


    Dark.pwn(50998) : error 032: array index out of bounds (variable "PlayerInfo")
    Dark.pwn(51004) : error 032: array index out of bounds (variable "PlayerInfo")

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Kommen immernoch Errors,
    Dark.pwn(50998) : error 032: array index out of bounds (variable "PlayerInfo")
    Dark.pwn(51004) : error 032: array index out of bounds (variable "PlayerInfo")


    In diesen Zeilen:
    return PlayerInfo[playerid][pInfo];

  • Du warst schneller mit kopieren als ich mit editieren.


    Also nochmal:
    forward GetpMember(playerid);
    public GetpMember(playerid)
    {
    return PlayerInfo[playerid][pMember];
    }


    forward GetpLeader(playerid);
    public GetpLeader(playerid)
    {
    return PlayerInfo[playerid][pLeader];
    }

  • Okay danke, alles funktioniert einwandfrei :D
    Habe noch eine bitte, könntest du mir helfen? ich habe ka wie ich das anstellen soll dass man nur eine Zone gleichzeitig angreifen kann? und nicht mehrere


    if(strcmp(cmdtext,"/capture",true)==0){
    if(IsAFightFaction(GetPlayerFaction(playerid))){
    for(new fs;fs<sizeof(FightSystem);fs++){
    if((FightSystem[fs][fsOwnerFaction] == GetPlayerFaction(playerid) && FightSystem[fs][fsFightTime]) || FightSystem[fs][fsAttackFaction] == GetPlayerFaction(playerid))
    return SendClientMessage(playerid,FS_COL_GREY,"** Deine Gang / Mafia ist bereits in einem Fight.");
    }
    new TempZone = GetPlayerFightzone(playerid);
    if(TempZone != -255){
    if(!IsAFightFaction(FightSystem[TempZone][fsOwnerFaction]))
    return SendClientMessage(playerid,FS_COL_GREY,"Gebiet wurde ausgeschaltet.");
    if(FightSystem[TempZone][fsOwnerFaction] == GetPlayerFaction(playerid))
    return SendClientMessage(playerid,FS_COL_GREY,"** Diese Zone gehört bereits euch.");
    if(FightSystem[TempZone][fsFightTime] || FightSystem[TempZone][fsAttackFaction] != -255)
    return SendClientMessage(playerid,FS_COL_GREY,"** In diesem Gebiet wird bereits geschossen.");
    if(FightSystem[TempZone][fsLastFight]){
    new fsText[178];
    format(fsText,sizeof(fsText),"Ganggebiet: Dieses Ganggebiet wurde bereits Angegriffen, wartet noch: '%d' Minuten.",FightSystem[TempZone][fsLastFight]);
    SendClientMessage(playerid,FS_COL_GREY,fsText);
    return 1;
    }
    for(new fs;fs<sizeof(FightSystem);fs++){
    if(FightSystem[fs][fsOwnerFaction] == FightSystem[TempZone][fsOwnerFaction] && FightSystem[fs][fsAttackFaction] != -255)
    return SendClientMessage(playerid,FS_COL_GREY,"Ganggebiet: Die Gang / Mafia der das Ganggebiet gehört hat bereits ein Kampf.");
    }
    new fsTextToOwner[255];
    format(fsTextToOwner,sizeof(fsTextToOwner),">>> Fight <<< | Ihr werdet von: %s angegriffen, setzt euch zur wehr!",GetFactionNameOfFaction(GetPlayerFaction(playerid)));
    new fsName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,fsName,MAX_PLAYER_NAME);
    new fsTextToAttack[255];
    printf("fsOwnerFaction: %d - FactionName: %s",FightSystem[TempZone][fsOwnerFaction],GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
    format(fsTextToAttack,sizeof(fsTextToAttack),">>> Fight <<< | %s hat ein Kampf mit: %s begonnen, macht sie Platt!",fsName,GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
    new fsText[64];
    format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(FightSystem[TempZone][fsOwnerFaction]));
    TextDrawSetString(FightSystem[TempZone][fsWinFaction],fsText);
    TextDrawSetString(FightSystem[TempZone][fsWinKills],"~y~00 Kills");
    format(fsText,sizeof(fsText),"~y~%s",GetFactionNameOfFaction(GetPlayerFaction(playerid)));
    TextDrawSetString(FightSystem[TempZone][fsLoseFaction],fsText);
    TextDrawSetString(FightSystem[TempZone][fsLoseKills],"~y~00 Kills");
    TextDrawSetString(FightSystem[TempZone][fsTime],"Verbl. Zeit: 1 Minuten");//ZEIT
    for(new i;i<MAX_PLAYERS;i++){
    if(IsPlayerConnected(i)){
    GangZoneFlashForPlayer(i,FightSystem[TempZone][fsZoneID],GetZoneColorOfFaction(GetPlayerFaction(playerid)));
    if(GetPlayerFaction(i) == FightSystem[TempZone][fsOwnerFaction]){
    PlayerPlaySound(i,1058,0.0,0.0,0.0);
    SendClientMessage(i,FS_COL_YELLOW,fsTextToOwner);
    TextDrawShowForPlayer(i,Fight);
    TextDrawShowForPlayer(i,FightUnderline);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinFaction]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinKills]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseFaction]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseKills]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsTime]);
    }
    if(GetPlayerFaction(i) == GetPlayerFaction(playerid)){
    PlayerPlaySound(i,1058,0.0,0.0,0.0);
    SendClientMessage(i,FS_COL_YELLOW,fsTextToAttack);
    TextDrawShowForPlayer(i,Fight);
    TextDrawShowForPlayer(i,FightUnderline);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinFaction]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsWinKills]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseFaction]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsLoseKills]);
    TextDrawShowForPlayer(i,FightSystem[TempZone][fsTime]);
    }
    }
    }
    FightSystem[TempZone][fsAttackFaction] = GetPlayerFaction(playerid);
    FightSystem[TempZone][fsKillsOfOwner] = 0;
    FightSystem[TempZone][fsKillsOfAttack] = 0;
    FightSystem[TempZone][fsFightTime] = 1;//ZEIT
    FightSystem[TempZone][fsCTF][0] = -255;
    FightSystem[TempZone][fsCTF][1] = 0;
    FightSystem[TempZone][fsCTF][2] = 0;
    return 1;
    }return SendClientMessage(playerid,FS_COL_GREY,"** Du bist in keinem Gebiet!");
    }else SendClientMessage(playerid,FS_COL_GREY,"** Du bist in keiner Gang / Mafia.");
    return 1;
    }return 0;
    }

    2 Mal editiert, zuletzt von xSoldier ()