Hey ich habe folgendes Problem ich habe mein GF edit auf MySQL umgeschrieben und wenn ich jetzt auf den Server connecte kommt der Register Dialog und ich gebe ein Passwort ein dann kommt der Login dialog wo ich das passwort nochmal eingeben muss wenn ich dann auf Login klicke verschwindet der dialog und der Server stürzt ab. Wenn ich dann den Server wieder starte und drauf connecte stürzt er vor dem Login Fenster ab ich bin am verzweifeln bitte um Hilfe.
Hier die Codes
OnPlayerLogin
public OnPlayerLogin(playerid,password[])
{
MySQLCheckConnection();
print("OnPlayerLogin");
new tmp2[256];
new string2[64];
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
{
new Data[1024];
new Field[64];
new rcnt = 1;
MySQLFetchAcctRecord(SpielerInfo[playerid][pSQLID], Data);
samp_mysql_strtok(Field, "|", Data);
while (samp_mysql_strtok(Field, "|", "")==1)
{
// The rcnt values here represent the order of the columns in the characters table, so don't mess with them
// If you add a column to the table, just add a new line with a +1 rcnt to the block below
// Start it at 3 to skip the first few records we don't need (id, player name, password)
if (rcnt == 3) SpielerInfo[playerid][pGebannt] = strval(Field);
print("Eingeloggt");
if (rcnt == 4) SpielerInfo[playerid][pAdmin] = strval(Field);
if (rcnt == 5) SpielerInfo[playerid][pDonateRank] = strval(Field);
if (rcnt == 6) SpielerInfo[playerid][gPupgrade] = strval(Field);
if (rcnt == 7) SpielerInfo[playerid][pConnectTime] = strval(Field);
if (rcnt == 8) SpielerInfo[playerid][pReg] = strval(Field);
if (rcnt == 9) SpielerInfo[playerid][pSex] = strval(Field);
if (rcnt == 10) SpielerInfo[playerid][pLevel] = strval(Field);
if (rcnt == 11) SpielerInfo[playerid][pCK] = strval(Field);
if (rcnt == 12) SpielerInfo[playerid][pMuted] = strval(Field);
if (rcnt == 13) SpielerInfo[playerid][pExp] = strval(Field);
if (rcnt == 14) SpielerInfo[playerid][pCash] = strval(Field);
if (rcnt == 15) SpielerInfo[playerid][pAccount] = strval(Field);
if (rcnt == 16) SpielerInfo[playerid][pCrimes] = strval(Field);
if (rcnt == 17) SpielerInfo[playerid][pKills] = strval(Field);
if (rcnt == 18) SpielerInfo[playerid][pDeaths] = strval(Field);
if (rcnt == 19) SpielerInfo[playerid][pArrested] = strval(Field);
if (rcnt == 20) SpielerInfo[playerid][pWantedDeaths] = strval(Field);
if (rcnt == 21) SpielerInfo[playerid][pPhoneBook] = strval(Field);
if (rcnt == 22) SpielerInfo[playerid][pLottoNr] = strval(Field);
if (rcnt == 23) SpielerInfo[playerid][pFishes] = strval(Field);
if (rcnt == 24) SpielerInfo[playerid][pBiggestFish] = strval(Field);
if (rcnt == 25) SpielerInfo[playerid][sJob] = strval(Field);
if (rcnt == 26) SpielerInfo[playerid][pPayCheck] = strval(Field);
if (rcnt == 27) SpielerInfo[playerid][pJobGehalt] = strval(Field);
if (rcnt == 28) SpielerInfo[playerid][pHeadValue] = strval(Field);
if (rcnt == 29) SpielerInfo[playerid][pJailed] = strval(Field);
if (rcnt == 30) SpielerInfo[playerid][pJailTime] = strval(Field);
if (rcnt == 31) SpielerInfo[playerid][pMats] = strval(Field);
if (rcnt == 32) SpielerInfo[playerid][pDrugs] = strval(Field);
if (rcnt == 33) SpielerInfo[playerid][pLeader] = strval(Field);
if (rcnt == 34) SpielerInfo[playerid][pMember] = strval(Field);
if (rcnt == 35) SpielerInfo[playerid][pRank] = strval(Field);
if (rcnt == 36) SpielerInfo[playerid][pChar] = strval(Field);
if (rcnt == 37) SpielerInfo[playerid][pContractTime] = strval(Field);
if (rcnt == 38) SpielerInfo[playerid][pDetSkill] = strval(Field);
if (rcnt == 39) SpielerInfo[playerid][pSexSkill] = strval(Field);
if (rcnt == 40) SpielerInfo[playerid][pBoxSkill] = strval(Field);
if (rcnt == 41) SpielerInfo[playerid][pLawSkill] = strval(Field);
if (rcnt == 42) SpielerInfo[playerid][pMechSkill] = strval(Field);
if (rcnt == 43) SpielerInfo[playerid][pJackSkill] = strval(Field);
if (rcnt == 44) SpielerInfo[playerid][pCarSkill] = strval(Field);
if (rcnt == 45) SpielerInfo[playerid][pNewsSkill] = strval(Field);
if (rcnt == 46) SpielerInfo[playerid][pDrugsSkill] = strval(Field);
if (rcnt == 47) SpielerInfo[playerid][pCookSkill] = strval(Field);
if (rcnt == 48) SpielerInfo[playerid][pFishSkill] = strval(Field);
if (rcnt == 49) SpielerInfo[playerid][pFarmerSkill] = strval(Field);
if (rcnt == 50) SpielerInfo[playerid][pSHealth] = floatstr(Field);
if (rcnt == 51) SpielerInfo[playerid][pHealth] = floatstr(Field);
if (rcnt == 52) SpielerInfo[playerid][pInt] = strval(Field);
if (rcnt == 53) SpielerInfo[playerid][pLocal] = strval(Field);
if (rcnt == 54) SpielerInfo[playerid][pTeam] = strval(Field);
if (rcnt == 55) SpielerInfo[playerid][pModel] = strval(Field);
if (rcnt == 56) SpielerInfo[playerid][pPnumber] = strval(Field);
if (rcnt == 57) SpielerInfo[playerid][pPhousekey] = strval(Field);
if (rcnt == 58) SpielerInfo[playerid][pPbiskey] = strval(Field);
if (rcnt == 59) SpielerInfo[playerid][pPos_x] = floatstr(Field);
if (rcnt == 60) SpielerInfo[playerid][pPos_y] = floatstr(Field);
if (rcnt == 61) SpielerInfo[playerid][pPos_z] = floatstr(Field);
if (rcnt == 62) SpielerInfo[playerid][pCarLic] = strval(Field);
if (rcnt == 63) SpielerInfo[playerid][pFlyLic] = strval(Field);
if (rcnt == 64) SpielerInfo[playerid][pMotoLic] = strval(Field);
if (rcnt == 65) SpielerInfo[playerid][pLKWLic] = strval(Field);
if (rcnt == 66) SpielerInfo[playerid][pARG] = strval(Field);
if (rcnt == 67) SpielerInfo[playerid][pCarInsurance] = strval(Field);
if (rcnt == 68) SpielerInfo[playerid][pLifeInsurance] = strval(Field);
if (rcnt == 69) SpielerInfo[playerid][pBoxMats] = strval(Field);
if (rcnt == 70) SpielerInfo[playerid][pBoxDrugs] = strval(Field);
if (rcnt == 71) SpielerInfo[playerid][pBoatLic] = strval(Field);
if (rcnt == 72) SpielerInfo[playerid][pFishLic] = strval(Field);
if (rcnt == 73) SpielerInfo[playerid][pGunLic] = strval(Field);
if (rcnt == 74) SpielerInfo[playerid][pGun1] = strval(Field);
if (rcnt == 75) SpielerInfo[playerid][pGun2] = strval(Field);
if (rcnt == 76) SpielerInfo[playerid][pGun3] = strval(Field);
if (rcnt == 77) SpielerInfo[playerid][pGun4] = strval(Field);
if (rcnt == 78) SpielerInfo[playerid][pGun5] = strval(Field);
if (rcnt == 79) SpielerInfo[playerid][pAmmo1] = strval(Field);
if (rcnt == 80) SpielerInfo[playerid][pAmmo2] = strval(Field);
if (rcnt == 81) SpielerInfo[playerid][pAmmo3] = strval(Field);
if (rcnt == 82) SpielerInfo[playerid][pAmmo4] = strval(Field);
if (rcnt == 83) SpielerInfo[playerid][pAmmo5] = strval(Field);
if (rcnt == 84) SpielerInfo[playerid][pCarTime] = strval(Field);
if (rcnt == 85) SpielerInfo[playerid][pPayDay] = strval(Field);
if (rcnt == 86) SpielerInfo[playerid][pPayDayHad] = strval(Field);
if (rcnt == 87) SpielerInfo[playerid][pCDPlayer] = strval(Field);
if (rcnt == 88) SpielerInfo[playerid][pWins] = strval(Field);
if (rcnt == 89) SpielerInfo[playerid][pLoses] = strval(Field);
if (rcnt == 90) SpielerInfo[playerid][pAlcoholPerk] = strval(Field);
if (rcnt == 91) SpielerInfo[playerid][pDrugPerk] = strval(Field);
if (rcnt == 92) SpielerInfo[playerid][pMiserPerk] = strval(Field);
if (rcnt == 93) SpielerInfo[playerid][pPainPerk] = strval(Field);
if (rcnt == 94) SpielerInfo[playerid][pTraderPerk] = strval(Field);
if (rcnt == 95) SpielerInfo[playerid][pTut] = strval(Field);
if (rcnt == 96) SpielerInfo[playerid][pWarns] = strval(Field);
if (rcnt == 97) SpielerInfo[playerid][pOnline] = strval(Field);
if (rcnt == 98) SpielerInfo[playerid][pFuel] = strval(Field);
if (rcnt == 99) SpielerInfo[playerid][pMarried] = strval(Field);
if (rcnt == 900) SpielerInfo[playerid][pMarriedTo] = strmid(SpielerInfo[playerid][pMarriedTo], Field, 0, strlen(Field)-1, 255);
if (rcnt == 101) Kampfstil[playerid] = strval(Field);
if (rcnt == 102) SpielerInfo[playerid][pSpawnChange] = strval(Field);
if (rcnt == 103) WantedLevel[playerid] = strval(Field);
if (rcnt == 104) SpielerInfo[playerid][pSFLic] = strval(Field);
if (rcnt == 105) SpielerInfo[playerid][pLVLic] = strval(Field);
if (rcnt == 106) SpielerInfo[playerid][pUhrID] = strval(Field);
if (rcnt == 107) SpielerInfo[playerid][pOwnPerso] = strval(Field);
if (rcnt == 108) SpielerInfo[playerid][pPinB] = strval(Field);
if (rcnt == 109) SpielerInfo[playerid][pHandyID] = strval(Field);
if (rcnt == 110) SpielerInfo[playerid][pHandyTon] = strval(Field);
if (rcnt == 111) SpielerInfo[playerid][pZigID] = strval(Field);
if (rcnt == 112) SpielerInfo[playerid][pZig] = strval(Field);
if (rcnt == 113) SpielerInfo[playerid][pZigSucht] = strval(Field);
if (rcnt == 114) SpielerInfo[playerid][pHandyGeld] = strval(Field);
if (rcnt == 115) SpielerInfo[playerid][pHandyVer] = strval(Field);
if (rcnt == 116) SpielerInfo[playerid][pGWD] = floatstr(Field);
if (rcnt == 117) SpielerInfo[playerid][pPlayMinutes] = strval(Field);
if (rcnt == 118) SpielerInfo[playerid][pGesamtMinutes] = strval(Field);
if (rcnt == 119) OfflineFlucht[playerid] = strval(Field);
if (rcnt == 120) SpielerInfo[playerid][pGehalt] = strval(Field);
rcnt++;
}
samp_mysql_free_result();
}
SpielerInfo[playerid][pOnline] = 1;
AC_BS_ResetPlayerMoney(playerid);
ConsumingMoney[playerid] = 1;
PlayerMoney[playerid] = SpielerInfo[playerid][pCash];
CurrentMoney[playerid] = SpielerInfo[playerid][pCash];
if(SpielerInfo[playerid][pReg] == 0)
{
SpielerInfo[playerid][pSHealth] = 20.0;
SpielerInfo[playerid][pHealth] = 50.0;
SpielerInfo[playerid][pPos_x] = 2246.6;
SpielerInfo[playerid][pPos_y] = -1161.9;
SpielerInfo[playerid][pPos_z] = 1029.7;
SpielerInfo[playerid][pInt] = 15;
SpielerInfo[playerid][pLocal] = 999;
SpielerInfo[playerid][pTeam] = 3;
SpielerInfo[playerid][pModel] = 22;
new randphone = 1000 + random(18999);//minimum 1000 max 19999 //giving one at the start
SpielerInfo[playerid][pPnumber] = randphone;
SpielerInfo[playerid][pPhousekey] = 999;
SpielerInfo[playerid][pPbiskey] = 999;
SpielerInfo[playerid][pAccount] = 1000;
SpielerInfo[playerid][pSpawnChange] = 0;
SpielerInfo[playerid][pReg] = 1;
PlayerMoney[playerid] = PlayerMoney[playerid]+200;
}
if(SpielerInfo[playerid][pLevel] == -999) //autoban
{
Ban(playerid);
}
else if(SpielerInfo[playerid][pCK] > 0)
{
Kick(playerid);
}
format(string2, sizeof(string2), "SERVER: Willkommen %s",playername2);
SendClientMessage(playerid, COLOR_WHITE,string2);
printf("%s has logged in.",playername2);
if (SpielerInfo[playerid][pDonateRank] > 0)
{
SendClientMessage(playerid, COLOR_WHITE,"SERVER: Du bist Premium Nutzer.");
}
if (SpielerInfo[playerid][pAdmin] > 0)
{
format(string2, sizeof(string2), "SERVER: Du bist als Level %d Admin eingeloggt.",SpielerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_WHITE,string2);
}
SetSpawnInfo(playerid, SpielerInfo[playerid][pTeam], SpielerInfo[playerid][pModel], SpielerInfo[playerid][pPos_x], SpielerInfo[playerid][pPos_y], SpielerInfo[playerid][pPos_z], 1.0, -1, -1, -1, -1, -1, -1);
if(gTeam[playerid] == 0)
{
gTeam[playerid] = 3;
}
else
{
gTeam[playerid] = SpielerInfo[playerid][pTeam];
}
gPlayerLogged[playerid] = 1;
SpawnPlayer(playerid);
if(WantedLevel[playerid] == 1) { WantedPoints[playerid] = 2; }
else if(WantedLevel[playerid] == 2) { WantedPoints[playerid] = 4; }
else if(WantedLevel[playerid] == 3) { WantedPoints[playerid] = 6; }
else if(WantedLevel[playerid] == 4) { WantedPoints[playerid] = 8; }
else if(WantedLevel[playerid] == 5) { WantedPoints[playerid] = 10; }
else if(WantedLevel[playerid] == 6) { WantedPoints[playerid] = 12; }
format(tmp2, sizeof(tmp2), "~w~Willkommen~n~~y~%s", playername2);
DateProp(playerid);
SetPlayerWantedLevel(playerid,WantedLevel[playerid]);
GameTextForPlayer(playerid, tmp2, 5000, 1);
PlayerUpdate(playerid);
if(OfflineFlucht[playerid] == 1 && WantedLevel[playerid] > 0)
{
SendClientMessage(playerid,COLOR_LIGHTRED, "* Du wurdest Eingesperrt weil du Offline-Flucht begangen hast!");
SendClientMessage(playerid,COLOR_LIGHTRED, "* Pro WantedLevel 10 Minuten + 30 Minuten Strafe!");
new sendername[MAX_PLAYER_NAME],string[100];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "*[Auto-Jail] %s wurde wegen Offline-Flucht eingesperrt.", sendername);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsACop(i))
{
SendClientMessage(i,COLOR_ALLDEPT,string);
}
}
OfflineFlucht[playerid] = 0;
ResetPlayerWeapons(playerid);
new wlevel = WantedLevel[playerid];
SpielerInfo[playerid][pJailed] = 1;
SpielerInfo[playerid][pJailTime] = (wlevel*600)+1800;
AC_BS_SetPlayerInterior(playerid, 3);
AC_BS_SetPlayerPos(playerid,198.9297,162.2798,1003.0300);
WantedPoints[playerid] = 0;
SetPlayerWantedLevel(playerid,0);
WantedLevel[playerid] = 0;
return 1;
}
else if(OfflineFlucht[playerid] == 1 && WantedLevel[playerid] == 0)
{
SendClientMessage(playerid,COLOR_LIGHTRED, "* Du wurdest eingesperrt weil du Offline-Flucht begangen hast!");
new sendername[MAX_PLAYER_NAME],string[100];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "*[Auto-Jail] %s wurde wegen Offline-Flucht eingesperrt.", sendername);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsACop(i))
{
SendClientMessage(i,COLOR_ALLDEPT,string);
}
}
OfflineFlucht[playerid] = 0;
ResetPlayerWeapons(playerid);
SpielerInfo[playerid][pJailed] = 1;
SpielerInfo[playerid][pJailTime] = 300;
AC_BS_SetPlayerInterior(playerid, 3);
AC_BS_SetPlayerPos(playerid,198.9297,162.2798,1003.0300);
WantedPoints[playerid] = 0;
SetPlayerWantedLevel(playerid,0);
WantedLevel[playerid] = 0;
return 1;
}
if(OfflineFlucht[playerid] == 2 && WantedLevel[playerid] > 0)
{
SendClientMessage(playerid,COLOR_LIGHTRED, "* Du wurdest Eingesperrt weil du Knast Deathmatch gemacht hast!");
SendClientMessage(playerid,COLOR_LIGHTRED, "* Pro WantedLevel 10 Minuten + 20 Minuten Strafe!");
new sendername[MAX_PLAYER_NAME],string[100];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "*[Auto-Jail] %s wurde wegen KnastDM eingesperrt.", sendername);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsACop(i))
{
SendClientMessage(i,COLOR_ALLDEPT,string);
}
}
OfflineFlucht[playerid] = 0;
ResetPlayerWeapons(playerid);
new wlevel = WantedLevel[playerid];
SpielerInfo[playerid][pJailed] = 1;
SpielerInfo[playerid][pJailTime] = (wlevel*600)+1200;
AC_BS_SetPlayerInterior(playerid, 3);
AC_BS_SetPlayerPos(playerid,198.9297,162.2798,1003.0300);
WantedPoints[playerid] = 0;
SetPlayerWantedLevel(playerid,0);
WantedLevel[playerid] = 0;
return 1;
}
for(new fs;fs<sizeof(FightSystem);fs++)
{
GangZoneShowForPlayer(playerid,FightSystem[fs][fsZoneID],GetZoneColorOfFaction(FightSystem[fs][fsOwnerFaction]));
}
if(SpielerInfo[playerid][pAdmin] >= 1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(Audio_IsClientConnected(i))
{
Audio_Play(i, 20, false, false, false);
}
}
}
return 1;
}
Die Dialoge
if(dialogid == DIALOG_LOGIN)
{
if(response && strlen(inputtext) > 0)
{
MySQLFetchAcctSingle(SpielerInfo[playerid][pSQLID], "Password", SpielerInfo[playerid][pKey]);
if(strcmp(SpielerInfo[playerid][pKey],inputtext, true ) == 0 )
{
print("Vor Onplayerlogin");
OnPlayerLogin(playerid,inputtext);
}
else
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Das Passwort ist nicht korrekt! Bitte gib nun dein richtiges Passwort ein:","Login","Abbrechen");
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 1)
{
SendClientMessage(playerid,COLOR_GREEN,"Falsches Passwort! [1/4]");
}
if(gPlayerLogTries[playerid] == 2)
{
SendClientMessage(playerid,COLOR_YELLOW,"Falsches Passwort! [2/4]");
}
if(gPlayerLogTries[playerid] == 3)
{
SendClientMessage(playerid,TEAM_ORANGE_COLOR,"Falsches Passwort! [3/4]");
}
if(gPlayerLogTries[playerid] == 4)
{
SendClientMessage(playerid,COLOR_RED,"Falsches Passwort! [4/4]");
Ban(playerid);
}
}
}
else
{
Kick(playerid);
}
return 1;
}