Ich hab wieder folgendes Problem, wenn ich auf den Server connecte und mein Passwort eingebe egal ob Login oder Register sobald ich auf Enter drücke kommt dort
Server Closed the Connection. Ich weiß nicht weiter weil ich schon alles versucht habe im Rahmen meiner Erfahrungen.
stock SavePlayer(playerid)
{
if(!IsPlayerConnected(playerid) || IsPlayerNPC(playerid))return 0;
new query[3000], sname[MAX_PLAYER_NAME];
GetPlayerName(playerid,sname,sizeof(sname));
PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid), PlayerInfo[playerid][pLevel] = GetPlayerScore(playerid);
format(query,sizeof query,"UPDATE `spieler` SET `Level`='%d', `Admin`='%d', `DonateRank`='%d', `Reg`='%d', `Sex`='%d', `Age`='%d', `Origin`='%d', `CK`='%d', `Muted`='%d', `Exp`='%d' , `Cash`='%d', `Account`='%d', `Crimes`='%d'",
PlayerInfo[playerid][pLevel],PlayerInfo[playerid][pAdmin],PlayerInfo[playerid][pDonateRank],PlayerInfo[playerid][pReg],PlayerInfo[playerid][pSex],PlayerInfo[playerid][pAge],PlayerInfo[playerid][pOrigin],PlayerInfo[playerid][pCK],PlayerInfo[playerid][pMuted],PlayerInfo[playerid][pExp],PlayerInfo[playerid][pCash],PlayerInfo[playerid][pAccount],PlayerInfo[playerid][pCrimes]);
format(query,sizeof query,"%s,`Arrested`='%d', `WantedDeaths`='%d', `PhoneBook`='%d', `LottoNr`='%d', `Job`='%d', `PayCheck`='%d'",
query,PlayerInfo[playerid][pArrested],PlayerInfo[playerid][pWantedDeaths],PlayerInfo[playerid][pPhoneBook],PlayerInfo[playerid][pLottoNr],PlayerInfo[playerid][pJob],PlayerInfo[playerid][pPayCheck]);
format(query,sizeof query,"%s,`HeadValue`='%d',`Jailed`='%d',`JailTime`='%d',`GangJailed`='%d',`Mauled`='%d',`Mats`='%d',`Drugs`='%d',`Leader`='%d',`Member`='%d',`FMember`='%d',`Rank`='%d',`Health`='%.2f',`SHealth`='%.2f'",
query,PlayerInfo[playerid][pHeadValue],PlayerInfo[playerid][pJailed],PlayerInfo[playerid][pJailTime],PlayerInfo[playerid][pGangJailed],PlayerInfo[playerid][pMauled],PlayerInfo[playerid][pMats],PlayerInfo[playerid][pDrugs],PlayerInfo[playerid][pLeader],PlayerInfo[playerid][pMember],PlayerInfo[playerid][pFMember],PlayerInfo[playerid][pRank],PlayerInfo[playerid][pHealth],PlayerInfo[playerid][pSHealth]);
format(query,sizeof query,"%s,`Int`='%d',`Local`='%d',`Team`='%d',`Model`='%d',`Pnumber`='%d'",
query,PlayerInfo[playerid][pInt],PlayerInfo[playerid][pLocal],PlayerInfo[playerid][pTeam],PlayerInfo[playerid][pModel],PlayerInfo[playerid][pPnumber]),
format(query,sizeof query,"%s,`Phousekey`='%d',`Pbiskey`='%d',`CarLic`='%d',`NewLic`='%d',`FlyLic`='%d',`Pos_x`='%.4f',`Pos_y`='%.4f',`Pos_z`='%.4f',`BoatLic`='%d',`FishLic`='%d',`GunLic`='%d',`LKWLic`='%d',`RollerLic`='%d',`MotoLic`='%d',`Zig`='%d',`ZigSucht`='%d'",
query,PlayerInfo[playerid][pPhousekey],PlayerInfo[playerid][pPbiskey],PlayerInfo[playerid][pCarLic],PlayerInfo[playerid][pNewLic],PlayerInfo[playerid][pFlyLic],PlayerInfo[playerid][pPos_x],PlayerInfo[playerid][pPos_y],PlayerInfo[playerid][pPos_z],PlayerInfo[playerid][pBoatLic],PlayerInfo[playerid][pFishLic],PlayerInfo[playerid][pGunLic],PlayerInfo[playerid][pLKWLic],PlayerInfo[playerid][pRollerLic],PlayerInfo[playerid][pMotoLic],PlayerInfo[playerid][pZig],PlayerInfo[playerid][pZigSucht]);
format(query,sizeof query,"%s,`Mulltime`='%d',`PayDay`='%d',`PayDayHad`='%d',`AlcoholPerk`='%d',`Warns`='%d',`Adjustable`='%d',`Fuel`='%d',`Married`='%d',`MarriedTo`='%s',`InvDrugs`='%d'",
query,PlayerInfo[playerid][pMulltime],PlayerInfo[playerid][pPayDay],PlayerInfo[playerid][pPayDayHad],PlayerInfo[playerid][pAlcoholPerk],PlayerInfo[playerid][pWarns],PlayerInfo[playerid][pAdjustable],PlayerInfo[playerid][pFuel],PlayerInfo[playerid][pMarried],PlayerInfo[playerid][pMarriedTo],PlayerInfo[playerid][pInvDrugs]);
format(query,sizeof query,"%s,`InvMats`='%d',`Roadblock`='%d',`PlayMinutes`='%d',`GesamtMinutes`='%d',`MinutesSinceLogin`='%d',`MinutesSinceAn`='%d'",
query,PlayerInfo[playerid][pInvMats],PlayerInfo[playerid][pRoadblock],PlayerInfo[playerid][pPlayMinutes],PlayerInfo[playerid][pGesamtMinutes],PlayerInfo[playerid][pMinutesSinceLogin],PlayerInfo[playerid][pMinutesSinceAn]);
format(query,sizeof query,"%s,`HandyGeld`='%d',`HandyVer`='%d',`UhrID`='%d',`HandyID`='%d',`OwnPerso`='%d',`OwnAntrag`='%d',`PersoStop`='%d',`Gehalt`='%d',`FrakSperre`='%d',`BoxMats`='%d',`BoxDrugs`='%d',`Tot`='%d',`Meldung`='%d',`Ptankekey`='%d'",
query,PlayerInfo[playerid][pHandyGeld],PlayerInfo[playerid][pHandyVer],PlayerInfo[playerid][pUhrID],PlayerInfo[playerid][pHandyID],PlayerInfo[playerid][pOwnPerso],PlayerInfo[playerid][pOwnAntrag],PlayerInfo[playerid][pPersoStop],PlayerInfo[playerid][pGehalt],PlayerInfo[playerid][pFrakSperre],PlayerInfo[playerid][pBoxMats],PlayerInfo[playerid][pBoxDrugs],PlayerInfo[playerid][pTot],PlayerInfo[playerid][pMeldung],PlayerInfo[playerid][pPtankekey]);
format(query,sizeof query,"%s,`Gesperrt`='%d',`Contract`='%d',`Notruf`='%d',`Navi`='%d',`Skin`='%d',`Sprengstoff`='%d',`Hotel`='%d',`TutorialLevel`='%d',`Wohnung`='%d',`JobGehalt`='%d',`BusSkill`='%d',`Tut`='%d' WHERE `Name`='%s'",
query,PlayerInfo[playerid][pGesperrt],PlayerInfo[playerid][pContract],PlayerInfo[playerid][pNotruf],PlayerInfo[playerid][pNavi],PlayerInfo[playerid][pSkin],PlayerInfo[playerid][pSprengstoff],PlayerInfo[playerid][pHotel],PlayerInfo[playerid][pTutorialLevel],PlayerInfo[playerid][pWohnung],PlayerInfo[playerid][pJobGehalt],PlayerInfo[playerid][pBusSkill],PlayerInfo[playerid][pTut],sname);
printf("Die Speicherung für %s wurde aufgerufen!",sname),print(query);
mysql_query(query);
strdel(query,0,sizeof(query));
return 1;
}
stock LoadPlayer(playerid)
{
if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
{
new query[1024],sname[MAX_PLAYER_NAME];
GetPlayerName(playerid,sname,sizeof(sname));
format(query,sizeof(query),"SELECT * FROM `spieler` WHERE `Name`='%s'",sname);
mysql_query(query);
mysql_store_result(dbhandle);
print(query),printf("Das laden von %s wurde ausgeführt!",sname);
while(mysql_retrieve_row(dbhandle))
{
mysql_fetch_field_row(query, "Level"),PlayerInfo[playerid][pLevel]=strval(query);
mysql_fetch_field_row(query, "Admin"),PlayerInfo[playerid][pAdmin]=strval(query);
mysql_fetch_field_row(query, "DonateRank"),PlayerInfo[playerid][pDonateRank]=strval(query);
mysql_fetch_field_row(query, "Reg"),PlayerInfo[playerid][pReg]=strval(query);
mysql_fetch_field_row(query, "Sex"),PlayerInfo[playerid][pSex]=strval(query);
mysql_fetch_field_row(query, "Age"),PlayerInfo[playerid][pAge]=strval(query);
mysql_fetch_field_row(query, "Origin"),PlayerInfo[playerid][pOrigin]=strval(query);
mysql_fetch_field_row(query, "CK"),PlayerInfo[playerid][pCK]=strval(query);
mysql_fetch_field_row(query, "Muted"),PlayerInfo[playerid][pMuted]=strval(query);
mysql_fetch_field_row(query, "Exp"),PlayerInfo[playerid][pExp]=strval(query);
mysql_fetch_field_row(query, "Cash"),PlayerInfo[playerid][pCash]=strval(query);
mysql_fetch_field_row(query, "Account"),PlayerInfo[playerid][pAccount]=strval(query);
mysql_fetch_field_row(query, "Crimes"),PlayerInfo[playerid][pCrimes]=strval(query);
mysql_fetch_field_row(query, "Arrested"),PlayerInfo[playerid][pArrested]=strval(query);
mysql_fetch_field_row(query, "WantedDeaths"),PlayerInfo[playerid][pWantedDeaths]=strval(query);
mysql_fetch_field_row(query, "PhoneBook"),PlayerInfo[playerid][pPhoneBook]=strval(query);
mysql_fetch_field_row(query, "LottoNr"),PlayerInfo[playerid][pLottoNr]=strval(query);
mysql_fetch_field_row(query, "Job"),PlayerInfo[playerid][pJob]=strval(query);
mysql_fetch_field_row(query, "PayCheck"),PlayerInfo[playerid][pPayCheck]=strval(query);
mysql_fetch_field_row(query, "HeadValue"),PlayerInfo[playerid][pHeadValue]=strval(query);
mysql_fetch_field_row(query, "Jailed"),PlayerInfo[playerid][pJailed]=strval(query);
mysql_fetch_field_row(query, "JailTime"),PlayerInfo[playerid][pJailTime]=strval(query);
mysql_fetch_field_row(query, "GangJailed"),PlayerInfo[playerid][pGangJailed]=strval(query);
mysql_fetch_field_row(query, "Mauled"),PlayerInfo[playerid][pMauled]=strval(query);
mysql_fetch_field_row(query, "Mats"),PlayerInfo[playerid][pMats]=strval(query);
mysql_fetch_field_row(query, "Drugs"),PlayerInfo[playerid][pDrugs]=strval(query);
mysql_fetch_field_row(query, "Leader"),PlayerInfo[playerid][pLeader]=strval(query);
mysql_fetch_field_row(query, "Member"),PlayerInfo[playerid][pMember]=strval(query);
mysql_fetch_field_row(query, "FMember"),PlayerInfo[playerid][pFMember]=strval(query);
mysql_fetch_field_row(query, "Rank"),PlayerInfo[playerid][pRank]=strval(query);
mysql_fetch_field_row(query, "Health"),PlayerInfo[playerid][pHealth]=strval(query);
mysql_fetch_field_row(query, "SHealth"),PlayerInfo[playerid][pSHealth]=strval(query);
mysql_fetch_field_row(query, "Int"),PlayerInfo[playerid][pInt]=strval(query);
mysql_fetch_field_row(query, "Local"),PlayerInfo[playerid][pLocal]=strval(query);
mysql_fetch_field_row(query, "Team"),PlayerInfo[playerid][pTeam]=strval(query);
mysql_fetch_field_row(query, "Model"),PlayerInfo[playerid][pModel]=strval(query);
mysql_fetch_field_row(query, "Pnumber"),PlayerInfo[playerid][pPnumber]=strval(query);
mysql_fetch_field_row(query, "Phousekey"),PlayerInfo[playerid][pPhousekey]=strval(query);
mysql_fetch_field_row(query, "Pbiskey"),PlayerInfo[playerid][pPbiskey]=strval(query);
mysql_fetch_field_row(query, "CarLic"),PlayerInfo[playerid][pCarLic]=strval(query);
mysql_fetch_field_row(query, "NewLic"),PlayerInfo[playerid][pNewLic]=strval(query);
mysql_fetch_field_row(query, "FlyLic"),PlayerInfo[playerid][pFlyLic]=strval(query);
mysql_fetch_field_row(query, "Pos_x"),PlayerInfo[playerid][pPos_x]=strval(query);
mysql_fetch_field_row(query, "Pos_y"),PlayerInfo[playerid][pPos_y]=strval(query);
mysql_fetch_field_row(query, "Pos_z"),PlayerInfo[playerid][pPos_z]=strval(query);
mysql_fetch_field_row(query, "BoatLic"),PlayerInfo[playerid][pBoatLic]=strval(query);
mysql_fetch_field_row(query, "FishLic"),PlayerInfo[playerid][pFishLic]=strval(query);
mysql_fetch_field_row(query, "GunLic"),PlayerInfo[playerid][pGunLic]=strval(query);
mysql_fetch_field_row(query, "LKWLic"),PlayerInfo[playerid][pLKWLic]=strval(query);
mysql_fetch_field_row(query, "RollerLic"),PlayerInfo[playerid][pRollerLic]=strval(query);
mysql_fetch_field_row(query, "MotoLic"),PlayerInfo[playerid][pMotoLic]=strval(query);
mysql_fetch_field_row(query, "Zig"),PlayerInfo[playerid][pZig]=strval(query);
mysql_fetch_field_row(query, "ZigSucht"),PlayerInfo[playerid][pZigSucht]=strval(query);
mysql_fetch_field_row(query, "Mulltime"),PlayerInfo[playerid][pMulltime]=strval(query);
mysql_fetch_field_row(query, "PayDay"),PlayerInfo[playerid][pPayDay]=strval(query);
mysql_fetch_field_row(query, "PayDayHad"),PlayerInfo[playerid][pPayDayHad]=strval(query);
mysql_fetch_field_row(query, "AlcoholPerk"),PlayerInfo[playerid][pAlcoholPerk]=strval(query);
mysql_fetch_field_row(query, "Warns"),PlayerInfo[playerid][pWarns]=strval(query);
mysql_fetch_field_row(query, "Adjustable"),PlayerInfo[playerid][pAdjustable]=strval(query);
mysql_fetch_field_row(query, "Fuel"),PlayerInfo[playerid][pFuel]=strval(query);
mysql_fetch_field_row(query, "Married"),PlayerInfo[playerid][pMarried]=strval(query);
mysql_fetch_field_row(query, "MarriedTo"),PlayerInfo[playerid][pMarriedTo]=strval(query);
mysql_fetch_field_row(query, "InvDrugs"),PlayerInfo[playerid][pInvDrugs]=strval(query);
mysql_fetch_field_row(query, "InvMats"),PlayerInfo[playerid][pInvMats]=strval(query);
mysql_fetch_field_row(query, "Roadblock"),PlayerInfo[playerid][pRoadblock]=strval(query);
mysql_fetch_field_row(query, "PlayMinutes"),PlayerInfo[playerid][pPlayMinutes]=strval(query);
mysql_fetch_field_row(query, "GesamtMinutes"),PlayerInfo[playerid][pGesamtMinutes]=strval(query);
mysql_fetch_field_row(query, "MinutesSinceLogin"),PlayerInfo[playerid][pMinutesSinceLogin]=strval(query);
mysql_fetch_field_row(query, "MinutesSinceAn"),PlayerInfo[playerid][pMinutesSinceAn]=strval(query);
mysql_fetch_field_row(query, "HandyGeld"),PlayerInfo[playerid][pHandyGeld]=strval(query);
mysql_fetch_field_row(query, "HandyVer"),PlayerInfo[playerid][pHandyVer]=strval(query);
mysql_fetch_field_row(query, "UhrID"),PlayerInfo[playerid][pUhrID]=strval(query);
mysql_fetch_field_row(query, "HandyID"),PlayerInfo[playerid][pHandyID]=strval(query);
mysql_fetch_field_row(query, "OwnPerso"),PlayerInfo[playerid][pOwnPerso]=strval(query);
mysql_fetch_field_row(query, "OwnAntrag"),PlayerInfo[playerid][pOwnAntrag]=strval(query);
mysql_fetch_field_row(query, "PersoStop"),PlayerInfo[playerid][pPersoStop]=strval(query);
mysql_fetch_field_row(query, "Gehalt"),PlayerInfo[playerid][pGehalt]=strval(query);
mysql_fetch_field_row(query, "FrakSperre"),PlayerInfo[playerid][pFrakSperre]=strval(query);
mysql_fetch_field_row(query, "BoxMats"),PlayerInfo[playerid][pBoxMats]=strval(query);
mysql_fetch_field_row(query, "BoxDrugs"),PlayerInfo[playerid][pBoxDrugs]=strval(query);
mysql_fetch_field_row(query, "Tot"),PlayerInfo[playerid][pTot]=strval(query);
mysql_fetch_field_row(query, "Meldung"),PlayerInfo[playerid][pMeldung]=strval(query);
mysql_fetch_field_row(query, "Ptankekey"),PlayerInfo[playerid][pPtankekey]=strval(query);
mysql_fetch_field_row(query, "Gesperrt"),PlayerInfo[playerid][pGesperrt]=strval(query);
mysql_fetch_field_row(query, "Contract"),PlayerInfo[playerid][pContract]=strval(query);
mysql_fetch_field_row(query, "Notruf"),PlayerInfo[playerid][pNotruf]=strval(query);
mysql_fetch_field_row(query, "Navi"),PlayerInfo[playerid][pNavi]=strval(query);
mysql_fetch_field_row(query, "Skin"),PlayerInfo[playerid][pSkin]=strval(query);
mysql_fetch_field_row(query, "Sprengstoff"),PlayerInfo[playerid][pSprengstoff]=strval(query);
mysql_fetch_field_row(query, "Hotel"),PlayerInfo[playerid][pHotel]=strval(query);
mysql_fetch_field_row(query, "TutorialLevel"),PlayerInfo[playerid][pTutorialLevel]=strval(query);
mysql_fetch_field_row(query, "Wohnung"),PlayerInfo[playerid][pWohnung]=strval(query);
mysql_fetch_field_row(query, "JobGehalt"),PlayerInfo[playerid][pJobGehalt]=strval(query);
mysql_fetch_field_row(query, "BusSkill"),PlayerInfo[playerid][pBusSkill]=strval(query);
mysql_fetch_field_row(query, "Tut"),PlayerInfo[playerid][pTut]=strval(query);
}
mysql_free_result(dbhandle);
}
return 1;
}
stock Connect_To_Database()
{
mysql_connect(SQL_HOST, SQL_USER, SQL_DATA, SQL_PASS);
if(mysql_ping() == 1)
{
print("<-| [MYSQL] Verbindung zur Datenbank wurde erfolgreich hergestellt!");
return true;
}
else
{
print("<-| [MYSQL] Es konnte keine Verbindung zur Datenbank hergestellt werden!");
print("<-| [MYSQL] Es wird erneut versucht eine Verbindung zur Datenbank herzustellen!");
mysql_connect(SQL_HOST, SQL_USER, SQL_DATA, SQL_PASS);
if(mysql_ping() == 1)
{
print("<-| [MYSQL] Es konnte im 2 Versuch eine Verbindung hergestellt werden!");
return true;
}
else
{
print("<-| [MYSQL] Es konnte keine Verbindung zur Datenbank hergestellt werden!");
print("<-| [MYSQL] Der Server wird nun beendet!");
SendRconCommand("exit");
return true;
}
}
}
stock mysql_CheckAccount(playerid)
{
new Query[128],Name[MAX_PLAYER_NAME],count;
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
mysql_real_escape_string(Name, Name);
format(Query, sizeof(Query), "SELECT * FROM `spieler` WHERE `Name` = '%s'", Name);
mysql_query(Query);
mysql_store_result();
count = mysql_num_rows();
mysql_free_result();
return count;
}
stock CreateAccount(playerid, pass[])
{
new query[256],Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
mysql_real_escape_string(Name,Name);
mysql_real_escape_string(pass,pass);
format(query, sizeof(query), "INSERT INTO `spieler` (`Name`, `Passwort`) VALUES ('%s', '%s')", Name, pass);
mysql_query(query);
return true;
}
stock mysql_ReturnPasswort(Name[])
{
new query[130], Get[130];
mysql_real_escape_string(Name, Name);
format(query, 128, "SELECT `Passwort` FROM `spieler` WHERE `Name` = '%s'", Name);
mysql_query(query);
mysql_store_result();
mysql_fetch_row(Get);
mysql_free_result();
return Get;
}
PS: Eine Datenbank wurde auch erstellt und die funktioniert weil Name und Passwort etc gespeichert wird.
MfG