Hallo,
Ich habe mir ein Login-Script erstellt , wo ich mich Registrieren und einloggen kann.
Wenn ich mich Registriere wird alles wie es sein soll gespeichert etc,
nur wenn ich mich dann einlogge und das Passwort eingebe ist es falsch...
Was mache ich Falsch ?:
#include <a_samp>
#include <Dini>
#include <md5>
#include <ocmd>
#include <b_nodm>
//enums
enum SpielerDaten
{
passwort,
geld,
level
}
new playerD[MAX_PLAYERS] [SpielerDaten];
//defines
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_RADIO 3
//Farben
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_RED 0xAA3333AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_DARKRED 0x660000AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_BRIGHTRED 0xFF0000AA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_VIOLET 0x9955DEEE
#define COLOR_LIGHTRED 0xFF99AADD
#define COLOR_SEAGREEN 0x00EEADDF
#define COLOR_GRAYWHITE 0xEEEEFFC4
#define COLOR_LIGHTNEUTRALBLUE 0xabcdef66
#define COLOR_GREENISHGOLD 0xCCFFDD56
#define COLOR_LIGHTBLUEGREEN 0x0FFDD349
#define COLOR_NEUTRALBLUE 0xABCDEF01
#define COLOR_LIGHTCYAN 0xAAFFCC33
#define COLOR_LEMON 0xDDDD2357
#define COLOR_MEDIUMBLUE 0x63AFF00A
#define COLOR_NEUTRAL 0xABCDEF97
#define COLOR_BLACK 0x00000000
#define COLOR_NEUTRALGREEN 0x81CFAB00
#define COLOR_DARKGREEN 0x12900BBF
#define COLOR_LIGHTGREEN 0x24FF0AB9
#define COLOR_DARKBLUE 0x300FFAAB
#define COLOR_BLUEGREEN 0x46BBAA00
#define COLOR_PINK 0xFF66FFAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_DARKRED 0x660000AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_PURPLE 0x800080AA
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_RED1 0xFF0000AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BROWN 0x993300AA
#define COLOR_CYAN 0x99FFFFAA
#define COLOR_TAN 0xFFFFCCAA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_KHAKI 0x999900AA
#define COLOR_LIME 0x99FF00AA
#define COLOR_SYSTEM 0xEFEFF7AA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_GRAD5 0xE3E3E3FF
main()
{
print("\n----------------------------------");
print("Reallife-Script 1.0");
print("----------------------------------\n");
}
public OnGameModeInit()
{
SetGameModeText("German Reallife");
AddPlayerClass(0,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
AddPlayerClass(1,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
AddPlayerClass(2,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
AddPlayerClass(3,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
AddPlayerClass(4,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
AddPlayerClass(5,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
AddPlayerClass(6,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
AddPlayerClass(7,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
AddPlayerClass(8,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
AddPlayerClass(9,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
AddPlayerClass(10,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
AddPlayerClass(11,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
AddPlayerClass(12,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
AddPlayerClass(13,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
AddPlayerClass(14,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
AddPlayerClass(15,1771.8636,-1895.3770,13.5540,269.5883,0,0,0,0,0,0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid,1771.8636,-1895.3770,13.5540);
SetPlayerCameraPos(playerid,1779.6215,-1894.5961,13.3890);
SetPlayerCameraLookAt(playerid,1771.8636,-1895.3770,13.5540);
return 1;
}
public OnPlayerConnect(playerid)
{
//Wilkommens nachricht
SendClientMessage(playerid,COLOR_CYAN,"Wilkommen auf unserem Server!");
//AudioStream
PlayAudioStreamForPlayer(playerid,"http://www.iloveradio.de/listen.m3u");
//----------
new Spieler[128];
format(Spieler,sizeof(Spieler),"/Spieler/%s.txt",getPlayerName(playerid));
if (dini_Exists(Spieler))
{
ShowPlayerDialog(playerid, DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Bitte logge dich mit deinem Passwort ein","Login","Abbrechen");
}
else
{
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Registrierung","Wilkommen. Bitte gebe ein gewünschtes Passwort ein, um Spielen zu können!", "Weiter","Abbrechen");
return 1;
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
}
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 == 1)
{
new Spieler[128];
format(Spieler,sizeof(Spieler),"/Spieler/%s.txt",getPlayerName(playerid));
if(strlen(inputtext) > 9)
{
if(strcmp(inputtext,dini_Get(Spieler,"Passwort"),false) == 0)
{
SendClientMessage(playerid,COLOR_GREEN,"Du hast dich erfolgreich eingeloggt! Viel Spaß wünscht dir das Team!");
loadPlayer(playerid);
return 1;
}
else
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Das Passwort war falsch!\nGib dein Passwort erneut ein:","Login","Abbrechen");
return 1;
}
}
SendClientMessage(playerid,COLOR_RED,"Das Passwort war falsch!");
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Das Passwort war falsch!\nGib dein Passwort erneut ein:","Login","Abbrechen");
return 1;
}
if(response == 0)
{
Kick(playerid);
}
return 1;
}
if(dialogid == DIALOG_REGISTER)
{
if(response == 1)
{
new Spieler[128];
format(Spieler,sizeof(Spieler),"/Spieler/%s.txt",getPlayerName(playerid));
dini_Create(Spieler);
dini_Set(Spieler,"Passwort",inputtext);
dini_IntSet(Spieler,"Geld",50000);
dini_IntSet(Spieler,"Level",1);
SendClientMessage(playerid,COLOR_GREEN,"Du hast dich erfolgreich registriert!");
loadPlayer(playerid);
return 1;
}
if(response == 0)
{
SendClientMessage(playerid,COLOR_RED,"Du hast auf abbrechen geklickt und wurdest zur vorsicht gekickt!");
Kick(playerid);
return 1;
}
return 1;
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
stock SpielerName(playerid)
{
new name[MAX_PLAYER_NAME]
GetPlayerName(playerid,name,sizeof(name));
return name;
}
stock loadPlayer(playerid)
{
new Spieler[128];
format(Spieler,sizeof(Spieler),"/Spieler/%s.txt",getPlayerName(playerid));
playerD[playerid][geld] = dini_Int(Spieler,"Geld");
playerD[playerid][level] = dini_Int(Spieler,"Level");
setPlayerMoney(playerid,playerD[playerid][geld]);
SetPlayerScore(playerid,playerD[playerid][level]);
return 1;
}
stock setPlayerMoney(playerid, betrag)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,betrag);
return 1;
}
stock getPlayerName(playerid)
{
new name[128];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
Danke im Vorraus