Hallo Probelm mit mysql

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 ich habe angefangen mit mysql und ja habe es so gemacht das ich wieder an die letzte pos spawn also er speichert es ab aber abrufen geht nicht spawne dann in der farm also die 0 achsen warum ?


    public OnPlayerSpawn(playerid)
    {
    StopAudioStreamForPlayer(playerid);
    SetPlayerPos(playerid,PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
    }


    stock LoadPlayer(playerid)
    {
    if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
    {
    GetPlayerName(playerid, PlayerInfo[playerid][pName], MAX_PLAYER_NAME);
    PlayerInfo[playerid][pLevel] = mysql_GetInt("accounts", "Level", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pGeschlecht] = mysql_GetInt("accounts", "Geschlecht", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pAlter] = mysql_GetInt("accounts", "Alter", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pGeld] = mysql_GetInt("accounts", "Geld", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pTut] = mysql_GetInt("accounts", "TuT", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pKills] = mysql_GetInt("accounts", "Kills", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pTode] = mysql_GetInt("accounts", "Tode", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pInt] = mysql_GetInt("accounts", "Interior", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pHealth] = mysql_GetInt("accounts", "Health", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pPos_x] = mysql_GetInt("accounts", "Pos_x", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pPos_y] = mysql_GetInt("accounts", "Pos_y", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pPos_z] = mysql_GetInt("accounts", "Pos_z", "Name", PlayerInfo[playerid][pName]);
    }
    return 1;
    }



    Also speichern geht aber abrufen nicht aber trotzden hier


    stock SavePlayer(playerid)
    {
    if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
    {
    if(GetPVarInt(playerid,"Eingeloggt") == 1)
    {
    mysql_SetInt("accounts", "Level", PlayerInfo[playerid][pLevel], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Geschlecht", PlayerInfo[playerid][pGeschlecht], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Alter", PlayerInfo[playerid][pAlter], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Geld", PlayerInfo[playerid][pGeld], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "TuT", PlayerInfo[playerid][pTut], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Kills", PlayerInfo[playerid][pKills], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Tode", PlayerInfo[playerid][pTode], "Name", PlayerInfo[playerid][pName]);
    mysql_SetInt("accounts", "Interior", PlayerInfo[playerid][pInt], "Name", PlayerInfo[playerid][pName]);
    mysql_SetFloat("accounts", "Health", PlayerInfo[playerid][pHealth], "Name", PlayerInfo[playerid][pName]);
    mysql_SetFloat("accounts", "Pos_x", PlayerInfo[playerid][pPos_x], "Name", PlayerInfo[playerid][pName]);
    mysql_SetFloat("accounts", "Pos_y", PlayerInfo[playerid][pPos_y], "Name", PlayerInfo[playerid][pName]);
    mysql_SetFloat("accounts", "Pos_z", PlayerInfo[playerid][pPos_z], "Name", PlayerInfo[playerid][pName]);
    }
    }
    return 1;
    }

  • Habe es so gemacht aber bin immer noch farm !!


    stock LoadPlayer(playerid)
    {
    if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
    {
    GetPlayerName(playerid, PlayerInfo[playerid][pName], MAX_PLAYER_NAME);
    PlayerInfo[playerid][pLevel] = mysql_GetInt("accounts", "Level", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pGeschlecht] = mysql_GetInt("accounts", "Geschlecht", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pAlter] = mysql_GetInt("accounts", "Alter", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pGeld] = mysql_GetInt("accounts", "Geld", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pTut] = mysql_GetInt("accounts", "TuT", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pKills] = mysql_GetInt("accounts", "Kills", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pTode] = mysql_GetInt("accounts", "Tode", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pInt] = mysql_GetInt("accounts", "Interior", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pHealth] = mysql_GetFloat("accounts", "Health", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pPos_x] = mysql_GetFloat("accounts", "Pos_x", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pPos_y] = mysql_GetFloat("accounts", "Pos_y", "Name", PlayerInfo[playerid][pName]);
    PlayerInfo[playerid][pPos_z] = mysql_GetFloat("accounts", "Pos_z", "Name", PlayerInfo[playerid][pName]);
    }
    return 1;
    }

  • stock 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 true;
    }