29.06.2015, 16:48
So, i connect to my server, i type a password. It says that i registered and i need to type again my password. Then it says that the password is wrong, but it isnt. I tried with many accounts but nothing..
Here is my playerregister:
And here is a part of playerlogin:
This here is my problem, on this "else" is going my script:
I dunno if it is from script or from mysql 'cuz i have some errors on mysql log:
The 2nd one is repeting multiple times.
Here is my playerregister:
Код:
public OnPlayerRegister(playerid, password[]) { if(IsPlayerConnected(playerid)) { new playername3[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername3, sizeof(playername3)); new Str[200]; format(Str,sizeof(Str),"INSERT INTO `users` (`name`,`password`) VALUES ('%s','%s')",playername3,password); mysql_query(SQL,Str); strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 255); PlayerInfo[playerid][pCash] = GetPlayerCash(playerid); GetPlayerHealthEx(playerid,PlayerInfo[playerid][pHealth]); if ((PlayerInfo[playerid][pPos_x]==0.0 && PlayerInfo[playerid][pPos_y]==0.0 && PlayerInfo[playerid][pPos_z]==0.0)) { PlayerInfo[playerid][pPos_x] = 2246.6; PlayerInfo[playerid][pPos_y] = -1161.9; PlayerInfo[playerid][pPos_z] = 1029.7; } 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]; } new wakaname[25]; GetPlayerName(playerid,wakaname,25); new str[128]; format(str,128,"UPDATE users SET `pHealth`='%.1f' WHERE `name`='%s'",PlayerInfo[playerid][pHealth],wakaname); mysql_query(SQL,str); new loginstring[128]; new loginname[64]; GetPlayerName(playerid,loginname,sizeof(loginname)); format(loginstring,sizeof(loginstring),"Cont inregistrat , te poti loga acum prin introducerea parolei mai jos.",loginname); ShowPlayerDialog(playerid,DIALOG_LOGIN2,DIALOG_STYLE_PASSWORD,"Logare",loginstring,"Logare","Iesire"); return 1; } return 1; }
Код:
public OnPlayerLogin(playerid,password[]) { new playername2[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername2, sizeof(playername2)); GameTextForPlayer(playerid, "~w~LOADING...", 1500, 5); new qstr[100]; new result[456]; format(qstr,100,"SELECT * FROM users WHERE `name`='%s' AND `password`='%s'",playername2,password); mysql_query(SQL,qstr); mysql_store_result(); if(mysql_num_rows() > 0) { if(mysql_retrieve_row()) { mysql_fetch_field_row(result,"password"); format(PlayerInfo[playerid][pKey], 128, result); mysql_fetch_field_row(result,"Level"); PlayerInfo[playerid][pLevel] = strval( result ); mysql_fetch_field_row(result,"Admin"); PlayerInfo[playerid][pAdmin] = strval( result ); mysql_fetch_field_row(result,"Helper"); PlayerInfo[playerid][pHelper] = strval( result ); mysql_fetch_field_row(result,"Premium"); PlayerInfo[playerid][pPremiumAccount] = strval( result ); mysql_fetch_field_row(result,"ConnectedTime"); PlayerInfo[playerid][pConnectTime] = strval( result ); mysql_fetch_field_row(result,"Registered"); PlayerInfo[playerid][pReg] = strval( result ); mysql_fetch_field_row(result,"Sex"); PlayerInfo[playerid][pSex] = strval( result ); mysql_fetch_field_row(result,"Age"); PlayerInfo[playerid][pAge] = strval( result ); mysql_fetch_field_row(result,"Origin"); PlayerInfo[playerid][pOrigin] = strval( result ); mysql_fetch_field_row(result,"Muted"); PlayerInfo[playerid][pMuted] = strval( result ); mysql_fetch_field_row(result,"MuteTime"); PlayerInfo[playerid][pMuteTime] = strval( result ); mysql_fetch_field_row(result,"Respect"); PlayerInfo[playerid][pExp] = strval( result ); mysql_fetch_field_row(result,"Money"); PlayerInfo[playerid][pCash] = strval( result ); mysql_fetch_field_row(result,"Bank"); PlayerInfo[playerid][pAccount] = strval( result ); mysql_fetch_field_row(result,"Crimes"); PlayerInfo[playerid][pCrimes] = strval( result ); mysql_fetch_field_row(result,"Kills"); PlayerInfo[playerid][pKills] = strval( result ); mysql_fetch_field_row(result,"Deaths"); PlayerInfo[playerid][pDeaths] = strval( result ); mysql_fetch_field_row(result,"Arrested"); PlayerInfo[playerid][pArrested] = strval( result ); mysql_fetch_field_row(result,"WantedDeaths"); PlayerInfo[playerid][pWantedDeaths] = strval( result ); mysql_fetch_field_row(result,"Phonebook"); PlayerInfo[playerid][pPhoneBook] = strval( result ); mysql_fetch_field_row(result,"LottoNr"); PlayerInfo[playerid][pLottoNr] = strval( result ); mysql_fetch_field_row(result,"WantedLevel"); PlayerInfo[playerid][pWantedLevel] = strval( result ); mysql_fetch_field_row(result,"Fishes"); PlayerInfo[playerid][pFishes] = strval( result ); mysql_fetch_field_row(result,"RFishes"); PlayerInfo[playerid][pRFishes] = strval( result ); mysql_fetch_field_row(result,"Job"); PlayerInfo[playerid][pJob] = strval( result ); mysql_fetch_field_row(result,"Paycheck"); PlayerInfo[playerid][pPayCheck] = strval( result ); mysql_fetch_field_row(result,"HeadValue"); PlayerInfo[playerid][pHeadValue] = strval( result ); mysql_fetch_field_row(result,"Jailed"); PlayerInfo[playerid][pJailed] = strval( result ); mysql_fetch_field_row(result,"JailTime"); PlayerInfo[playerid][pJailTime] = strval( result ); mysql_fetch_field_row(result,"Materials"); PlayerInfo[playerid][pMats] = strval( result ); mysql_fetch_field_row(result,"Drugs"); PlayerInfo[playerid][pDrugs] = strval( result ); mysql_fetch_field_row(result,"Leader"); PlayerInfo[playerid][pLeader] = strval( result ); mysql_fetch_field_row(result,"Member"); PlayerInfo[playerid][pMember] = strval( result ); mysql_fetch_field_row(result,"Rank"); PlayerInfo[playerid][pRank] = strval( result ); mysql_fetch_field_row(result,"CChar"); PlayerInfo[playerid][pChar] = strval( result ); mysql_fetch_field_row(result,"FWarn"); PlayerInfo[playerid][pFACWarns] = strval( result ); mysql_fetch_field_row(result,"FPunish"); PlayerInfo[playerid][pFpunish] = strval( result ); mysql_fetch_field_row(result,"Acceptpoints"); PlayerInfo[playerid][pLawyer] = strval( result ); mysql_fetch_field_row(result,"SexSkill"); PlayerInfo[playerid][pSexSkill] = strval( result ); mysql_fetch_field_row(result,"LawSkill"); PlayerInfo[playerid][pLawSkill] = strval( result ); mysql_fetch_field_row(result,"MechSkill"); PlayerInfo[playerid][pMechSkill] = strval( result ); mysql_fetch_field_row(result,"NewsSkill"); PlayerInfo[playerid][pNewsSkill] = strval( result ); mysql_fetch_field_row(result,"DrugsSkill"); PlayerInfo[playerid][pDrugsSkill] = strval( result ); mysql_fetch_field_row(result,"MuncitorSkill"); PlayerInfo[playerid][pMuncitorSkill] = strval( result ); mysql_fetch_field_row(result,"CamiongiuSkill"); PlayerInfo[playerid][pCamiongiuSkill] = strval( result ); mysql_fetch_field_row(result,"FishSkill"); PlayerInfo[playerid][pFishSkill] = strval( result ); mysql_fetch_field_row(result,"MatSkill"); PlayerInfo[playerid][pMatSkill] = strval( result ); mysql_fetch_field_row(result,"RobSkill"); PlayerInfo[playerid][pRobSkill] = strval( result ); mysql_fetch_field_row(result,"pHealth"); PlayerInfo[playerid][pHealth] = floatstr( result ); mysql_fetch_field_row(result,"Inter"); PlayerInfo[playerid][pInt] = strval( result ); mysql_fetch_field_row(result,"Local"); PlayerInfo[playerid][pLocal] = strval( result ); mysql_fetch_field_row(result,"Team"); PlayerInfo[playerid][pTeam] = strval( result ); mysql_fetch_field_row(result,"Model"); PlayerInfo[playerid][pModel] = strval( result ); mysql_fetch_field_row(result,"PhoneNr"); PlayerInfo[playerid][pPnumber] = strval( result ); mysql_fetch_field_row(result,"House"); PlayerInfo[playerid][pPhousekey] = strval( result ); mysql_fetch_field_row(result,"Bizz"); PlayerInfo[playerid][pPbiskey] = strval( result ); mysql_fetch_field_row(result,"Radio"); PlayerInfo[playerid][pRadioCars] = strval( result ); mysql_fetch_field_row(result,"Pos_x"); PlayerInfo[playerid][pPos_x] = floatstr( result ); mysql_fetch_field_row(result,"Pos_y"); PlayerInfo[playerid][pPos_y] = floatstr( result ); mysql_fetch_field_row(result,"Pos_z"); PlayerInfo[playerid][pPos_z] = floatstr( result ); mysql_fetch_field_row(result,"Rob"); PlayerInfo[playerid][pRob] = strval( result ); mysql_fetch_field_row(result,"CarLicT"); PlayerInfo[playerid][pCarLicT] = strval( result ); mysql_fetch_field_row(result,"CarLic"); PlayerInfo[playerid][pCarLic] = strval( result ); mysql_fetch_field_row(result,"FlyLicT"); PlayerInfo[playerid][pFlyLicT] = strval( result ); mysql_fetch_field_row(result,"FlyLic"); PlayerInfo[playerid][pFlyLic] = strval( result ); mysql_fetch_field_row(result,"BoatLicT"); PlayerInfo[playerid][pBoatLicT] = strval( result ); mysql_fetch_field_row(result,"BoatLic"); PlayerInfo[playerid][pBoatLic] = strval( result ); mysql_fetch_field_row(result,"FishLicT"); PlayerInfo[playerid][pFishLicT] = strval( result ); mysql_fetch_field_row(result,"FishLic"); PlayerInfo[playerid][pFishLic] = strval( result ); mysql_fetch_field_row(result,"GunLicT"); PlayerInfo[playerid][pGunLicT] = strval( result ); mysql_fetch_field_row(result,"GunLic"); PlayerInfo[playerid][pGunLic] = strval( result ); mysql_fetch_field_row(result,"PayDay"); PlayerInfo[playerid][pPayDay] = strval( result ); mysql_fetch_field_row(result,"PayDayHad"); PlayerInfo[playerid][pPayDayHad] = strval( result ); mysql_fetch_field_row(result,"Tutorial"); PlayerInfo[playerid][pTut] = strval( result ); mysql_fetch_field_row(result,"Warnings"); PlayerInfo[playerid][pWarns] = strval( result ); mysql_fetch_field_row(result,"Rented"); PlayerInfo[playerid][pRented] = strval( result ); mysql_fetch_field_row(result,"Fuel"); PlayerInfo[playerid][pFuel] = strval( result ); mysql_fetch_field_row(result,"Married"); PlayerInfo[playerid][pMarried] = strval( result ); mysql_fetch_field_row(result,"MarriedTo"); strmid(PlayerInfo[playerid][pMarriedTo], result, 0, strlen(result), 255); mysql_fetch_field_row(result,"WTalkie"); PlayerInfo[playerid][pWTalkie] = strval( result ); mysql_fetch_field_row(result,"Lighter"); PlayerInfo[playerid][pLighter] = strval( result ); mysql_fetch_field_row(result,"Cigarettes"); PlayerInfo[playerid][pCigarettes] = strval( result ); mysql_fetch_field_row(result,"Tow"); PlayerInfo[playerid][pTow] = strval( result ); mysql_fetch_field_row(result,"Email"); strmid(PlayerInfo[playerid][pEmail], result, 0, strlen(result), 255); mysql_fetch_field_row(result,"RegisterDate"); strmid(PlayerInfo[playerid][pRegistredDate], result, 0, strlen(result), 255); mysql_fetch_field_row(result,"Banned"); PlayerInfo[playerid][pBanned] = strval( result ); mysql_fetch_field_row(result,"ClanTag"); strmid(PlayerInfo[playerid][pClanTag], result, 0, strlen(result), 255); mysql_fetch_field_row(result,"Clan"); PlayerInfo[playerid][pClan] = strval( result ); mysql_fetch_field_row(result,"Radio2"); PlayerInfo[playerid][pRadio] = strval( result ); mysql_fetch_field_row(result,"HitT"); PlayerInfo[playerid][pHitT] = strval( result ); mysql_fetch_field_row(result,"CRank"); PlayerInfo[playerid][pCRank] = strval( result ); mysql_fetch_field_row(result,"Phone"); PlayerInfo[playerid][pPhone] = strval( result ); mysql_fetch_field_row(result,"id"); PlayerInfo[playerid][pSQLID] = strval( result ); mysql_fetch_field_row(result,"referral"); PlayerInfo[playerid][pReferral] = strval( result ); mysql_fetch_field_row(result,"referralp"); PlayerInfo[playerid][pReferralP] = strval( result ); mysql_fetch_field_row(result,"HPoints"); PlayerInfo[playerid][pHPoints] = strval( result ); mysql_fetch_field_row(result,"Gift"); PlayerInfo[playerid][pGift] = strval( result ); mysql_fetch_field_row(result,"Carkey"); PlayerInfo[playerid][pPcarkey] = strval( result ); mysql_fetch_field_row(result,"motokey"); PlayerInfo[playerid][pmotokey] = strval( result ); mysql_fetch_field_row(result,"helikey"); PlayerInfo[playerid][phelikey] = strval( result ); mysql_fetch_field_row(result,"prcarkey"); PlayerInfo[playerid][pprcarkey] = strval( result ); mysql_fetch_field_row(result,"Laptop"); PlayerInfo[playerid][pLaptop] = strval( result ); mysql_fetch_field_row(result,"Victim"); strmid(PlayerInfo[playerid][pVictim], result, 0, strlen(result), 255); mysql_fetch_field_row(result,"Accused"); strmid(PlayerInfo[playerid][pAccused], result, 0, strlen(result), 255); mysql_fetch_field_row(result,"Crime1"); strmid(PlayerInfo[playerid][pCrime1], result, 0, strlen(result), 255); mysql_fetch_field_row(result,"Crime2"); strmid(PlayerInfo[playerid][pCrime2], result, 0, strlen(result), 255); mysql_fetch_field_row(result,"Crime3"); strmid(PlayerInfo[playerid][pCrime3], result, 0, strlen(result), 255); mysql_fetch_field_row(result,"BTemp"); PlayerInfo[playerid][pBTemp] = strval( result ); mysql_fetch_field_row(result,"BYear"); PlayerInfo[playerid][pBYear] = strval( result ); mysql_fetch_field_row(result,"BMonth"); PlayerInfo[playerid][pBMonth] = strval( result ); mysql_fetch_field_row(result,"BDay"); PlayerInfo[playerid][pBDay] = strval( result ); mysql_fetch_field_row(result,"BBy"); strmid(PlayerInfo[playerid][pBBy], result, 0, strlen(result), 255); mysql_fetch_field_row(result,"BReason"); strmid(PlayerInfo[playerid][pBReason], result, 0, strlen(result), 255); mysql_fetch_field_row(result,"Fakea"); PlayerInfo[playerid][pFakea] = strval( result ); mysql_fetch_field_row(result,"ALeader"); PlayerInfo[playerid][pALeader] = strval( result ); } } else { new loginstring[128]; new loginname[64]; GetPlayerName(playerid,loginname,sizeof(loginname)); format(loginstring,sizeof(loginstring),"Parola incorecta!\n\nVa rugam sa scrii parola mai jos pentru a va conecta pe server.",loginname); ShowPlayerDialog(playerid,DIALOG_LOGIN3,DIALOG_STYLE_PASSWORD,"Logare",loginstring,"Logare","Iesire"); mysql_free_result(); gPlayerLogTries[playerid] += 1; if(gPlayerLogTries[playerid] == 4) { KickEx(playerid); } return 1; }
Код:
else { new loginstring[128]; new loginname[64]; GetPlayerName(playerid,loginname,sizeof(loginname)); format(loginstring,sizeof(loginstring),"Parola incorecta!\n\nVa rugam sa scrii parola mai jos pentru a va conecta pe server.",loginname); ShowPlayerDialog(playerid,DIALOG_LOGIN3,DIALOG_STYLE_PASSWORD,"Logare",loginstring,"Logare","Iesire"); mysql_free_result(); gPlayerLogTries[playerid] += 1; if(gPlayerLogTries[playerid] == 4) { KickEx(playerid); } return 1; }
Код:
[19:07:09] [ERROR] CMySQLConnection::Connect - (error #2002) Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) [19:07:09] [ERROR] CMySQLQuery::Execute - (error #2006) MySQL server has gone away