Hi, ich hab in einem GF Script angefangen zu editieren und wollte aus dem Login & Register System eins mit Dialog machen, aber Irgendwie wird das Passwort nicht gespeichert und muss nach dem Registrieren immer noch /login [passwort] eingeben und werde nicht gespawnt. Auch das Passwort wird nicht gespeichert, nur wenn ich eine 1 als Passwort nehme. Ansonsten wird es nicht gespeichert.
Problem liegt daran, dass ich nach dem Passwort eingeben im Dialog beim Registrieren immer noch danach /login machen muss und nicht gespwant werde.
Das würde ich gerne ändern und das ich direkt richtig gespwant werde nach dem registrieren bzw. einloggen.
Hier die sachen aus dem Script:
if(fexist(string))
{
SetPlayerSkin(playerid,101);
SetPlayerPos(playerid,1553.8250,-1679.4907,13.5480);
SetPlayerInterior(playerid,0);
SetPlayerCameraPos(playerid,1482.0449,-1640.3373,40.1629);
SetPlayerCameraLookAt(playerid,1557.9071,-1675.6761,28.3955);
gPlayerAccount[playerid] = 0;
GameTextForPlayer(playerid, "~w~Willkommen Auf SGR !", 1400, 5);
SendClientMessage(playerid, COLOR_YELLOW, "|_______________ SGR - Silver German Reallife _______________|");
SendClientMessage(playerid, COLOR_WHITE, "Dein Account wird in der Datenbank gesucht ....");
SendClientMessage(playerid,COLOR_WHITE, "Dieser Account ist in der Datenbank registriert.");
//SendClientMessage(playerid,COLOR_WHITE, "Du kannst dich nun mit /login [Passwort] einloggen.");
SendClientMessage(playerid,COLOR_YELLOW, "|____________________________________________________________|");
ShowPlayerDialog(playerid,Dialog_Login,1,"Login","Bitte gebe dein Passwort ein um dich einzuloggen.","Login","Disconnect");
return 1;
}
else
{
SetPlayerSkin(playerid,101);
SetPlayerPos(playerid,1553.8250,-1679.4907,13.5480);
SetPlayerInterior(playerid,0);
SetPlayerCameraPos(playerid,1482.0449,-1640.3373,40.1629);
SetPlayerCameraLookAt(playerid,1557.9071,-1675.6761,28.3955);
gPlayerAccount[playerid] = 1;
GameTextForPlayer(playerid, "~w~Willkommen Auf SGR - Registriere dich !", 1400, 5);
SendClientMessage(playerid,COLOR_YELLOW,"|_______________ SGR - Silver German Reallife _______________|");
SendClientMessage(playerid,COLOR_WHITE, "Dein Account wird in der Datenbank gesucht ....");
SendClientMessage(playerid,COLOR_WHITE,"Dieser Account wurde nicht in der Datenbank gefunden.");
//SendClientMessage(playerid,COLOR_WHITE, "Registriere dich nun mit /register [Passwort].");
SendClientMessage(playerid,COLOR_YELLOW, "|____________________________________________________________|");
ShowPlayerDialog(playerid,Dialog_Reg,1,"Register","Bitte gebe hier dein gewünschtes Passwort ein.","Register","Disconnect");
return 1;
}
if (strcmp(cmd, "/register", true) ==0 )
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Du bist bereits eingeloggt.");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "/Accounts/%s.ini", sendername);
new File: hFile = fopen(string, io_read);
if (hFile)
{
SendClientMessage(playerid, COLOR_YELLOW, "Dieser Name ist schon vergeben! Bitte benutze einen anderen.");
fclose(hFile);
return 1;
}
new tmppass[64];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "Verwendung: /register [passwort]");
return 1;
}
strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
Encrypt(tmppass);
OnPlayerRegister(playerid,tmppass);
}
return 1;
}
if (strcmp(cmd, "/login", true) ==0 )
{
if(IsPlayerConnected(playerid))
{
new tmppass[64];
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Du bist bereits eingeloggt.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "Verwendung: /login [passwort]");
return 1;
}
strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
Encrypt(tmppass);
OnPlayerLogin(playerid,tmppass);
}
return 1;
}
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "** Dieser Server verlangt einen Login vor dem Spawnen (Du wurdest gekickt) **");
KickPlayer[playerid] = 1;
}
(wenn maan nicht /login macht sondern auf Spawn klickt.
public OnPlayerRegister(playerid, password[])
{
if(IsPlayerConnected(playerid))
{
new string3[32];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), "/Accounts/%s.ini", playername3);
new File: hFile = fopen(string3, io_write);
if (hFile)
{
strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 255);
new var[32];
PlayerInfo[playerid][pChar] = 101;
format(var, 32, "Schlüssel=%s\n", PlayerInfo[playerid][pKey]);fwrite(hFile, var);
PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
format(var, 32, "Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
format(var, 32, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
format(var, 32, "DonateRank=%d\n",PlayerInfo[playerid][pDonateRank]);fwrite(hFile, var);
format(var, 32, "UpgradePunkte=%d\n",PlayerInfo[playerid][gPupgrade]);fwrite(hFile, var);
format(var, 32, "ConnectedTime=%d\n",PlayerInfo[playerid][pConnectTime]);fwrite(hFile, var);
format(var, 32, "Registriert=%d\n",PlayerInfo[playerid][pReg]);fwrite(hFile, var);
format(var, 32, "Geschlecht=%d\n",PlayerInfo[playerid][pSex]);fwrite(hFile, var);
format(var, 32, "Alter=%d\n",PlayerInfo[playerid][pAge]);fwrite(hFile, var);
format(var, 32, "Perso=%d\n",PlayerInfo[playerid][pOwnPerso]);fwrite(hFile, var);
format(var, 32, "Herkunft=%d\n",PlayerInfo[playerid][pOrigin]);fwrite(hFile, var);
format(var, 32, "CK=%d\n",PlayerInfo[playerid][pCK]);fwrite(hFile, var);
format(var, 32, "Stummgeschaltet=%d\n",PlayerInfo[playerid][pMuted]);fwrite(hFile, var);
format(var, 32, "Respekt=%d\n",PlayerInfo[playerid][pExp]);fwrite(hFile, var);
format(var, 32, "Geld=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pAccount]);fwrite(hFile, var);
format(var, 32, "Verbrechen=%d\n",PlayerInfo[playerid][pCrimes]);fwrite(hFile, var);
format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
format(var, 32, "Tode=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
format(var, 32, "Eingesperrt=%d\n",PlayerInfo[playerid][pArrested]);fwrite(hFile, var);
format(var, 32, "WantedTode=%d\n",PlayerInfo[playerid][pWantedDeaths]);fwrite(hFile, var);
format(var, 32, "Telefonbuch=%d\n",PlayerInfo[playerid][pPhoneBook]);fwrite(hFile, var);
format(var, 32, "LottoNr=%d\n",PlayerInfo[playerid][pLottoNr]);fwrite(hFile, var);
format(var, 32, "Fische=%d\n",PlayerInfo[playerid][pFishes]);fwrite(hFile, var);
format(var, 32, "GrößterFisch=%d\n",PlayerInfo[playerid][pBiggestFish]);fwrite(hFile, var);
format(var, 32, "Job=%d\n",PlayerInfo[playerid][pJob]);fwrite(hFile, var);
format(var, 32, "Paycheck=%d\n",PlayerInfo[playerid][pPayCheck]);fwrite(hFile, var);
format(var, 32, "Kopfgeld=%d\n",PlayerInfo[playerid][pHeadValue]);fwrite(hFile, var);
format(var, 32, "Jailed=%d\n",PlayerInfo[playerid][pJailed]);fwrite(hFile, var);
format(var, 32, "JailTime=%d\n",PlayerInfo[playerid][pJailTime]);fwrite(hFile, var);
format(var, 32, "Materialien=%d\n",PlayerInfo[playerid][pMats]);fwrite(hFile, var);
format(var, 32, "Drogen=%d\n",PlayerInfo[playerid][pDrugs]);fwrite(hFile, var);
format(var, 32, "Leader=%d\n",PlayerInfo[playerid][pLeader]);fwrite(hFile, var);
format(var, 32, "Member=%d\n",PlayerInfo[playerid][pMember]);fwrite(hFile, var);
format(var, 32, "FMember=%d\n",PlayerInfo[playerid][pFMember]);fwrite(hFile, var);
format(var, 32, "Rank=%d\n",PlayerInfo[playerid][pRank]);fwrite(hFile, var);
format(var, 32, "Char=%d\n",PlayerInfo[playerid][pChar]);fwrite(hFile, var);
format(var, 32, "ContractTime=%d\n",PlayerInfo[playerid][pContractTime]);fwrite(hFile, var);
format(var, 32, "DetSkill=%d\n",PlayerInfo[playerid][pDetSkill]);fwrite(hFile, var);
format(var, 32, "SexSkill=%d\n",PlayerInfo[playerid][pSexSkill]);fwrite(hFile, var);
format(var, 32, "BoxSkill=%d\n",PlayerInfo[playerid][pBoxSkill]);fwrite(hFile, var);
format(var, 32, "LawSkill=%d\n",PlayerInfo[playerid][pLawSkill]);fwrite(hFile, var);
format(var, 32, "MechSkill=%d\n",PlayerInfo[playerid][pMechSkill]);fwrite(hFile, var);
format(var, 32, "JackSkill=%d\n",PlayerInfo[playerid][pJackSkill]);fwrite(hFile, var);
format(var, 32, "CarSkill=%d\n",PlayerInfo[playerid][pCarSkill]);fwrite(hFile, var);
format(var, 32, "NewsSkill=%d\n",PlayerInfo[playerid][pNewsSkill]);fwrite(hFile, var);
format(var, 32, "DrugsSkill=%d\n",PlayerInfo[playerid][pDrugsSkill]);fwrite(hFile, var);
format(var, 32, "CookSkill=%d\n",PlayerInfo[playerid][pCookSkill]);fwrite(hFile, var);
format(var, 32, "FishSkill=%d\n",PlayerInfo[playerid][pFishSkill]);fwrite(hFile, var);
format(var, 32, "pSHealth=%.1f\n",PlayerInfo[playerid][pSHealth]);fwrite(hFile, var);
GetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
format(var, 32, "pHealth=%.1f\n",PlayerInfo[playerid][pHealth]);fwrite(hFile, var);
format(var, 32, "Int=%d\n",PlayerInfo[playerid][pInt]);fwrite(hFile, var);
format(var, 32, "Local=%d\n",PlayerInfo[playerid][pLocal]);fwrite(hFile, var);
format(var, 32, "Team=%d\n",PlayerInfo[playerid][pTeam]);fwrite(hFile, var);
format(var, 32, "Model=%d\n",PlayerInfo[playerid][pModel]);fwrite(hFile, var);
format(var, 32, "PhoneNr=%d\n",PlayerInfo[playerid][pPnumber]);fwrite(hFile, var);
format(var, 32, "House=%d\n",PlayerInfo[playerid][pPhousekey]);fwrite(hFile, var);
format(var, 32, "Bizz=%d\n",PlayerInfo[playerid][pPbiskey]);fwrite(hFile, var);
if ((PlayerInfo[playerid][pPos_x]==0.0 && PlayerInfo[playerid][pPos_y]==0.0 && PlayerInfo[playerid][pPos_z]==0.0))
{
PlayerInfo[playerid][pPos_x] = 1684.9;
PlayerInfo[playerid][pPos_y] = -2244.5;
PlayerInfo[playerid][pPos_z] = 13.5;
}
if(Spectate[playerid] != 255)
{
PlayerInfo[playerid][pPos_x] = Unspec[playerid][sPx];
PlayerInfo[playerid][pPos_y] = Unspec[playerid][sPy];
PlayerInfo[playerid][pPos_z] = Unspec[playerid][sPz];
PlayerInfo[playerid][pInt] = Unspec[playerid][sPint];
PlayerInfo[playerid][pLocal] = Unspec[playerid][sLocal];
}
format(var, 32, "Pos_x=%.1f\n",PlayerInfo[playerid][pPos_x]);fwrite(hFile, var);
format(var, 32, "Pos_y=%.1f\n",PlayerInfo[playerid][pPos_y]);fwrite(hFile, var);
format(var, 32, "Pos_z=%.1f\n",PlayerInfo[playerid][pPos_z]);fwrite(hFile, var);
format(var, 32, "Autoschein=%d\n",PlayerInfo[playerid][pCarLic]);fwrite(hFile, var);
format(var, 32, "Truckschein=%d\n",PlayerInfo[playerid][pTruckLic]);fwrite(hFile, var);
format(var, 32, "Motorradschein=%d\n",PlayerInfo[playerid][pBikeLic]);fwrite(hFile, var);
format(var, 32, "Flugschein=%d\n",PlayerInfo[playerid][pFlyLic]);fwrite(hFile, var);
format(var, 32, "Bootschein=%d\n",PlayerInfo[playerid][pBoatLic]);fwrite(hFile, var);
format(var, 32, "Angelschein=%d\n",PlayerInfo[playerid][pFishLic]);fwrite(hFile, var);
format(var, 32, "Waffenschein=%d\n",PlayerInfo[playerid][pGunLic]);fwrite(hFile, var);
format(var, 32, "Waffe1=%d\n",PlayerInfo[playerid][pGun1]);fwrite(hFile, var);
format(var, 32, "Waffe2=%d\n",PlayerInfo[playerid][pGun2]);fwrite(hFile, var);
format(var, 32, "Waffe3=%d\n",PlayerInfo[playerid][pGun3]);fwrite(hFile, var);
format(var, 32, "Waffe4=%d\n",PlayerInfo[playerid][pGun4]);fwrite(hFile, var);
format(var, 32, "Ammo1=%d\n",PlayerInfo[playerid][pAmmo1]);fwrite(hFile, var);
format(var, 32, "Ammo2=%d\n",PlayerInfo[playerid][pAmmo2]);fwrite(hFile, var);
format(var, 32, "Ammo3=%d\n",PlayerInfo[playerid][pAmmo3]);fwrite(hFile, var);
format(var, 32, "Ammo4=%d\n",PlayerInfo[playerid][pAmmo4]);fwrite(hFile, var);
format(var, 32, "CarTime=%d\n",PlayerInfo[playerid][pCarTime]);fwrite(hFile, var);
format(var, 32, "PayDay=%d\n",PlayerInfo[playerid][pPayDay]);fwrite(hFile, var);
format(var, 32, "PayDayHad=%d\n",PlayerInfo[playerid][pPayDayHad]);fwrite(hFile, var);
format(var, 32, "CDPlayer=%d\n",PlayerInfo[playerid][pCDPlayer]);fwrite(hFile, var);
format(var, 32, "Siege=%d\n",PlayerInfo[playerid][pWins]);fwrite(hFile, var);
format(var, 32, "Niederlagen=%d\n",PlayerInfo[playerid][pLoses]);fwrite(hFile, var);
format(var, 32, "AlcoholPerk=%d\n",PlayerInfo[playerid][pAlcoholPerk]);fwrite(hFile, var);
format(var, 32, "DrugPerk=%d\n",PlayerInfo[playerid][pDrugPerk]);fwrite(hFile, var);
format(var, 32, "MiserPerk=%d\n",PlayerInfo[playerid][pMiserPerk]);fwrite(hFile, var);
format(var, 32, "PainPerk=%d\n",PlayerInfo[playerid][pPainPerk]);fwrite(hFile, var);
format(var, 32, "TraderPerk=%d\n",PlayerInfo[playerid][pTraderPerk]);fwrite(hFile, var);
format(var, 32, "Tutorial=%d\n",PlayerInfo[playerid][pTut]);fwrite(hFile, var);
format(var, 32, "Mission=%d\n",PlayerInfo[playerid][pMissionNr]);fwrite(hFile, var);
format(var, 32, "Warnungen=%d\n",PlayerInfo[playerid][pWarns]);fwrite(hFile, var);
format(var, 32, "Adjustable=%d\n",PlayerInfo[playerid][pAdjustable]);fwrite(hFile, var);
format(var, 32, "Tank=%d\n",PlayerInfo[playerid][pFuel]);fwrite(hFile, var);
format(var, 32, "Verheiratet=%d\n",PlayerInfo[playerid][pMarried]);fwrite(hFile, var);
format(var, 32, "Verheiratetmit=%s\n",PlayerInfo[playerid][pMarriedTo]);fwrite(hFile, var);
fclose(hFile);
SendClientMessage(playerid,COLOR_LIGHTRED,"JETZT: /login [passwort]");
SendClientMessage(playerid,COLOR_LIGHTRED,"JETZT: /login [passwort]");
SendClientMessage(playerid,COLOR_LIGHTRED,"JETZT: /login [passwort]");
SendClientMessage(playerid,COLOR_LIGHTRED,"JETZT: /login [passwort]");
SendClientMessage(playerid,COLOR_LIGHTRED,"JETZT: /login [passwort]");
SendClientMessage(playerid,COLOR_LIGHTRED,"JETZT: /login [passwort]");
SendClientMessage(playerid,COLOR_LIGHTRED,"JETZT: /login [passwort]");
SendClientMessage(playerid,COLOR_LIGHTRED,"JETZT: /login [passwort]");
SendClientMessage(playerid,COLOR_LIGHTRED,"JETZT: /login [passwort]");
SendClientMessage(playerid,COLOR_LIGHTRED,"JETZT: /login [passwort]");
}
}
return 1;
}