Waffen werden nicht gespeichert/geladen

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
  • Tag,


    wie im letzen Thread erwähnt schreib ich mein Script von Dini auf sqllite um,
    er speichert die waffen nicht (in der tabelle steht immer 0) und wen ich da was von hand eintrage, lädt er sie trotzdem nicht.

    stock LoadAccount(playerid)
    {
    new DBResult:Result, query[128],waffe[32],ammo[32];
    format(query, sizeof(query), "SELECT * FROM `Accounts` WHERE `Name` = '%s'",SpielerName(playerid));
    Result = db_query(Accounts,query);
    if(db_num_rows(Result) > 0)
    {
    db_get_field_assoc(Result,"Geld",query,sizeof(query));
    GivePlayerMoney(playerid,strval(query));
    db_get_field_assoc(Result,"Rang",query,sizeof(query));
    SetPVarInt(playerid,"Rang",strval(query));
    db_get_field_assoc(Result,"Banned",query,sizeof(query));
    SetPVarInt(playerid,"Banned",strval(query));
    db_get_field_assoc(Result,"Handy",query,sizeof(query));
    SetPVarInt(playerid,"Handy",strval(query));
    db_get_field_assoc(Result,"Skin",query,sizeof(query));
    SetPVarInt(playerid,"Skin",strval(query));
    db_get_field_assoc(Result,"Kaempferskin",query,sizeof(query));
    SetPVarInt(playerid,"Kämpferskin",strval(query));
    db_get_field_assoc(Result,"Jail",query,sizeof(query));
    SetPVarInt(playerid,"Jail",strval(query));
    db_get_field_assoc(Result,"JailTime",query,sizeof(query));
    SetPVarInt(playerid,"JailTime",strval(query));
    db_get_field_assoc(Result,"Chef",query,sizeof(query));
    SetPVarInt(playerid,"Chef",strval(query));
    db_get_field_assoc(Result,"GangChef",query,sizeof(query));
    SetPVarInt(playerid,"GangChef",strval(query));
    db_get_field_assoc(Result,"Hoehenmessgeraet",query,sizeof(query));
    SetPVarInt(playerid,"Höhenmessgerät",strval(query));
    db_get_field_assoc(Result,"Job",query,sizeof(query));
    SetPVarInt(playerid,"Job",strval(query));
    db_get_field_assoc(Result,"Gang",query,sizeof(query));
    SetPVarInt(playerid,"Gang",strval(query));
    db_get_field_assoc(Result,"TimeOut",query,sizeof(query));
    SetPVarInt(playerid,"TimeOut",strval(query));
    db_get_field_assoc(Result,"Leben",query,sizeof(query));
    SetPlayerHealth(playerid, floatstr(query));
    db_get_field_assoc(Result,"Ruestung",query,sizeof(query));
    SetPlayerArmour(playerid, floatstr(query));
    db_get_field_assoc(Result,"Wanted",query,sizeof(query));
    SetPlayerWantedLevel(playerid,strval(query));
    db_get_field_assoc(Result,"FightStyle",query,sizeof(query));
    SetPlayerFightingStyle(playerid,strval(query));
    db_get_field_assoc(Result,"TimeOutInteriorID",query,sizeof(query));
    SetPVarInt(playerid,"TimeOutInteriorID",strval(query));
    db_get_field_assoc(Result,"TimeOutWorldID",query,sizeof(query));
    SetPVarInt(playerid,"TimeOutWorldID",strval(query));
    db_get_field_assoc(Result,"TimeOutPosX",query,sizeof(query));
    SetPVarFloat(playerid,"TimeOutPosX",floatstr(query));
    db_get_field_assoc(Result,"TimeOutPosY",query,sizeof(query));
    SetPVarFloat(playerid,"TimeOutPosY",floatstr(query));
    db_get_field_assoc(Result,"TimeOutPosZ",query,sizeof(query));
    SetPVarFloat(playerid,"TimeOutPosZ",floatstr(query));
    db_get_field_assoc(Result,"TimeOutPosA",query,sizeof(query));
    SetPVarFloat(playerid,"TimeOutPosA",floatstr(query));
    for(new i;i<13;i++)
    {
    format(waffe,sizeof(waffe),"Waffe%s",i);
    db_get_field_assoc(Result,waffe,waffe,sizeof(waffe));
    format(ammo,sizeof(ammo),"Ammo%s",i);
    db_get_field_assoc(Result,ammo,ammo,sizeof(ammo));
    GivePlayerWeapon(playerid, strval(waffe),strval(ammo));
    }
    }
    db_free_result(Result);
    return 1;
    }
    stock SpielerSpeichern(playerid)
    {
    if(GetPVarInt(playerid,"loggedin")!=1) return 1;
    new str[512],str1[512],query[1024],Float:health, Float:ruestung,Waffen[13][2],str2[512];
    GetPlayerHealth(playerid,health);
    GetPlayerArmour(playerid,ruestung);
    format(str,sizeof(str),"UPDATE `Accounts` SET `Geld` = '%d', `Rang` = '%d', `Banned` = '%d',`Handy` = '%d', `Skin` = '%d', `Kaempferskin` = '%d', `Jail` = '%d',`JailTime` = '%d', `Chef` = '%d',`GangChef` = '%d',`Hoehenmessgeraet` = '%d',",
    GetPlayerMoney(playerid),GetPVarInt(playerid,"Rang"),GetPVarInt(playerid,"Banned"),GetPVarInt(playerid,"Handy"),GetPVarInt(playerid,"Skin"),GetPVarInt(playerid,"Kämpferskin"),GetPVarInt(playerid,"Jail"),GetPVarInt(playerid,"JailTime"),
    GetPVarInt(playerid,"Chef"),GetPVarInt(playerid,"GangChef"),GetPVarInt(playerid,"Höhenmessgerät"));
    format(str1,sizeof(str1), "`Job` = '%d',`Gang` = '%d',`TimeOut` = '%d',`Wanted` = '%d',`FightStyle` = '%d',`Leben` = '%f',`Ruestung` = '%f',`TimeOutInteriorID` = '%d',`TimeOutWorldID` = '%d',`TimeOutPosX` = '%f',`TimeOutPosY` = '%f',`TimeOutPosZ` = '%f',`TimeOutPosA` = '%f',",
    GetPVarInt(playerid,"Job"),GetPVarInt(playerid,"Gang"),GetPVarInt(playerid,"TimeOut"),GetPlayerWantedLevel(playerid),GetPlayerFightingStyle(playerid),
    health,ruestung,GetPVarInt(playerid,"TimeOutInteriorID"),GetPVarInt(playerid,"TimeOutWorldID"),GetPVarFloat(playerid,"TimeOutPosX"),GetPVarFloat(playerid,"TimeOutPosY"),GetPVarFloat(playerid,"TimeOutPosZ"),GetPVarFloat(playerid,"TimeOutPosA"));
    for(new i;i<13;i++)
    {
    GetPlayerWeaponData(playerid, i, Waffen[i][0],Waffen[i][1]);
    format(str2,sizeof(str2),"%s,´Waffe%d` = '%d', `Ammo%d` = '%d'",str2,i,Waffen[i][0],i,Waffen[i][1]);
    }
    format(query,sizeof(query),"%s%s%s WHERE `Name` = '%s'",str,str1,str2,SpielerName(playerid));
    db_query(Accounts,query);
    return 1;
    }


    //edit: habs mal beim speichern in der schleife printen lassen, steht 13 mall waffe0 ammo0

    Einmal editiert, zuletzt von firestormZ ()