Beiträge von [EF]deadman

    Ich habn Dini Registersystem.. aber des will ned gehen.. bin noch scriptanfänger...
    und ich ich kappier die Fehler ned...
    könnt ih rmir mal helfen




    #include <a_samp>
    #include <dini>
    #include <dutils>
    #include <Dudb>


    #define Dialog_Login 1
    #define Dialog_Reg 2
    #define rot 0xFF0000FF
    #define playerid
    #define classid
    #define string


    enum Info
    {
    passwort[128],
    skin,
    };
    new pInfo[MAX_PLAYERS][Info];
    new bool:loggedin[MAX_PLAYERS];
    new spieler[MAX_PLAYER_NAME];y







    main()
    {
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
    }



    public OnGameModeInit()
    {


    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
    }


    public OnGameModeExit()
    {
    return 1;
    }


    public OnPlayerRequestClass(playerid, classid)
    {
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
    }


    public OnPlayerConnect(playerid)
    {
    new accFormat[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof name);
    format(accFormat,sizeof accFormat,"Accounts/%s.user",name);
    {
    ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_INPUT,"Login","Logge dich bitte mit deinem Passwort ein","Login","Disconnect");//dialog zum Einloggen
    }
    else
    {
    ShowPlayerDialog(playerid,Dialog_Reg,DIALOG_STYLE_INPUT,"Registration","Bitte gebe dein Passwort zur Registrierung ein","Register","Disconnect");//dialog zum registrieren
    }







    new name[128], save[128];
    GetPlayerName(playerid,name,sizeof(name));
    format(save,sizeof(save),"/Spieler/%s.ini",name);
    if(dini_Exists(save)) //
    {
    SendClientMessage(playerid, 0x33CCFFAA, "Willkommen bei SA:MP 0.3 Server");
    SendClientMessage(playerid, 0xFFFFFFAA, "Dein Account wurde wiedererkannt.");
    SendClientMessage(playerid, 0xFFFFFFAA, "Du kannst dich jetzt einloggen.");
    SendClientMessage(playerid, 0xFFFFFFAA, "Benutze dazu /login [passwort].");
    GivePlayerMoney(playerid,dini_Int(save,"Geld"));
    SetPlayerSkin(playerid,dini_Int(save,"Skin"));
    }
    else
    {
    if(!dini_Exists(save))
    {
    SendClientMessage(playerid, 0x33CCFFAA, "Willkommen bei SA:MP 0.3 Server");
    SendClientMessage(playerid, 0xFFFFFFAA, "Du hast noch keinen Account.");
    SendClientMessage(playerid, 0xFFFFFFAA, "Du kannst dich jetzt registrieren.");
    SendClientMessage(playerid, 0xFFFFFFAA, "Benutze dazu /register [passwort].");
    }
    }



    return 1;
    }


    public OnPlayerDisconnect(playerid, reason)
    {
    new name[MAX_PLAYER_NAME],string[128];
    GetPlayerName(playerid,name,sizeof name);
    format(string,sizeof string,"Accounts/%s.user",name);
    dini_IntSet(string,"Adminlevel",GetPVarInt(playerid,"Adminlevel"));
    //usw...



    new name[128], save[128];
    GetPlayerName(playerid,name,sizeof(name));
    format(save,sizeof(save),"/Spieler/%s.ini",name);
    if(dini_Exists(save))
    {
    dini_IntSet(save,"Geld",GetPlayerMoney(playerid));
    dini_IntSet(save,"Skin",GetPlayerSkin(playerid));
    }





    return 1;
    }


    public OnPlayerSpawn(playerid)
    {
    return 1;
    }


    public OnPlayerDeath(playerid, killerid, reason)
    {
    return 1;
    }


    public OnVehicleSpawn(vehicleid)
    {
    new name[128], save[128];// Gleiche
    GetPlayerName(playerid,name,sizeof(name)); // wie
    format(save,sizeof(save),"/Spieler/%s.ini",name);// oben
    if(loggedin[playerid] == false) //Wenn er nicht eingeloggt ist
    {
    SendClientMessage(playerid, 0xAA3333AA, "Du musst dich Einloggen bevor du spawnst!");
    Kick(playerid); // Kicke den Spieler
    }
    SetPlayerSkin(playerid,dini_Int(save,"Skin")); //lade und setze den gespeicherten Skin


    return 1;
    }


    public OnVehicleDeath(vehicleid, killerid)
    {
    return 1;
    }


    public OnPlayerText(playerid, text[])
    {
    return 1;
    }


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if(strcmp(strget(cmdtext,0), "/register", true) == 0)
    {



    new save[40];
    GetPlayerName(playerid,spieler,sizeof(spieler));
    format(save, sizeof(save),"Spieler/%s.ini",spieler);
    if(!dini_Exists(save))
    {
    dini_Create(save);
    dini_IntSet(save,"passwort",udb_hash(strget(cmdtext,1)));
    SendClientMessage(playerid, 0x33AA33AA, "***Dein Account wurde erfolgreich registriert***");
    SendClientMessage(playerid, 0x33AA33AA, "***Nutze /login [Passwort] um dich einzuloggen***");
    }
    else
    {
    if(dini_Exists(save))
    {
    SendClientMessage(playerid, 0xAA3333AA, "Der Account ist bereits registriert");
    }



    }





    if(strcmp(strget(cmdtext,0), "/login", true) == 0)
    {
    new save[40], s2[256];
    GetPlayerName(playerid,spieler,sizeof(spieler));
    format(save,sizeof(save),"Spieler/%s.ini",spieler);
    if(dini_Exists(save))
    {
    s2=dini_Get(save,"passwort");
    if(strval(s2)==udb_hash(strget(cmdtext,1)))
    {
    loggedin[playerid] = true;
    SendClientMessage(playerid, 0x33CCFFAA, "***Du hast dich erfolgreich eingeloggt***");
    SpawnPlayer(playerid);
    }
    else
    {
    SendClientMessage(playerid, 0xAA3333AA, "Passwort Falsch!");


    }
    }




    return 1;
    }


    public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
    {
    return 1;
    }


    public OnPlayerExitVehicle(playerid, vehicleid)
    {
    return 1;
    }


    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    return 1;
    }


    public OnPlayerEnterCheckpoint(playerid)
    {
    return 1;
    }


    public OnPlayerLeaveCheckpoint(playerid)
    {
    return 1;
    }


    public OnPlayerEnterRaceCheckpoint(playerid)
    {
    return 1;
    }


    public OnPlayerLeaveRaceCheckpoint(playerid)
    {
    return 1;
    }


    public OnRconCommand(cmd[])
    {
    return 1;
    }


    public OnPlayerRequestSpawn(playerid)
    {
    return 1;
    }


    public OnObjectMoved(objectid)
    {
    return 1;
    }


    public OnPlayerObjectMoved(playerid, objectid)
    {
    return 1;
    }


    public OnPlayerPickUpPickup(playerid, pickupid)
    {
    return 1;
    }


    public OnVehicleMod(playerid, vehicleid, componentid)
    {
    return 1;
    }


    public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
    {
    return 1;
    }


    public OnVehicleRespray(playerid, vehicleid, color1, color2)
    {
    return 1;
    }


    public OnPlayerSelectedMenuRow(playerid, row)
    {
    return 1;
    }


    public OnPlayerExitedMenu(playerid)
    {
    return 1;
    }


    public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
    {
    return 1;
    }


    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    return 1;
    }


    public OnRconLoginAttempt(ip[], password[], success)
    {
    return 1;
    }


    public OnPlayerUpdate(playerid)
    {
    return 1;
    }


    public OnPlayerStreamIn(playerid, forplayerid)
    {
    return 1;
    }


    public OnPlayerStreamOut(playerid, forplayerid)
    {
    return 1;
    }


    public OnVehicleStreamIn(vehicleid, forplayerid)
    {
    return 1;
    }


    public OnVehicleStreamOut(vehicleid, forplayerid)
    {
    return 1;
    }


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {


    if(dialogid == Dialog_Login)
    {
    if(!response) return Kick(playerid); /
    if(!strlen(inputtext))
    {
    ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_INPUT,"Login","Logge dich bitte mit deinem Passwort ein","Login","Disconnect");
    return SendClientMessage(playerid,rot,"Du hast kein Passwort eingegeben.");
    }


    new string[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof name);
    format(string,sizeof string,"Accounts/%s.user",name);
    if(!strcmp(dini_Get(string,"Passwort"),inputtext,true))
    {
    SetPVarInt(playerid,"Adminlevel",dini_Int(string,"Adminlevel"));
    }
    else
    {
    ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_INPUT,"Login","Logge dich bitte mit deinem Passwort ein","Login","Disconnect");//dialog zum Einloggen
    return SendClientMessage(playerid,rot,"Du hast dein Passwort falsch eingegeben.");
    }
    }


    if(dialogid == Dialog_Reg)
    {
    if(!response) return Kick(playerid);
    if(!strlen(inputtext))
    {
    ShowPlayerDialog(playerid,Dialog_Reg,DIALOG_STYLE_INPUT,"Registration","Bitte gebe dein Passwort zur Registrierung ein","Register","Disconnect");//dialog zum registrieren
    return SendClientMessage(playerid,rot,"Du hast kein Passwort eingegeben.");
    }
    new name[MAX_PLAYER_NAME],accFormat[128];
    GetPlayerName(playerid,name,sizeof name);
    format(accFormat,sizeof accFormat,"Accounts/%s.user",name);
    dini_Create(accFormat);
    SetPVarString(playerid,"Passwort",inputtext);
    dini_Set(accFormat,"Passwort",inputtext);
    SetPVarInt(playerid,"Adminlevel",0);



    }
    retureturn 1;



    stock strget(strx[], pos, search = ' ') {
    new arg, ret[128], idxx;
    for (new i = 0; i < strlen(strx); i++) {
    if(strx[i] == search || i == strlen(strx) || strx[i + 1] == 10) {
    arg++;
    if (arg == pos + 1){
    ret[i-idxx] = EOS;
    return ret;
    } else if (arg == pos)
    idxx= i+1;
    }
    else if (arg == pos)
    ret[i - idxx] = strx[i];
    }
    return ret;
    }
    }