Beiträge von Mr.Soap

    Paar mysql Dinge:



    stock mysql_CheckIRGENDWAS(id)
    {


    new Query[128],count;
    format(Query, sizeof(Query), "SELECT * FROM `Tabelle` WHERE `id` = '%d'", id);
    mysql_query(Query);
    mysql_store_result();
    count = mysql_num_rows();
    mysql_free_result();
    return count;
    }


    Verwendung: if(mysql:CheckIRGENDWAS == 1)
    Wenn es vorhanden ist 0 wenn nicht dies kann man z.B bei schleifen für ein Haussystem nehmen damit der server nicht Überladt ^^


    Dan ein Paar Float Dinge:



    stock Float:mysql_GetFloat(Table[], Field[], Where[], Is[])
    {
    new query[128], Float:sqlfloat;
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    mysql_real_escape_string(Is, Is);
    format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is);
    mysql_query(query);
    mysql_store_result();
    mysql_fetch_float(sqlfloat);
    mysql_free_result();
    return sqlfloat;
    }
    stock Float:mysql_GetFloatByInt(Table[], Field[], Where[], Is)
    {
    new query[128], Float:sqlfloat;
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%d'", Field, Table, Where, Is);
    mysql_query(query);
    mysql_store_result();
    mysql_fetch_float(sqlfloat);
    mysql_free_result();
    return sqlfloat;
    }


    stock mysql_SetFloat(Table[], Field[], Float:To, Where[], Where2[])
    {
    new query[128];
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    mysql_real_escape_string(Where2, Where2);
    format(query, 128, "UPDATE `%s` SET `%s` = '%f' WHERE `%s` = '%s'", Table, Field, To, Where, Where2);
    mysql_query(query);
    return true;
    }

    Und andere Wert-Auslessachen :D

    stock mysql_GetInt(Table[], Field[], Where[], Is[])
    {
    new query[128];
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    mysql_real_escape_string(Is, Is);
    format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is);
    mysql_query(query);
    mysql_store_result();
    new sqlint = mysql_fetch_int();
    mysql_free_result();
    return sqlint;
    }
    stock mysql_GetIntByInt(Table[], Field[], Where[], Is)
    {
    new query[128];
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%d'", Field, Table, Where, Is);
    mysql_query(query);
    mysql_store_result();
    new sqlint = mysql_fetch_int();
    mysql_free_result();
    return sqlint;
    }
    stock mysql_GetStringByInt(Table[], Field[], Where[], Is)
    {
    new query[128], Get[128];
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%d'", Field, Table, Where, Is);
    mysql_query(query);
    mysql_store_result();
    mysql_fetch_row(Get);
    mysql_free_result();
    return Get;
    }


    stock mysql_GetString(Table[], Field[], Where[], Is[])
    {
    new query[128], Get[128];
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    mysql_real_escape_string(Is, Is);
    format(query, 128, "SELECT `%s` FROM `%s` WHERE `%s` = '%s'", Field, Table, Where, Is);
    mysql_query(query);
    mysql_store_result();
    mysql_fetch_row(Get);
    mysql_free_result();
    return Get;
    }
    stock mysql_SetInt(Table[], Field[], To, Where[], Where2[])
    {
    new query[128];
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    mysql_real_escape_string(Where2, Where2);
    format(query, 128, "UPDATE `%s` SET `%s` = '%d' WHERE `%s` = '%s'", Table, Field, To, Where, Where2);
    mysql_query(query);
    return true;
    }
    stock mysql_SetString(Table[], Field[], To[], Where[], Where2[])
    {
    new query[128];
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(To, To);
    mysql_real_escape_string(Where, Where);
    mysql_real_escape_string(Where2, Where2);
    format(query, 128, "UPDATE `%s` SET `%s` = '%s' WHERE `%s` = '%s'", Table, Field, To, Where, Where2);
    mysql_query(query);
    return true;
    }
    stock mysql_SetIntByInt(Table[], Field[], To, Where[], Where2)
    {
    new query[128];
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    format(query, 128, "UPDATE `%s` SET `%s` = '%d' WHERE `%s` = '%d'", Table, Field, To, Where, Where2);
    mysql_query(query);
    return true;
    }
    stock mysql_SetStringByInt(Table[], Field[], To[], Where[], Where2)
    {
    new query[128];
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(To, To);
    mysql_real_escape_string(Where, Where);
    format(query, 128, "UPDATE `%s` SET `%s` = '%s' WHERE `%s` = '%d'", Table, Field, To, Where, Where2);
    mysql_query(query);
    return true;
    }


    Ihr müsst es eventuell etwas abändern


    MFG Arendium :)

    Mach eine Rechnung z.B 25*Level
    oder so: 25+deinepunkte*Level


    Varriante 2: standart 25 punkte dan + die Punkte pro Level * Level


    Und so gibst du ihn ein Level: DEINEVARRIABLE += 1;