Beiträge von Teddybaer

    Dann machst du am besten bei Onplayerkey


    eine Abfrage, z.B beim F oder Schlagen ob er handschellen trägt und dann Freezen und sofort wieder entfreezen... Handschellen auf den rücken:


    SetPlayerSpecialAction(pID, SPECIAL_ACTION_CUFFED);

    Hallo Community,


    ich bräuchte nunmal hilfe... ich bin neu beim lernen von MySQL, deshalb frage ich nun hier mal nach...


    ich habe ein DTC Autohaussystem und nun möchte ich das in MySQL umschreiben! Nur ich weiss nicht wie, bei den Usern war das irgendwie leichter


    Code:


    forward OnPlayerBuyCar(playerid,ModelA,autoo);
    public OnPlayerBuyCar(playerid,ModelA,autoo)//CARSYS
    {
    if(IsPlayerConnected(playerid) && !hatspielercar[playerid][Dtc_PlayerKey[playerid]])
    {
    SendClientMessage(playerid, Blau, "*Du hast dir ein Auto gekauft. Du kriegst für den anfang 10 Liter in dein Fahrzeug!");
    PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
    SetParkPlatz(playerid,autoo);
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof name);
    format(str, sizeof str, "/Autos/%s%d.dtcar", name,Dtc_PlayerKey[playerid]);
    new File: hFile = fopen(str, io_write);
    for(new i = 0; i < sizeof(BuyCars);i++)
    {
    if(GetPlayerVehicleID(playerid) == KaufAutos[i])
    {
    if (hFile)
    {
    new var[32];
    format(var, 32, "CarId=0\n");fwrite(hFile, var);
    format(var, 32, "CarModel=%d\n",ModelA);fwrite(hFile, var);
    format(var, 32, "CarPos_x=%.3f\n",PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_x]);fwrite(hFile, var);
    format(var, 32, "CarPos_y=%.3f\n",PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_y]);fwrite(hFile, var);
    format(var, 32, "CarPos_z=%.3f\n",PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarPos_z]);fwrite(hFile, var);
    format(var, 32, "CarRotate=%.3f\n",PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarRotate]);fwrite(hFile, var);
    format(var, 32, "CarNitro=0\n");fwrite(hFile, var);
    format(var, 32, "CarHyd=0\n");fwrite(hFile, var);
    format(var, 32, "CarWheel=0\n");fwrite(hFile, var);
    format(var, 32, "CarAusp=0\n");fwrite(hFile, var);
    format(var, 32, "CarSideL=0\n");fwrite(hFile, var);
    format(var, 32, "CarSideR=0\n");fwrite(hFile, var);
    format(var, 32, "CarFB=0\n");fwrite(hFile, var);
    format(var, 32, "CarRB=0\n");fwrite(hFile, var);
    format(var, 32, "CarSpoiler=0\n");fwrite(hFile, var);
    format(var, 32, "CarRoof=0\n");fwrite(hFile, var);
    format(var, 32, "CarHood=0\n");fwrite(hFile, var);
    format(var, 32, "CarVents=0\n");fwrite(hFile, var);
    format(var, 32, "CarLamps=0\n");fwrite(hFile, var);
    format(var, 32, "CarPJ=-1\n");fwrite(hFile, var);
    format(var, 32, "CarC1=-1\n");fwrite(hFile, var);
    format(var, 32, "CarC2=-1\n");fwrite(hFile, var);
    format(var, 32, "Preis=%d\n",BuyCars[i][dtc_CarPreis]);fwrite(hFile, var);
    format(var, 32, "CarSperre=0\n");fwrite(hFile, var);
    format(var, 32, "Plate=%s\n",name);fwrite(hFile, var);//Plate=XXX\n
    format(var, 32, "CarTank=22\n");fwrite(hFile, var);
    format(var, 32, "CarHp=1000.00\n");fwrite(hFile, var);
    format(var, 32, "CarPreisk=%d\n",BuyCars[i][RepPreis]);fwrite(hFile, var);

    fclose(hFile);
    }
    }
    }
    OnPlayerCarLogin(playerid);
    }
    }
    forward OnPlayerCarLogin(playerid);
    public OnPlayerCarLogin(playerid)
    {
    for(new x = 0; x < MaxVeh; x++)
    {
    if(!hatspielercar[playerid][x])
    {
    new string2[128];
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    format(string2, sizeof(string2), "/Autos/%s%d.dtcar", playername2,x);
    new File: UserFile = fopen(string2, io_read);
    if (UserFile)
    {
    hatspielercar[playerid][x] = 1;
    new key[ 256 ] , val[ 256 ];
    new Data[ 256 ];
    while ( fread( UserFile , Data , sizeof( Data ) ) )
    {
    key = ini_GetKey( Data );
    if( strcmp( key , "CarId" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarId] = strval( val ); }
    if( strcmp( key , "CarModel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarModel] = strval( val ); }
    if( strcmp( key , "CarPos_x" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_x] = floatstr( val ); }
    if( strcmp( key , "CarPos_y" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_y] = floatstr( val ); }
    if( strcmp( key , "CarPos_z" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_z] = floatstr( val ); }
    if( strcmp( key , "CarRotate" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRotate] = floatstr( val ); }
    if( strcmp( key , "CarNitro" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarNitro] = strval( val ); }
    if( strcmp( key , "CarHyd" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarHyd] = strval( val ); }
    if( strcmp( key , "CarWheel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarWheel] = strval( val ); }
    if( strcmp( key , "CarAusp" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarAusp] = strval( val ); }
    if( strcmp( key , "CarSideL" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSideL] = strval( val ); }
    if( strcmp( key , "CarSideR" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSideR] = strval( val ); }
    if( strcmp( key , "CarFB" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarFB] = strval( val ); }
    if( strcmp( key , "CarRB" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRB] = strval( val ); }
    if( strcmp( key , "CarSpoiler" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSpoiler] = strval( val ); }
    if( strcmp( key , "CarRoof" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRoof] = strval( val ); }
    if( strcmp( key , "CarHood" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarHood] = strval( val ); }
    if( strcmp( key , "CarVents" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarVents] = strval( val ); }
    if( strcmp( key , "CarLamps" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarLamps] = strval( val ); }
    if( strcmp( key , "CarPJ" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPJ] = strval( val ); }
    if( strcmp( key , "CarC1" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarC1] = strval( val ); }
    if( strcmp( key , "CarC2" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarC2] = strval( val ); }
    if( strcmp( key , "Preis" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPreis] = strval( val ); }
    if( strcmp( key , "Plate" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][Plate] = strval( val ); }
    if( strcmp( key , "CarSperre" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarGesperrt] = strval( val ); }
    if( strcmp( key , "CarKaputt" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarKaputt] = strval( val ); }
    if( strcmp( key , "CarTank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarTank] = strval( val ); }
    if( strcmp( key , "CarKM" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarKM] = floatstr( val ); }
    if( strcmp( key , "CarHp" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarHp] = floatstr( val ); }
    if( strcmp( key , "CarClose" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarClose] = strval( val ); }
    if( strcmp( key , "CarPreisk" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPreisk] = strval( val ); }
    }
    //PlayerCar[playerid][x][CarId] = Spielerauto[x][playerid];
    fclose(UserFile);
    PlayerCarSpawn(playerid,x);
    }
    }
    }
    }
    forward PlayerCarSpawn(playerid,Slot);
    public PlayerCarSpawn(playerid,Slot)
    {
    if(IsPlayerConnected(playerid))
    {
    if(hatspielercar[playerid][Slot])
    {
    PlayerCar[playerid][Slot][CarId] = CreateVehicle(PlayerCar[playerid][Slot][CarModel],PlayerCar[playerid][Slot][CarPos_x],PlayerCar[playerid][Slot][CarPos_y],PlayerCar[playerid][Slot][CarPos_z],PlayerCar[playerid][Slot][CarRotate],PlayerCar[playerid][Slot][CarC1],PlayerCar[playerid][Slot][CarC2], 60000);/*vehicle spawn*/
    ChangeVehicleColor(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarC1],PlayerCar[playerid][Slot][CarC2]);
    if(PlayerCar[playerid][Slot][CarPJ] >= 0) {ChangeVehiclePaintjob(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarPJ]);}
    if(PlayerCar[playerid][Slot][CarNitro] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarNitro]);}
    if(PlayerCar[playerid][Slot][CarHyd] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarHyd]);}
    if(PlayerCar[playerid][Slot][CarWheel] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarWheel]);}
    if(PlayerCar[playerid][Slot][CarAusp] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarAusp]);}
    if(PlayerCar[playerid][Slot][CarSideL] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarSideL]);}
    if(PlayerCar[playerid][Slot][CarSideR] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarSideR]);}
    if(PlayerCar[playerid][Slot][CarFB] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarFB]);}
    if(PlayerCar[playerid][Slot][CarRB] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarRB]);}
    if(PlayerCar[playerid][Slot][CarSpoiler] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarSpoiler]);}
    if(PlayerCar[playerid][Slot][CarRoof] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarRoof]);}
    if(PlayerCar[playerid][Slot][CarHood] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarHood]);}
    if(PlayerCar[playerid][Slot][CarVents] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarVents]);}
    if(PlayerCar[playerid][Slot][CarLamps] != 0) {AddVehicleComponent(PlayerCar[playerid][Slot][CarId],PlayerCar[playerid][Slot][CarLamps]);}
    if(Dtc_LockOnSpawn)
    {
    Carlockd[PlayerCar[playerid][Slot][CarId]] = 1;
    lockcard(PlayerCar[playerid][Slot][CarId]);
    }
    new strings[15];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof name);
    format(str, sizeof str, "/Autos/%s%d.dtcar", name,Dtc_PlayerKey[playerid]);
    format(strings, sizeof(strings), "%s", dini_Get(str, "Plate"));
    SetVehicleNumberPlate(PlayerCar[playerid][Slot][CarId], strings);
    SetVehicleToRespawn(PlayerCar[playerid][Slot][CarId]);
    for(new x = 0; x < MaxVeh; x++)
    {
    PlayerCar[playerid][x][Plate] = strings;
    }
    }
    }
    }


    Wie schreibe ich DAS in MYSQL?


    Mit freundlichen Grüßen


    Teddy

    Meinst du sowas?


    dcmd_kick(playerid,params[])
    {
    new pID;
    new Grund[128];
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, aname, sizeof(aname));
    if(sscanf(params,"us",pID,Grund))return SendClientMessage(playerid,COLOR_WHITE,"Benutzung: /kick [playerid][Grund]");
    if(SInfo[playerid][pAdmin] >= 1)
    {
    new string[128];
    GetPlayerName(pID, pname, sizeof(pname));
    SendClientMessage(playerid,COLOR_RED,"Du hast den Spieler gekickt!");
    format(string,sizeof(string),"[JunkBuster] Admin %s hat Spieler %s gekickt! Grund: %s",aname,pname,Grund);
    SendClientMessageToAll(COLOR_RED,string);
    Kick(pID);
    }
    return 1;
    }


    Wenn nein, dann versteh ich deine Frage nicht...

    dcmd_aufbohren(playerid,params[])
    {
    #pragma unused params
    if(IsPlayerInRangeOfPoint(playerid, 20.0,146.0983,174.1579,484.5328))
    {
    if(BankrobZeit == 0)
    {
    if(SInfo[playerid][pBohrer] == 1)
    {
    BankrobZeit = 1;
    SInfo[playerid][pBohrer] = 0;
    SendClientMessage(playerid, COLOR_WHITE, "Der {D70000}Bohrer {F0F0F0}braucht ca. {D70000}3 Minuten {F0F0F0}bis das Schloss {D70000}geknackt {F0F0F0}ist!");
    Bohrer = CreateObject(2985, 145.91389, 174.09129, 483.23419, 0.00000, 0.00000, 90.00000);
    HatGeldsack[playerid] = 0;
    SetTimer("BohrTimer",1000*60,0);
    SetTimer("Komplettesende",1000*120*15,0);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(IsACop(i))
    {
    SendClientMessage(i,COLOR_RED,"HQ: Achtung: Der Banktresor wird aufgebohrt!!");
    SendClientMessage(i,COLOR_RED,"HQ: Verbrechen: Aufbrechen vom Tresor/Bankrob, Gesuchter: Nicht bekannt!");
    SendClientMessage(i,COLOR_RED,"HQ: Alle Einsatzkräfte zur Bank!");
    }
    }
    }
    }
    else
    {
    SendClientMessage(playerid,COLOR_RED,"Du musst dir zuerst einen Bohrer am Schwarzmarkt kaufen!");
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_RED, "Bankrobs sind nur alle 120 Minuten möglich!");
    }
    }


    else
    {
    SendClientMessage(playerid, COLOR_RED, "Du bist nicht in der Nähe der Bank!");
    }
    return 1;
    }


    Ja wäre dieses beispiel nun falsch oder richtig? Ich mein vom aufbau her... ich kann nur dcmd ^^

    Aber wenn ich es so brauche brauche ich ja ewig das alles umzuschreiben oder nicht?


    und ein perfekter befehl sollte dann so aussehen?


    dcmd_ban(playerid,params[])
    {
    new pID;
    new Grund[128];
    new aname[MAX_PLAYER_NAME];
    if(sscanf(params,"us",pID,Grund)) return SendClientMessage(playerid,COLOR_WHITE,"Benutzung: /ban [playerid][Grund]");
    if(!SInfo[playerid][pAdmin] >= 2) return SendClientMessage(playerid,COLOR_WHITE,"Du bist kein Admin!");
    new string[128];
    SendClientMessage(playerid,COLOR_RED,"Du hast den Spieler gebannt!");
    GetPlayerName(pID, aname, sizeof(aname));
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string,sizeof(string),"[JunkBuster] Admin %s hat Spieler %s gebannt! Grund: %s",pname,aname,Grund);
    SendClientMessageToAll(COLOR_RED,string);
    SInfo[pID][pBan] = 1;
    Kick(pID);
    return 1;
    }

    Also wäre es so perfekt ?:


    new Paintball[MAX_PLAYERS],
    Paintballstart = 0,
    Meistekills = 0,
    HatKills[MAX_PLAYERS],
    Paintballpreis = 0,
    Paintballkannstarten = 0,
    gewinnername = 999,
    jackgeld = 0,
    Hatnummer[MAX_PLAYERS],
    Kannlottokaufen,
    bool:GibtGas[MAX_PLAYERS],
    durchsuchen[MAX_PLAYERS][9],
    hatpark[MAX_PLAYERS],
    Kannrobbe[MAX_PLAYERS],
    machtschein[MAX_PLAYERS],
    IstBiz[MAX_PLAYERS],
    Kannmitnehmen[MAX_PLAYERS],
    Hatmull[MAX_PLAYERS],
    BekommtGeld[MAX_PLAYERS];
    reinfahrentrucker[MAX_PLAYERS],
    mProdukt[MAX_PLAYERS],
    Kartons[MAX_PLAYERS];
    Truckfahren[MAX_PLAYERS],
    Anfangsmission[MAX_PLAYERS],
    pickuphotdog,
    pickuphotdog2,
    pickuphotdog3,
    pickuphotdog4,
    Kannblitzt[MAX_PLAYERS],
    HitSound[MAX_PLAYERS],
    Storycar[MAX_VEHICLES],
    Sotoryman[MAX_PLAYERS],
    checkgastimer,
    Clearaxd[MAX_PLAYERS],
    PlayerStoned[MAX_PLAYERS],
    Auftragspieler[MAX_PLAYERS],
    auftragfrei[MAX_PLAYERS],
    Swatakti = 0,
    hurending[MAX_PLAYERS],
    Geldverdienst[MAX_VEHICLES],
    gPlayerUsingLoopingAnim[MAX_PLAYERS],
    Fahrpreis[MAX_VEHICLES],
    Taxidienst[MAX_PLAYERS],
    Fahrzeugstatus[MAX_VEHICLES],
    vehicleidvonplayer[MAX_PLAYERS],
    Mundtape[MAX_PLAYERS],
    Augenbinde[MAX_PLAYERS],
    Holzfahrzeug[MAX_PLAYERS],
    Holzfahrzeug2[MAX_PLAYERS],
    Float:Baumxdx2[MAX_PLAYERS],
    Float:Baumxdy2[MAX_PLAYERS],
    Float:Baumxdz2[MAX_PLAYERS],
    Float:Baumxdx[MAX_PLAYERS],
    Float:Baumxdy[MAX_PLAYERS],
    Float:Baumxdz[MAX_PLAYERS],
    reinfahrenvomholz[MAX_PLAYERS],
    reinfahrenvomholz2[MAX_PLAYERS],
    Bohrer,
    Kannaufnehmenxd[MAX_PLAYERS],
    Geldsack1,
    Geldsack2,
    Geldsack3,
    Geldsack4,
    Bankrobabladenxd[MAX_PLAYERS],
    porten[MAX_PLAYERS],
    MakesBankrob[MAX_PLAYERS],
    HatGeldsack[MAX_PLAYERS];