Heap Size zu hoch.., bei neuem Script

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,


    meine Heap Size ist bei einem 360 Zeilen Script schon zu hoch.
    Was ist das? Ich hatte so etwas noch nie..



    /*



    */



    //SA:MP Includes
    #include <a_samp>
    #include <a_mysql>




    //MySQL Verbindung
    #define MYSQL_HOST "127.0.0.1"
    #define MYSQL_USER "root"
    #define MYSQL_PASS ""
    #define MYSQL_DBSE "samp"




    //Dialoge
    enum
    {
    DIALOG_LOGIN,
    DIALOG_REGISTER
    }




    //Speicherungen der "Systeme"
    enum pPlayerEnum
    {
    p_ID,
    bool:pOnline,
    pName[MAX_PLAYER_NAME],
    pLevel
    }
    new PlayerInfo[MAX_PLAYERS][pPlayerEnum];




    //Variablen
    new Verbindung;




    //Definierungen anderer Funktionen
    forward OnUserCheck(playerid);
    forward OnUserLogin(playerid);
    forward OnUserRegister(playerid);



    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    main()
    {
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
    }




    public OnGameModeInit()
    {
    //MySQL Verbindung
    MySQL_SetupConnection();


    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
    }



    public OnGameModeExit()
    {
    mysql_close(Verbindung);
    return 1;
    }



    public OnPlayerRequestClass(playerid, classid)
    {
    if(!PlayerInfo[playerid][pOnline])
    {
    new query[128];
    mysql_format(Verbindung, query, sizeof(query), "SELECT ID FROM server_accounts WHERE Name = '%e'", PlayerInfo[playerid][pName]);
    mysql_pquery(Verbindung, query, "OnUserCheck", "d", playerid);
    }
    return 1;
    }



    public OnPlayerConnect(playerid)
    {
    ResetPlayerVariablen(playerid);
    return 1;
    }



    public OnPlayerDisconnect(playerid, reason)
    {
    SaveUserStats(playerid);
    return 1;
    }



    public OnPlayerSpawn(playerid)
    {
    return 1;
    }



    public OnPlayerDeath(playerid, killerid, reason)
    {
    return 1;
    }



    public OnVehicleSpawn(vehicleid)
    {
    return 1;
    }



    public OnVehicleDeath(vehicleid, killerid)
    {
    return 1;
    }



    public OnPlayerText(playerid, text[])
    {
    return 1;
    }



    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
    // Do something here
    return 1;
    }
    return 0;
    }



    public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
    {
    return 1;
    }



    public OnPlayerExitVehicle(playerid, vehicleid)
    {
    return 1;
    }



    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    return 1;
    }



    public OnPlayerEnterCheckpoint(playerid)
    {
    return 1;
    }



    public OnPlayerLeaveCheckpoint(playerid)
    {
    return 1;
    }



    public OnPlayerEnterRaceCheckpoint(playerid)
    {
    return 1;
    }



    public OnPlayerLeaveRaceCheckpoint(playerid)
    {
    return 1;
    }



    public OnRconCommand(cmd[])
    {
    return 1;
    }



    public OnPlayerRequestSpawn(playerid)
    {
    return 1;
    }



    public OnObjectMoved(objectid)
    {
    return 1;
    }



    public OnPlayerObjectMoved(playerid, objectid)
    {
    return 1;
    }



    public OnPlayerPickUpPickup(playerid, pickupid)
    {
    return 1;
    }



    public OnVehicleMod(playerid, vehicleid, componentid)
    {
    return 1;
    }



    public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
    {
    return 1;
    }



    public OnVehicleRespray(playerid, vehicleid, color1, color2)
    {
    return 1;
    }



    public OnPlayerSelectedMenuRow(playerid, row)
    {
    return 1;
    }



    public OnPlayerExitedMenu(playerid)
    {
    return 1;
    }



    public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
    {
    return 1;
    }



    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    return 1;
    }



    public OnRconLoginAttempt(ip[], password[], success)
    {
    return 1;
    }



    public OnPlayerUpdate(playerid)
    {
    return 1;
    }



    public OnPlayerStreamIn(playerid, forplayerid)
    {
    return 1;
    }



    public OnPlayerStreamOut(playerid, forplayerid)
    {
    return 1;
    }



    public OnVehicleStreamIn(vehicleid, forplayerid)
    {
    return 1;
    }



    public OnVehicleStreamOut(vehicleid, forplayerid)
    {
    return 1;
    }



    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
    switch(dialogid)
    {
    case DIALOG_REGISTER:
    {
    new query[256];
    if(!response) return Kick(playerid);
    if(strlen(inputtext) < 3) return //Register Funktion
    mysql_format(Verbindung, query, sizeof(query), "INSERT INTO server_accounts (Name, Password) VALUES ('%e', MD5('%e'))", PlayerInfo[playerid][pName], inputtext);
    mysql_pquery(Verbindung, query, "OnUserRegister", "d", playerid);
    }
    case DIALOG_LOGIN:
    {
    new query[256];
    if(!response) return Kick(playerid);
    if(strlen(inputtext) < 3) return //Login Funktion
    mysql_format(Verbindung, query, sizeof(query), "SELECT * FROM server_accounts WHERE Name = '%e' AND Password = MD5('%e')", PlayerInfo[playerid][pName], inputtext);
    mysql_pquery(Verbindung, query, "OnUserLogin", "d", playerid);
    }
    }
    return 1;
    }



    public OnPlayerClickPlayer(playerid, clickedplayerid, source)
    {
    return 1;
    }




    public OnUserCheck(playerid)
    {
    if(cache_get_row_count() == 0)
    {
    //Register Funktion
    }
    else
    {
    //Login Funktion
    }
    return 1;
    }




    public OnUserRegister(playerid)
    {
    PlayerInfo[playerid][p_ID] = cache_insert_id();
    return 1;
    }




    public OnUserLogin(playerid)
    {
    if(cache_get_row_count() == 0)
    {
    //Passwort falsch Funktion
    }
    else
    {
    PlayerInfo[playerid][p_ID] = cache_get_field_content_int(0, "ID", Verbindung);
    PlayerInfo[playerid][pLevel] = cache_get_field_content_int(0, "Level", Verbindung);
    PlayerInfo[playerid][pOnline] = true;
    }
    return 1;
    }




    stock SaveUserStats(playerid)
    {
    new query[256];
    if(!PlayerInfo[playerid][pOnline]) return 1;
    mysql_format(Verbindung, query, sizeof(query), "UPDATE server_accounts SET Level = '%d' WHERE ID = '%d'",
    PlayerInfo[playerid][pLevel], PlayerInfo[playerid][p_ID]);
    mysql_pquery(Verbindung, query);
    return 1;
    }




    stock ResetPlayerVariablen(playerid)
    {
    PlayerInfo[playerid][p_ID] = 0;
    PlayerInfo[playerid][pLevel] = 0;
    PlayerInfo[playerid][pOnline] = false;
    GetPlayerName(playerid, PlayerInfo[playerid][pName], MAX_PLAYER_NAME);
    }




    stock MySQL_SetupConnection(ttl = 3)
    {
    Verbindung = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DBSE, MYSQL_PASS);
    if(mysql_errno(Verbindung) != 0)
    {
    if(ttl > 1)
    {
    print("[MySQL] Es konnte keine Verbindung zur Datenbank hergestellt werden.");
    printf("[MySQL] Starte neuen Verbindungsversuch (TTL: %d).", ttl-1);
    return MySQL_SetupConnection(ttl-1);
    }
    else
    {
    print("[MySQL] Es konnte keine Verbindung zur Datenbank hergestellt werden.");
    print("[MySQL] Bitte prüfen Sie die Verbindungsdaten.");
    print("[MySQL] Der Server wird heruntergefahren.");
    return SendRconCommand("exit");
    }
    }
    printf("[MySQL] Die Verbindung zur Datenbank wurde erfolgreich hergestellt! Verbindung: %d", Verbindung);
    return 1;
    }



    //e: Überschrift bearbeitet

    Einmal editiert, zuletzt von Kevin__ () aus folgendem Grund: //e: Überschrift bearbeitet