Beiträge von Mathias1000

    moin ich habe nin Problem mit sscanf bekomme ne warnung ausgeben


    Code
    sscanf warning: Strings without a length are deprecated, please add a destination size.


    der Code
    dcmd_teleport(playerid,params[])
    {
    new Area_tele[64];
    if(PlayerInfo[playerid][pIsLogin] == false) return 1;
    if(PlayerInfo[playerid][AdminLevel] > 1)
    if(sscanf(params, "s",Area_tele)) {
    return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /teleport Locazion");
    }
    {
    new Float:pos_x_tele,Float:pos_y_tele,Float:pos_z_tele,Float:pos_r_tele;
    new AdminLevel_tele;
    format(teleportcoords,sizeof(teleportcoords),"SELECT * FROM `teleport_coords` WHERE `AreaName`= '%s' LIMIT 1;",Area_tele);
    mysql_query(teleportcoords);
    mysql_store_result();
    if(mysql_num_rows() == 1)
    {
    mysql_fetch_field("pos_x",teleportcoords); pos_x_tele = floatstr(teleportcoords);
    mysql_fetch_field("pos_y",teleportcoords); pos_y_tele = floatstr(teleportcoords);
    mysql_fetch_field("pos_z",teleportcoords); pos_z_tele = floatstr(teleportcoords);
    mysql_fetch_field("AdminLevel",teleportcoords); AdminLevel_tele = strval(teleportcoords);
    }
    if(AdminLevel_tele < PlayerInfo[playerid][AdminLevel])
    {
    SetPlayerPos(playerid,pos_x_tele,pos_y_tele,pos_z_tele);
    return 1;
    }
    if(mysql_num_rows() == 0)
    {
    SendClientMessage(playerid,COLOR_WHITE,"teleport Areaname not found");
    }
    mysql_free_result();
    return 1;
    }
    }


    ich habe mich schon Umgesehen etc auch in den tuts hier gegugt aber vll finded jmd ja mein Fehler
    oder ich mache was grundlegendes Falsch
    das Command selber funzt aber das Probs ist der server Crasht gerne ab und an bei dem Command auch Bei Ähnlichen Commands ohne mysql


    Were für Hilfe dankbar :)

    Hallo,
    ich habe folgende Problem wenn ich diesen Führerschein Script Ausführe und zwar z.b 10 mal hinternander aus einen Fahrzeug ein und aus steige crasht der Server vll weis Jemand warum


    new scheinsql[300],resultlinee[300], selctsql[280],resultline[300];
    new type,Autoschein,Flugschein,Bootschein,Lastwagenschein,Motorradschein;
    new vehicleid = GetPlayerVehicleID(playerid);
    new modelid = GetVehicleModel(vehicleid);
    format(scheinsql,sizeof(scheinsql),"SELECT Autoschein,Flugschein,Bootschein,Lastwagenschein,Motorradschein FROM `players` WHERE `Name`= '%s' LIMIT 1;",oGetPlayerName(playerid));
    mysql_query(scheinsql); mysql_store_result();
    if(mysql_fetch_row(resultlinee))
    {
    mysql_fetch_field("Autoschein",scheinsql); Autoschein = strval(scheinsql);
    mysql_fetch_field("Flugschein",scheinsql); Flugschein = strval(scheinsql);
    mysql_fetch_field("Bootschein",scheinsql); Bootschein = strval(scheinsql);
    mysql_fetch_field("Lastwagenschein",scheinsql); Lastwagenschein = strval(scheinsql);
    mysql_fetch_field("Motorradschein",scheinsql); Motorradschein = strval(scheinsql);
    }



    format(selctsql,sizeof(selctsql),"SELECT type FROM `vehicles` WHERE `modelid`= '%s' LIMIT 1;",modelid);
    mysql_query(selctsql); mysql_store_result();
    if(mysql_fetch_row(resultline))
    {
    mysql_fetch_field("type",selctsql); type = strval(selctsql);
    }



    {
    if(type == 1 && Autoschein == 0)
    {
    SendClientMessage(playerid,COLOR_WHITE,"Du hast keinen Autoschein");
    RemovePlayerFromVehicle(playerid);
    }
    else if(type == 2 && Bootschein == 0)
    {
    SendClientMessage(playerid,COLOR_WHITE,"Du hast kein Bootschein");
    RemovePlayerFromVehicle(playerid);
    }
    else if(type == 3 && Flugschein == 0)
    {
    SendClientMessage(playerid,COLOR_WHITE,"Du hast kein Flugschein");
    RemovePlayerFromVehicle(playerid);
    }
    else if(type == 4 && Lastwagenschein == 0)
    {
    SendClientMessage(playerid,COLOR_WHITE,"Du hast kein Lastwagenschein");
    RemovePlayerFromVehicle(playerid);
    }
    else if(type == 5 && Motorradschein == 0)
    {
    SendClientMessage(playerid,COLOR_WHITE,"Du hast kein Motorradschein");
    RemovePlayerFromVehicle(playerid);
    }
    }

    der fehler steht doch da im groben die variable auto würde nicht defeniert heist auf gut deutsch du müst die varable definiren wo haste die varablae den defeniert weil denke sonst würdest du net versuchen zu verwenden
    ansonsten versuch es mit


    Pawn-Quelltext
    dcmd_gebeschein(playerid,params[])
    {
    new pID,schein[64],string[128];
    new auto;
    if(sscanf(params, "us", pID,schein))
    {
    SendClientMessage(playerid,COLOR_RED,"Benutzung: /gebeschein [playerid] [schein]");
    SendClientMessage(playerid,COLOR_RED,"Verfügbare Scheine: auto");
    }
    if(!IsPlayerConnected(pID)) { return SendClientMessage(playerid, COLOR_RED,"Kein Spieler mit angegebener ID Online!"); }
    if(Player[playerid][Team] == 2)
    {
    if(schein == auto)
    {
    GetPlayerName(playerid, sendername, sizeof(sendername));
    GetPlayerName(pID, giveplayer, sizeof(giveplayer));
    format(string, sizeof(string), "* Du hast %s einen Führerschein gegeben!",giveplayer);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "* Fahrlehrer %s hat dir einen Führerschein gegeben!",sendername);
    SendClientMessage(pID, COLOR_LIGHTBLUE, string);
    }
    else
    {
    SendClientMessage(playerid, COLOR_RED,"Du bist kein Fahrlehrer!");
    }
    }
    return 1;
    }


    aber der teil ist eigendlich auch sein frei weil den dei varibale auto immer 0 enthalt und daher die if abfrage mitn auto sinlos ist also brauchten wir noch den anderen code wo du die variable auto definierst

    hier nim meinen

    stock Loadvehicles()
    {
    new strFromDb[256];


    new modelid;
    new Float:pos_x, Float:pos_y, Float:pos_z, pos_r;
    new z[128];
    new color1,color2;
    format(z,sizeof(z),"SELECT COUNT(*) FROM vehicles");
    mysql_query(z);
    mysql_store_result();
    mysql_fetch_row(strFromDb);
    new SizeOfVeh = strval(strFromDb);
    for(new i = 0; i < SizeOfVeh; i++)
    {
    new obsql[128],resultline[64];
    format(obsql,sizeof(obsql),"SELECT * FROM vehicles LIMIT %d, 1", i);
    mysql_query(obsql); mysql_store_result();
    if(mysql_fetch_row(resultline))
    {
    mysql_fetch_field("modelid",obsql); modelid = strval(obsql);
    mysql_fetch_field("pos_x",obsql); pos_x = floatstr(obsql);
    mysql_fetch_field("pos_y",obsql); pos_y = floatstr(obsql);
    mysql_fetch_field("pos_z",obsql); pos_z = floatstr(obsql);
    mysql_fetch_field("color1",obsql); color1 = strval(obsql);
    mysql_fetch_field("color2",obsql); color2 = strval(obsql);

    }
    if (mysql_num_rows() > 0)
    {
    CreateVehicle(modelid,pos_x,pos_y,pos_z,pos_r,color1,color2, -1);
    printf("creating vehicles %d %f %f %f %f %d %d ",modelid,pos_x,pos_y,pos_z,pos_r,color1,color2);
    }
    }
    }
    [
    müste dir halt noch anpassen aber sonst ist er soweit ok und bei mir komen auch keine erors

    hallo ich habe hier ma meinen code für waffen laden und spawn ich peronlich finde den bisel blöd und wollte wissen obs noch ne andere lösung gibt vom code her mir ist einfach nixe mehr eingefallen weiter auser diese lösung,


    laden
    public OnPlayerSpawn(playerid)
    {
    new obsql[128],resultline[64];
    new player_weapon1, player_weapon1_ammo, player_weapon2, player_weapon2_ammo, player_weapon3, player_weapon3_ammo;
    new player_weapon4, player_weapon4_ammo, player_weapon5, player_weapon5_ammo, player_weapon6, player_weapon6_ammo;
    new player_weapon7, player_weapon7_ammo, player_weapon8, player_weapon8_ammo, player_weapon9, player_weapon9_ammo;
    new player_weapon10, player_weapon10_ammo, player_weapon11, player_weapon11_ammo, player_weapon12, player_weapon12_ammo,player_weapon13, player_weapon13_ammo;
    format(obsql,sizeof(obsql),"SELECT * FROM `players` WHERE `Name`= '%s'",oGetPlayerName(playerid));
    mysql_query(obsql); mysql_store_result();
    if(mysql_fetch_row(resultline))
    {
    mysql_fetch_field("weapon1",obsql); player_weapon1 = strval(obsql);
    mysql_fetch_field("weapon1_ammo",obsql); player_weapon1_ammo = strval(obsql);
    mysql_fetch_field("weapon2",obsql); player_weapon2 = strval(obsql);
    mysql_fetch_field("weapon2_ammo",obsql); player_weapon2_ammo = strval(obsql);
    mysql_fetch_field("weapon3",obsql); player_weapon3 = strval(obsql);
    mysql_fetch_field("weapon3_ammo",obsql); player_weapon3_ammo = strval(obsql);
    mysql_fetch_field("weapon4",obsql); player_weapon4 = strval(obsql);
    mysql_fetch_field("weapon4_ammo",obsql); player_weapon4_ammo = strval(obsql);
    mysql_fetch_field("weapon5",obsql); player_weapon5 = strval(obsql);
    mysql_fetch_field("weapon5_ammo",obsql); player_weapon5_ammo = strval(obsql);
    mysql_fetch_field("weapon6",obsql); player_weapon6 = strval(obsql);
    mysql_fetch_field("weapon6_ammo",obsql); player_weapon6_ammo = strval(obsql);
    mysql_fetch_field("weapon7",obsql); player_weapon7 = strval(obsql);
    mysql_fetch_field("weapon7_ammo",obsql); player_weapon7_ammo = strval(obsql);
    mysql_fetch_field("weapon8",obsql); player_weapon8 = strval(obsql);
    mysql_fetch_field("weapon8_ammo",obsql); player_weapon8_ammo = strval(obsql);
    mysql_fetch_field("weapon9",obsql); player_weapon9 = strval(obsql);
    mysql_fetch_field("weapon9_ammo",obsql); player_weapon9_ammo = strval(obsql);
    mysql_fetch_field("weapon10",obsql); player_weapon10 = strval(obsql);
    mysql_fetch_field("weapon10_ammo",obsql); player_weapon10_ammo = strval(obsql);
    mysql_fetch_field("weapon11",obsql); player_weapon11 = strval(obsql);
    mysql_fetch_field("weapon11_ammo",obsql); player_weapon11_ammo = strval(obsql);
    mysql_fetch_field("weapon12",obsql); player_weapon12 = strval(obsql);
    mysql_fetch_field("weapon12_ammo",obsql); player_weapon12_ammo = strval(obsql);
    mysql_fetch_field("weapon13",obsql); player_weapon13 = strval(obsql);
    mysql_fetch_field("weapon13_ammo",obsql); player_weapon13_ammo = strval(obsql);
    }
    if(MySQL_Player_Exist(playerid) == 1)
    {
    GivePlayerWeapon(playerid, player_weapon1, player_weapon1_ammo);
    GivePlayerWeapon(playerid, player_weapon2, player_weapon2_ammo);
    GivePlayerWeapon(playerid, player_weapon3, player_weapon3_ammo);
    GivePlayerWeapon(playerid, player_weapon4, player_weapon4_ammo);
    GivePlayerWeapon(playerid, player_weapon5, player_weapon5_ammo);
    GivePlayerWeapon(playerid, player_weapon6, player_weapon6_ammo);
    GivePlayerWeapon(playerid, player_weapon7, player_weapon7_ammo);
    GivePlayerWeapon(playerid, player_weapon8, player_weapon8_ammo);
    GivePlayerWeapon(playerid, player_weapon9, player_weapon9_ammo);
    GivePlayerWeapon(playerid, player_weapon10, player_weapon10_ammo);
    GivePlayerWeapon(playerid, player_weapon11, player_weapon11_ammo);
    GivePlayerWeapon(playerid, player_weapon12, player_weapon12_ammo);
    GivePlayerWeapon(playerid, player_weapon13, player_weapon13_ammo);
    }
    return 1;
    }


    speichern

    stock Player_save_Data(playerid)
    {


    new waffe1,waffe2,waffe3,waffe4,waffe5,waffe6,waffe7,waffe8,waffe9,waffe10,waffe11,waffe12,waffe13;
    new ammo1,ammo2,ammo3,ammo4,ammo5,ammo6,ammo7,ammo8,ammo9,ammo10,ammo11,ammo12,ammo13;
    GetPlayerWeaponData(playerid,1,waffe1,ammo1);
    GetPlayerWeaponData(playerid,2,waffe2,ammo2);
    GetPlayerWeaponData(playerid,3,waffe3,ammo3);
    GetPlayerWeaponData(playerid,4,waffe4,ammo4);
    GetPlayerWeaponData(playerid,5,waffe5,ammo5);
    GetPlayerWeaponData(playerid,6,waffe6,ammo6);
    GetPlayerWeaponData(playerid,7,waffe7,ammo7);
    GetPlayerWeaponData(playerid,8,waffe8,ammo8);
    GetPlayerWeaponData(playerid,9,waffe9,ammo9);
    GetPlayerWeaponData(playerid,10,waffe10,ammo10);
    GetPlayerWeaponData(playerid,11,waffe11,ammo11);
    GetPlayerWeaponData(playerid,12,waffe12,ammo12);
    GetPlayerWeaponData(playerid,13,waffe13,ammo13);
    new src[MAX_STRING];
    format(query,sizeof(query),"UPDATE `"PlayerTable"` SET ");
    format(src,sizeof(src),"`weapon1`=%d,",waffe1);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon1_ammo`=%d,",ammo1);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon2`=%d,",waffe2);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon2_ammo`=%d,",ammo2);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon3`=%d,",waffe3);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon3_ammo`=%d,",ammo3);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon4`=%d,",waffe4);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon4_ammo`=%d,",ammo4);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon5`=%d,",waffe5);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon5_ammo`=%d,",ammo5);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon6`=%d,",waffe6);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon6_ammo`=%d,",ammo6);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon7`=%d,",waffe7);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon7_ammo`=%d,",ammo7);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon8`=%d,",waffe8);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon8_ammo`=%d,",ammo8);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon9`=%d,",waffe9);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon9_ammo`=%d,",ammo9);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon10`=%d,",waffe10);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon10_ammo`=%d,",ammo10);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon11`=%d,",waffe11);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon11_ammo`=%d,",ammo11);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon12`=%d,",waffe12);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon12_ammo`=%d,",ammo12);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon13`=%d,",waffe1);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src),"`weapon13_ammo`=%d",ammo13);
    strcat(query,src,sizeof(query));
    format(src,sizeof(src)," WHERE `Name`='%s'",oGetPlayerName(playerid));
    strcat(query,src,sizeof(query));
    samp_mysql_query(query);
    }

    danke noch ma müss leider noma von vorne anfangen bzw mein ganzen coden umtexten weil ich schon angefangen habe aber das plugin von StrickenKid hat komplett besere perfomance als das was ich jeze verwende

    hallo ich wollte ma fragen welches mysql plugin recht gut sit habe jeze schon paar ausgeprobst bei dem einen hangt ab ner bestimten qeury zahl die abfrage aus ner tabelle ich wollte meine gesamte gamemode in mysql machen also auto spawn playerclass object registrierung etc also wollte ich jeze wissen welches mysql plugin dafür ausgelegt ist bzw welches am besten dafür geignet ist

    habe den code jeze so


    stock Loadobject()
    {
    new strFromDb[256];


    new modelid;
    new Float:pos_ox, Float:pos_oy, Float:pos_oz,Float:pos_rx, Float:pos_ry, Float:pos_rz;
    new z[128];
    format(z,sizeof(z),"SELECT COUNT(*) FROM object");
    mysql_query(z);
    mysql_store_result();
    mysql_fetch_row_format(strFromDb);
    new SizeOfVeh = strval(strFromDb);
    for(new i = 0; i < SizeOfVeh; i++)
    {
    new interior;
    new obsql[128],resultline[64];
    format(obsql,sizeof(obsql),"SELECT * FROM object LIMIT %d, 1", i);
    mysql_query(obsql); mysql_store_result();
    if(mysql_fetch_row_format(resultline))
    {
    mysql_fetch_field_row(obsql,"modelid"); modelid = strval(obsql);
    mysql_fetch_field_row(obsql,"pos_x"); pos_ox = floatstr(obsql);
    mysql_fetch_field_row(obsql,"pos_y"); pos_oy = floatstr(obsql);
    mysql_fetch_field_row(obsql,"pos_z"); pos_oz = floatstr(obsql);
    mysql_fetch_field_row(obsql,"pos_rx"); pos_rx = floatstr(obsql);
    mysql_fetch_field_row(obsql,"pos_ry"); pos_ry = floatstr(obsql);
    mysql_fetch_field_row(obsql,"pos_rz"); pos_rz = floatstr(obsql);

    }
    if (mysql_num_rows() > 0)
    {
    CreateObject(modelid,pos_ox,pos_oy,pos_oz,pos_rx,pos_ry,pos_rz);
    printf("Model %d pos_x %f pos_y %f pos_z %f pos_rx %f pos_ry %f pos_rz interior %f ",modelid,pos_ox,pos_oy,pos_oz,pos_rx,pos_ry,pos_rz);
    }
    }
    }
    aber wenn ich mich jeze einlogen will crasht der client
    müste doch so richtig sein oder?

    hallo ich finde den fehler net warum mein object system net geht were dankbar wenn jmd ma rüber gugt :)
    die spawn sind ingame net vorhanden
    hier der code


    stock Loadobject()
    {
    new strFromDb[256];


    new modelid;
    new Float:pos_ox, Float:pos_oy, Float:pos_oz,Float:pos_rx, Float:pos_ry, Float:pos_rz;
    new z[128];
    format(z,sizeof(z),"SELECT COUNT(*) FROM object");
    mysql_query(z);
    mysql_store_result();
    mysql_fetch_row_format(strFromDb);
    new SizeOfVeh = strval(strFromDb);
    for(new i = 0; i < SizeOfVeh; i++)
    {
    new obsql[128],resultline[64];
    format(obsql,sizeof(obsql),"SELECT * FROM object LIMIT %d, 1", i);
    mysql_query(obsql); mysql_store_result();
    if(mysql_fetch_row_format(resultline))
    {
    mysql_fetch_field_row(obsql,"modelid"); modelid = strval(obsql);
    mysql_fetch_field_row(obsql,"pos_x"); pos_ox = strval(obsql);
    mysql_fetch_field_row(obsql,"pos_y"); pos_oy = strval(obsql);
    mysql_fetch_field_row(obsql,"pos_z"); pos_oz = strval(obsql);
    mysql_fetch_field_row(obsql,"pos_rx"); pos_rx = strval(obsql);
    mysql_fetch_field_row(obsql,"pos_ry"); pos_ry = strval(obsql);
    mysql_fetch_field_row(obsql,"pos_rz"); pos_rz = strval(obsql);
    }
    if (mysql_num_rows() > 0)
    {
    CreateObject(modelid,pos_ox,pos_oy,pos_oz,pos_rx,pos_ry,pos_rz);
    printf("Model %d pos_x %f pos_y %f pos_z %f pos_rx %f pos_ry %f pos_rz ",modelid,pos_ox,pos_oy,pos_oz,pos_rx,pos_ry,pos_rz);
    }
    }
    return 1;
    }



    und sql