Beiträge von Deadmau5

    Weil kein fc++ eingebaut ist ^^



    stock LoadFrakCars()
    {
    new fc;
    while(fc<50)
    {
    FrakCarInfo[fc][Model] = mysql_GetInt("vehicles", "Model", "id", "1");
    FrakCarInfo[fc][x] = mysql_GetFloat("vehicles", "x", "id", "1");
    FrakCarInfo[fc][y] = mysql_GetFloat("vehicles", "y", "id", "1");
    FrakCarInfo[fc][z] = mysql_GetFloat("vehicles", "z", "id", "1");
    FrakCarInfo[fc][a] = mysql_GetFloat("Vehicles", "a", "id", "1");
    FrakCarInfo[fc][Color1] = mysql_GetInt("vehicles", "Color1", "id", "1");
    FrakCarInfo[fc][Color2] = mysql_GetInt("vehicles", "Color2", "id", "1");
    if(FrakCarInfo[fc][Model] >= 400 && FrakCarInfo[fc][Model] <= 611)
    {
    FrakCarInfo[fc][CarID] = AddStaticVehicleEx(FrakCarInfo[fc][Model], FrakCarInfo[fc][x], FrakCarInfo[fc][y], FrakCarInfo[fc][z], FrakCarInfo[fc][a], FrakCarInfo[fc][Color1], FrakCarInfo[fc][Color2], -1);
    }
    fc++;
    }
    return 1;
    }

    public OnPlayerUpdate(playerid)
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    vID = GetPlayerVehicleID(playerid);
    GetVehicleHealth(vID, vHP);


    new str2[128];
    format(str2, sizeof(str2), "%d", floatround(((vHP - 250) * 100) / 750));
    TextDrawSetString(speedo_hp[playerid], str2);
    format(str2, sizeof(str2), "%d", GetVehSpeed(vID));
    TextDrawSetString(speedo_vel[playerid], str2);
    return 1;
    }
    return 1;
    }

    Joa ^^
    Kurz und knackig: Mir werden nur die Prints 1 und 6 angezeigt...



    dcmd_efa(playerid,params[])
    {
    if(GetPlayerAdminLevel(playerid) >= 1338)
    {
    new model,farbe1,farbe2,fraktion;
    new Float:xHia,Float:yHia,Float:zHia,Float:aHia;
    GetPlayerPos(playerid,xHia,yHia,zHia);
    GetPlayerFacingAngle(playerid,zHia);
    if(sscanf(params,"dddd",model,farbe1,farbe2,fraktion)) SendClientMessage(playerid,0xFF0000FF,"/efa [ModelID] [Farbe 1] [Farbe 2] [Fraktion]");
    else
    {
    if(model >= 400 && model <= 611)
    {
    if(farbe1 >= 0 && farbe1 <= 128)
    {
    if(farbe2 >= 0 && farbe2 <= 128)
    {
    if(fraktion >= 1 && fraktion <= 20)
    {
    print("fCarErstellen1");
    new fc=0,Query[1024];
    while(fc<sizeof(fCars))
    {
    if(fCars[fc][fModel] < 400 || fCars[fc][fModel] > 611)
    {
    print("fCarErstellen2");
    fCars[fc][fModel] = model;
    fCars[fc][fPosX] = xHia;
    fCars[fc][fPosY] = yHia;
    fCars[fc][fPosZ] = zHia;
    fCars[fc][fPosA] = aHia;
    fCars[fc][fCol1] = farbe1;
    fCars[fc][fCol1] = farbe2;
    fCars[fc][fFraktion] = fraktion;
    print("fCarErstellen3");
    format(Query,sizeof(Query),"INSERT INTO `fcars` (`id`,`Model`,`PosX`,`PosY`,`PosZ`,`PosA`,`Farbe_1`,`Farbe_2`,`Fraktion`) VALUES ('%d','%d','%f','%f','%f','%f','%d','%d','%d')",
    fc,
    fCars[fc][fModel],
    fCars[fc][fPosX],
    fCars[fc][fPosY],
    fCars[fc][fPosZ],
    fCars[fc][fPosA],
    fCars[fc][fCol1],
    fCars[fc][fCol2],
    fCars[fc][fFraktion]);
    mysql_query(Query);
    print("fCarErstellen4");
    fCars[fc][fCarId] = CreateVehicle(fCars[fc][fModel],fCars[fc][fPosX],fCars[fc][fPosY],fCars[fc][fPosZ],fCars[fc][fPosA],fCars[fc][fCol1],fCars[fc][fCol2],-1);


    Tank[fCars[fc][fCarId]] = MaxTank[fCars[fc][fModel]];


    SendClientMessage(playerid,0xFF0000FF,"Fraktionsfahrzeug erstellt!");
    SendClientMessage(playerid,0xFF0000FF,"Made by Deadmau5 :)");
    print("fCarErstellen5");
    break;
    }
    fc++;
    }
    print("fCarErstellen6");
    }
    else SendClientMessage(playerid,0xFF0000FF,"Fraktion nur zwischen 1 und 20!");
    }
    else SendClientMessage(playerid,0xFF0000FF,"Farbe 2 nur zwischen 0 und 128!");
    }
    else SendClientMessage(playerid,0xFF0000FF,"Farbe 1 nur zwischen 0 und 128!");
    }
    else SendClientMessage(playerid,0xFF0000FF,"ModelID nur zwischen 400 und 611!");
    }
    }
    else SendClientMessage(playerid,0xFF0000FF,"Du darfst das nicht!");
    return 1;
    }


    Grüße, Mau5 :D


    //EDIT: Befehl ausgebessert...
    Komischerweise schreibt er ja die Cars in die Tabelle, erstellen tut er sie jedoch nicht -.-

    Yea, geil gescriptet...


    Mein Server friert ein, sobald ich mehrere MySQL Sachen lade :D
    z.B. Fraktionskassen + Gangzonen...


    Hier die beiden publics



    public LoadFightzonesSQL()
    {
    new fs,Query[1024];
    while(fs<sizeof(FightSystem))
    {
    format(Query,1024,"SELECT * FROM `gangzones` WHERE `id`='%d'",fs);
    mysql_query(Query);
    mysql_store_result();
    if(mysql_num_rows() > 0)
    {
    mysql_fetch_field("Besitzer",Query); FightSystem[fs][OwnerFaction] = strval(Query);

    FightSystem[fs][ZoneID] = GangZoneCreate(FightSystem[fs][gfMinX],FightSystem[fs][gfMinY],FightSystem[fs][gfMaxX],FightSystem[fs][gfMaxY]);
    }
    break;
    }
    mysql_free_result();

    GangFight = TextDrawCreate(88.000000,244.000000,"Gangfight:~n~_~n~_~n~_~n~_~n~_");
    TextDrawUseBox(GangFight,1);
    TextDrawBoxColor(GangFight,0x00000066);
    TextDrawTextSize(GangFight,102.000000,124.000000);
    TextDrawAlignment(GangFight,2);
    TextDrawBackgroundColor(GangFight,0xff000033);
    TextDrawFont(GangFight,2);
    TextDrawLetterSize(GangFight,0.499999,1.000000);
    TextDrawColor(GangFight,0xffffffff);
    TextDrawSetOutline(GangFight,1);
    TextDrawSetProportional(GangFight,1);
    GangFightUnderline = TextDrawCreate(91.000000,274.000000,".");
    TextDrawAlignment(GangFightUnderline,2);
    TextDrawBackgroundColor(GangFightUnderline,0x000000ff);
    TextDrawFont(GangFightUnderline,3);
    TextDrawLetterSize(GangFightUnderline,14.799997,1.000000);
    TextDrawColor(GangFightUnderline,0xffffffff);
    TextDrawSetProportional(GangFightUnderline,1);
    TextDrawSetShadow(GangFightUnderline,1);
    while(fs < sizeof(FightSystem))
    {
    FightSystem[fs][WinFaction] = TextDrawCreate(26.000000,256.000000," ");
    TextDrawSetProportional(FightSystem[fs][WinFaction],1);
    TextDrawAlignment(FightSystem[fs][WinFaction],0);
    TextDrawBackgroundColor(FightSystem[fs][WinFaction],0x000000ff);
    TextDrawFont(FightSystem[fs][WinFaction],2);
    TextDrawLetterSize(FightSystem[fs][WinFaction],0.199999,1.000000);
    TextDrawColor(FightSystem[fs][WinFaction],0xffffffff);
    TextDrawSetOutline(FightSystem[fs][WinFaction],1);
    FightSystem[fs][LoseFaction] = TextDrawCreate(26.000000,267.000000," ");
    TextDrawSetProportional(FightSystem[fs][LoseFaction],1);
    TextDrawSetOutline(FightSystem[fs][LoseFaction],1);
    TextDrawColor(FightSystem[fs][LoseFaction],0xffffffff);
    TextDrawFont(FightSystem[fs][LoseFaction],2);
    TextDrawLetterSize(FightSystem[fs][LoseFaction],0.199999,0.899999);
    TextDrawBackgroundColor(FightSystem[fs][LoseFaction],0x000000ff);
    TextDrawAlignment(FightSystem[fs][LoseFaction],0);
    FightSystem[fs][WinKills] = TextDrawCreate(107.000000,256.000000," ");
    TextDrawSetProportional(FightSystem[fs][WinKills],1);
    TextDrawSetOutline(FightSystem[fs][WinKills],1);
    TextDrawColor(FightSystem[fs][WinKills],0xffffffff);
    TextDrawSetShadow(FightSystem[fs][WinKills],1);
    TextDrawFont(FightSystem[fs][WinKills],2);
    TextDrawLetterSize(FightSystem[fs][WinKills],0.199999,1.000000);
    TextDrawBackgroundColor(FightSystem[fs][WinKills],0x000000ff);
    TextDrawAlignment(FightSystem[fs][WinKills],0);
    FightSystem[fs][LoseKills] = TextDrawCreate(107.000000,267.000000," ");
    TextDrawSetProportional(FightSystem[fs][LoseKills],1);
    TextDrawSetShadow(FightSystem[fs][LoseKills],1);
    TextDrawSetOutline(FightSystem[fs][LoseKills],1);
    TextDrawColor(FightSystem[fs][LoseKills],0xffffffff);
    TextDrawFont(FightSystem[fs][LoseKills],2);
    TextDrawLetterSize(FightSystem[fs][LoseKills],0.199999,1.000000);
    TextDrawBackgroundColor(FightSystem[fs][LoseKills],0x000000ff);
    TextDrawAlignment(FightSystem[fs][LoseKills],0);
    FightSystem[fs][fsTime] = TextDrawCreate(26.000000,286.000000," ");
    TextDrawColor(FightSystem[fs][fsTime],0xffffffff);
    TextDrawAlignment(FightSystem[fs][fsTime],0);
    TextDrawBackgroundColor(FightSystem[fs][fsTime],0x000000ff);
    TextDrawFont(FightSystem[fs][fsTime],2);
    TextDrawLetterSize(FightSystem[fs][fsTime],0.199999,0.899999);
    TextDrawSetProportional(FightSystem[fs][fsTime],1);
    fs++;
    }
    return 1;
    }




    forward LoadFraktionsKassenSQL();
    public LoadFraktionsKassenSQL()
    {
    new idx,Query[1024];
    while(idx<sizeof(FraktionsKasse))
    {
    format(Query,1024,"SELECT * FROM `fraktionskassen` WHERE `Fraktion`='%d'",idx);
    mysql_query(Query);
    mysql_store_result();
    if(mysql_num_rows() > 0)
    {
    mysql_fetch_field("Geld",Query); FraktionsKasse[idx] = strval(Query);
    }
    }
    mysql_free_result();
    return 1;
    }

    Oben in dem Enum hab ich mal gemacht, dass du bis zu 50 Cars erstellen kannst, sofern du einen erstellen Befehl oder in der MySQL Tabelle die Fahrzeuge hast...


    Bei dem Stock hab ich ein wenig Mist gebaut :D


    Einfach das while(fc<10) zu deiner Fahrzeugzahl aus dem enum ändern, in diesem Fall 50 while(fc<50)


    enum FrakCars
    {
    Fraktion,
    Model,
    Float:x,
    Float:y,
    Float:z,
    Float:a,
    Color1,
    Color2,
    CarID,
    }
    new FrakCarInfo[50][FrakCars];



    stock LoadFrakCars()
    {
    new fc;
    while(fc<10)
    {
    FrakCarInfo[fc][Model] = mysql_GetInt("vehicles", "Model", "id", "1");
    FrakCarInfo[fc][x] = mysql_GetFloat("vehicles", "x", "id", "1");
    FrakCarInfo[fc][y] = mysql_GetFloat("vehicles", "y", "id", "1");
    FrakCarInfo[fc][z] = mysql_GetFloat("vehicles", "z", "id", "1");
    FrakCarInfo[fc][a] = mysql_GetFloat("Vehicles", "a", "id", "1");
    FrakCarInfo[fc][Color1] = mysql_GetInt("vehicles", "Color1", "id", "1");
    FrakCarInfo[fc][Color2] = mysql_GetInt("vehicles", "Color2", "id", "1");
    if(FrakCarInfo[fc][Model] >= 400 && FrakCarInfo[fc][Model] <= 611)
    {
    FrakCarInfo[fc][CarID] = AddStaticVehicleEx(FrakCarInfo[fc][Model], FrakCarInfo[fc][x], FrakCarInfo[fc][y], FrakCarInfo[fc][z], FrakCarInfo[fc][a], FrakCarInfo[fc][Color1], FrakCarInfo[fc][Color2], -1);
    }
    }
    return 1;
    }


    ocmd:gov(playerid,params[])
    {
    new t[128];
    if(sscanf(params,"s",t)){return SendClientMessage (playerid,ROT,"Benutz: /gov [text]");}
    format(t, sizeof(t), "(( %s: %s ))", SpielerName(playerid), t);
    SendClientMessageToAll(0x00D7FFFF, t);
    if(GetPVarInt(playerid,"Fraktion") != 1 || GetPVarInt(playerid,"Fraktion") != 2) return SendClientMessage (playerid,ROT,"Dazu bist du nicht Berechtigt.");
    if(GetPVarInt(playerid,"Rang") <= 8) return SendClientMessage (playerid,ROT,"Dazu brauchst du Rang 9.");
    SendClientMessageToAll(0x00D7FFFF, t);
    return 1;
    }

    kA obs so geht, aber auf jeden Fall hat was mit der SSCANF Zeile nicht gestimmt ^^