Fehler bei Definitionen

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
  • Hey..
    Habe ein Problem bei einer Include, was ich erst gestern bemerkte..
    Habe ja vor einiger Zeit mal eine Include rausgebracht, wo das Leben, die Schutzweste und das Geld Serverside ist..
    Jedoch wird das Mainscript dadurch unterbrochen, OnGameModeInit wird nichteinmal aufgerufen..
    Wenn ich die Definitionen der Callbacks entferne, klappt alles perfekt, jedoch kommt es dadurch zu Errors, da "OnGameModeInit" usw ja bereits vorhanden ist..


    Weiß nicht mehr weiter..
    Kann mir jemand vlt helfen?


    Code

    #if !defined _samp_included
    #include <a_samp>
    #endif
    #if !defined _Progress_included
    #include <Progress>
    #endif

    Code
    forward SS_OnGameModeInit();
    forward SS_OnGameModeExit();
    forward SS_OnPlayerConnect(playerid);
    forward SS_OnPlayerDeath(playerid,killerid,reason);
    forward SS_OnPlayerDisconnect(playerid, reason);
    forward SS_OnPlayerSpawn(playerid);
    forward SS_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart);

    Code
    forward GiveArmour(playerid,Float:_armour);
    forward SetArmour(playerid,Float:_armour);
    forward GetArmour(playerid);
    forward GiveHealth(playerid,Float:_health);
    forward SetHealth(playerid,Float:_health);
    forward GetHealth(playerid);
    forward GiveMoney(playerid,_money);
    forward SetMoney(playerid,_money);
    forward GetMoney(playerid);

    Code
    new Text:TDA[4];
    enum TDA_Player{
    PlayerText:Geld,
    PlayerText:HP,
    PlayerText:AP,
    Bar:HP_,
    Bar:AP_
    }
    static TD[MAX_PLAYERS][TDA_Player];

    Code
    enum SS_E{
    Float:SS_Health,
    Float:SS_Armour,
    SS_Money,
    bool:SS_KillHim
    }
    static SS_Player[MAX_PLAYERS][SS_E];

    Code
    public OnGameModeInit(){
    print(" Serverside Health, Armour, Money | Loaded | By ErikSon");
    TDA[0] = TextDrawCreate(642.000000, 114.000000, ".");
    TextDrawBackgroundColor(TDA[0], 255);
    TextDrawFont(TDA[0], 1);
    TextDrawLetterSize(TDA[0], 0.500000, 10.999999);
    TextDrawColor(TDA[0], 136);
    TextDrawSetOutline(TDA[0], 0);
    TextDrawSetProportional(TDA[0], 1);
    TextDrawSetShadow(TDA[0], 1);
    TextDrawUseBox(TDA[0], 1);
    TextDrawBoxColor(TDA[0], 0x82828288);
    TextDrawTextSize(TDA[0], 490.000000, 0.000000);
    TextDrawSetSelectable(TDA[0], 0);

    Code
    TDA[1] = TextDrawCreate(499.000000, 188.000000, "$");
    TextDrawBackgroundColor(TDA[1], 255);
    TextDrawFont(TDA[1], 0);
    TextDrawLetterSize(TDA[1], 0.500000, 2.000000);
    TextDrawColor(TDA[1], 0x00B70A66);
    TextDrawSetOutline(TDA[1], 0);
    TextDrawSetProportional(TDA[1], 1);
    TextDrawSetShadow(TDA[1], 1);
    TextDrawSetSelectable(TDA[1], 0);

    Code
    TDA[2] = TextDrawCreate(499.000000, 121.000000, "HP");
    TextDrawBackgroundColor(TDA[2], 255);
    TextDrawFont(TDA[2], 3);
    TextDrawLetterSize(TDA[2], 0.500000, 2.000000);
    TextDrawColor(TDA[2], 0xFF0A0066);
    TextDrawSetOutline(TDA[2], 0);
    TextDrawSetProportional(TDA[2], 1);
    TextDrawSetShadow(TDA[2], 1);
    TextDrawSetSelectable(TDA[2], 0);

    Code
    TDA[3] = TextDrawCreate(499.000000, 151.000000, "AP");
    TextDrawBackgroundColor(TDA[3], 255);
    TextDrawFont(TDA[3], 3);
    TextDrawLetterSize(TDA[3], 0.500000, 2.700000);
    TextDrawColor(TDA[3], 0x0071FF66);
    TextDrawSetOutline(TDA[3], 0);
    TextDrawSetProportional(TDA[3], 1);
    TextDrawSetShadow(TDA[3], 1);
    TextDrawSetSelectable(TDA[3], 0);

    Code
    for(new i = 0; i<MAX_PLAYERS; i++){
    TD[i][Geld] = CreatePlayerTextDraw(i,633.000000, 188.000000, "999999999"); //Geld
    PlayerTextDrawAlignment(i,TD[i][Geld], 3);
    PlayerTextDrawBackgroundColor(i,TD[i][Geld], 255);
    PlayerTextDrawFont(i,TD[i][Geld], 2);
    PlayerTextDrawLetterSize(i,TD[i][Geld], 0.500000, 2.000000);
    PlayerTextDrawColor(i,TD[i][Geld], 0x00B70A66);
    PlayerTextDrawSetOutline(i,TD[i][Geld], 0);
    PlayerTextDrawSetProportional(i,TD[i][Geld], 1);
    PlayerTextDrawSetShadow(i,TD[i][Geld], 1);
    PlayerTextDrawSetSelectable(i,TD[i][Geld], 0);

    TD[i][HP] = CreatePlayerTextDraw(i,633.000000, 122.000000, "100"); // Hp
    PlayerTextDrawAlignment(i,TD[i][HP], 3);
    PlayerTextDrawBackgroundColor(i,TD[i][HP], 255);
    PlayerTextDrawFont(i,TD[i][HP], 2);
    PlayerTextDrawLetterSize(i,TD[i][HP], 0.500000, 2.000000);
    PlayerTextDrawColor(i,TD[i][HP], 0xFF0A0066);
    PlayerTextDrawSetOutline(i,TD[i][HP], 0);
    PlayerTextDrawSetProportional(i,TD[i][HP], 1);
    PlayerTextDrawSetShadow(i,TD[i][HP], 1);
    PlayerTextDrawSetSelectable(i,TD[i][HP], 0);

    Code
    TD[i][AP] = CreatePlayerTextDraw(i,633.000000, 156.000000, "100"); //AP
    PlayerTextDrawAlignment(i,TD[i][AP], 3);
    PlayerTextDrawBackgroundColor(i,TD[i][AP], 255);
    PlayerTextDrawFont(i,TD[i][AP], 2);
    PlayerTextDrawLetterSize(i,TD[i][AP], 0.500000, 2.000000);
    PlayerTextDrawColor(i,TD[i][AP], 0x0071FF66);
    PlayerTextDrawSetOutline(i,TD[i][AP], 0);
    PlayerTextDrawSetProportional(i,TD[i][AP], 1);
    PlayerTextDrawSetShadow(i,TD[i][AP], 1);
    PlayerTextDrawSetSelectable(i,TD[i][AP], 0);
    TD[i][AP_] = CreateProgressBar(524.00, 160.00, 71.50, 13.50, 0x0071FF66, 100.0);
    TD[i][HP_] = CreateProgressBar(524.00, 128.00, 71.50, 13.50, 0xFF0A0066, 100.0);
    }
    return CallLocalFunction("SS_OnGameModeInit","");
    }

    Code
    public OnGameModeExit(){
    new i = 0;
    for(i = 0; i<4; i++)TextDrawDestroy(TDA[i]);
    for(i = 0; i<MAX_PLAYERS; i++)PlayerTextDrawDestroy(i,TD[i][Geld]),PlayerTextDrawDestroy(i,TD[i][HP]),PlayerTextDrawDestroy(i,TD[i][AP]);
    return CallLocalFunction("SS_OnGameModeExit","");
    }

    Code
    public OnPlayerConnect(playerid){
    SetHealth(playerid,100),SetArmour(playerid,0),SetMoney(playerid,0),
    SS_Player[playerid][SS_KillHim] = false;
    return CallLocalFunction("SS_OnPlayerConnect","i",playerid);
    }

    Code
    public OnPlayerDisconnect(playerid, reason){
    for(new i = 0; i<4; i++)TextDrawHideForPlayer(playerid,TDA[i]);
    PlayerTextDrawHide(playerid,TD[playerid][Geld]),
    PlayerTextDrawHide(playerid,TD[playerid][HP]),
    PlayerTextDrawHide(playerid,TD[playerid][AP]),
    HideProgressBarForPlayer(playerid,TD[playerid][HP_]),
    HideProgressBarForPlayer(playerid,TD[playerid][AP_]);
    return CallLocalFunction("SS_OnPlayerDisconnect","ii",playerid,reason);
    }

    Code
    public OnPlayerSpawn(playerid){
    if(!SS_Player[playerid][SS_Health])GiveHealth(playerid,100);
    SS_Player[playerid][SS_KillHim] = false;
    for(new i = 0; i<4; i++)TextDrawShowForPlayer(playerid,TDA[i]);
    PlayerTextDrawShow(playerid,TD[playerid][Geld]),
    PlayerTextDrawShow(playerid,TD[playerid][HP]),
    PlayerTextDrawShow(playerid,TD[playerid][AP]),
    ShowProgressBarForPlayer(playerid,TD[playerid][HP_]),
    ShowProgressBarForPlayer(playerid,TD[playerid][AP_]);
    return CallLocalFunction("SS_OnPlayerSpawn","i",playerid);
    }

    Code
    public OnPlayerDeath(playerid, killerid, reason){
    SetHealth(playerid,100),SetArmour(playerid,0);
    return CallLocalFunction("SS_OnPlayerDeath","iii",playerid,killerid,reason);
    }

    Code
    public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart){
    new Float:amount2;
    SetPlayerHealth(playerid,100);
    if(SS_Player[playerid][SS_Armour] >= 1 && issuerid != INVALID_PLAYER_ID){
    amount2 = (amount - SS_Player[playerid][SS_Armour]);
    GiveArmour(playerid,-amount);
    if(amount2)GiveHealth(playerid,-amount2);
    }
    else{
    GiveHealth(playerid,-amount);
    if(SS_Player[playerid][SS_Health] <= 0 && SS_Player[playerid][SS_KillHim])SetPlayerHealth(playerid,0);
    }
    return CallLocalFunction("SS_OnPlayerTakeDamage","iifii",playerid, issuerid, amount, weaponid, bodypart);
    }

    Code
    public GiveArmour(playerid,Float:_armour){
    SS_Player[playerid][SS_Armour] += _armour;
    if(SS_Player[playerid][SS_Armour] > 999)SS_Player[playerid][SS_Armour] = 999;
    if(SS_Player[playerid][SS_Armour] < 0)SS_Player[playerid][SS_Armour] = 0;
    new str[4]; format(str,sizeof(str),"%.0f",SS_Player[playerid][SS_Armour]);
    SetProgressBarValue(TD[playerid][AP_],floatround(SS_Player[playerid][SS_Armour]));
    UpdateProgressBar(TD[playerid][AP_],playerid);
    return PlayerTextDrawSetString(playerid,TD[playerid][AP],str);
    }
    public SetArmour(playerid,Float:_armour){
    SS_Player[playerid][SS_Armour] = _armour;
    if(SS_Player[playerid][SS_Armour] > 999)SS_Player[playerid][SS_Armour] = 999;
    if(SS_Player[playerid][SS_Armour] < 0)SS_Player[playerid][SS_Armour] = 0;
    new str[4]; format(str,sizeof(str),"%.0f",SS_Player[playerid][SS_Armour]);
    SetProgressBarValue(TD[playerid][AP_],floatround(SS_Player[playerid][SS_Armour])),
    UpdateProgressBar(TD[playerid][AP_],playerid);
    return PlayerTextDrawSetString(playerid,TD[playerid][AP],str);
    }
    public GetArmour(playerid)return floatround(SS_Player[playerid][SS_Armour]);

    Code
    public GiveHealth(playerid,Float:_health){
    SS_Player[playerid][SS_Health] += _health;
    if(SS_Player[playerid][SS_Health] > 999)SS_Player[playerid][SS_Health] = 999;
    new str[4]; format(str,sizeof(str),"%.0f",SS_Player[playerid][SS_Health]);
    SetProgressBarValue(TD[playerid][HP_],floatround(SS_Player[playerid][SS_Health]));
    UpdateProgressBar(TD[playerid][HP_],playerid);
    if(SS_Player[playerid][SS_Health] <= 0)SS_Player[playerid][SS_KillHim] = true, SetPlayerHealth(playerid,0);
    return PlayerTextDrawSetString(playerid,TD[playerid][HP],str);
    }
    public SetHealth(playerid,Float:_health){
    SS_Player[playerid][SS_Health] = _health;
    if(SS_Player[playerid][SS_Health] > 999)SS_Player[playerid][SS_Health] = 999;
    new str[4]; format(str,sizeof(str),"%.0f",SS_Player[playerid][SS_Health]);
    SetProgressBarValue(TD[playerid][HP_],floatround(SS_Player[playerid][SS_Health]));
    UpdateProgressBar(TD[playerid][HP_],playerid);
    if(SS_Player[playerid][SS_Health] <= 0)SS_Player[playerid][SS_KillHim] = true, SetPlayerHealth(playerid,0);
    return PlayerTextDrawSetString(playerid,TD[playerid][HP],str);
    }
    public GetHealth(playerid)return floatround(SS_Player[playerid][SS_Health]);

    Code
    public GiveMoney(playerid,_money){
    SS_Player[playerid][SS_Money] += _money;
    if(SS_Player[playerid][SS_Money] > 999999999)SS_Player[playerid][SS_Money] = 999999999;
    new str[16]; format(str,sizeof(str),"%i",SS_Player[playerid][SS_Money]);
    return PlayerTextDrawSetString(playerid,TD[playerid][Geld],str);
    }
    public SetMoney(playerid,_money){
    SS_Player[playerid][SS_Money] = _money;
    if(SS_Player[playerid][SS_Money] > 999999999)SS_Player[playerid][SS_Money] = 999999999;
    new str[16]; format(str,sizeof(str),"%i",SS_Player[playerid][SS_Money]);
    return PlayerTextDrawSetString(playerid,TD[playerid][Geld],str);
    }
    public GetMoney(playerid)return SS_Player[playerid][SS_Money];

    Code
    #if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
    #else
    #define _ALS_OnPlayerConnect
    #endif
    #define OnPlayerConnect SS_OnPlayerConnect

    #if defined _ALS_OnGameModeInit
    #undef OnGameModeInit
    #else
    #define _ALS_OnGameModeInit
    #endif
    #define OnGameModeInit SS_OnGameModeInit

    Code
    #if defined _ALS_OnGameModeExit
    #undef OnGameModeExit
    #else
    #define _ALS_OnGameModeExit
    #endif
    #define OnGameModeExit SS_OnGameModeExit

    #if defined _ALS_OnPlayerSpawn
    #undef OnPlayerSpawn
    #else
    #define _ALS_OnPlayerSpawn
    #endif
    #define OnPlayerSpawn SS_OnPlayerSpawn

    #if defined _ALS_OnPlayerDeath
    #undef OnPlayerDeath
    #else
    #define _ALS_OnPlayerDeath
    #endif
    #define OnPlayerDeath SS_OnPlayerDeath

    Code
    #if defined _ALS_OnPlayerDisconnect
    #undef OnPlayerDisconnect
    #else
    #define _ALS_OnPlayerDisconnect
    #endif
    #define OnPlayerDisconnect SS_OnPlayerDisconnect

    Code
    #if defined _ALS_OnPlayerTakeDamage
    #undef OnPlayerTakeDamage
    #else
    #define _ALS_OnPlayerTakeDamage
    #endif
    #define OnPlayerTakeDamage SS_OnPlayerTakeDamage


    Die Definitionen sind ganz unten..


    Da ich dafür ein kleines Update rausbringen wollte, habe ich das mal getestet, jedoch bemerkte ich dann den Fehler..
    Hoffe jemand kann mir helfen..
    Danke im Voraus!


    >> Hier die 'Progress-Bar' - Include

    Mit freundlichen Grüßen
    ErikSon



    Scripte kleine Systeme auf Anfrage umsonst!
    Per PN könnt ihr mir gerne Scriptingfragen stellen.

    Einmal editiert, zuletzt von ErikSon ()

  • Das liegt daran, dass du viel zu viele Textdraws erstellst. Ich habe in der Progress Include das MAX_BARS mal auf * 3 anstatt / 3 gesetzt, dann ging es ohne Probleme, allerdings wirst du früher oder später Probleme mit den Textdraws bekommen. Setze MAX_BARS in der Progress Include einfach auf MAX_TEXTDRAWS (ohne das / 3), dann geht es soweit du noch Textdraws zur Verfügung hast. Das beste ist aber, wenn du die Include aktualisierst, auf PlayerTextDraws.