08.12.2011, 00:32
Hi Guys,
I know I post alot of posts about mysql, and this is the main reason why.
I'v tried to fix this issue a long time now but no matter what I do it seems that I never get this fixed.
Some times when you connect to the server before you are at the login dialog the server automaticly restarts without errors.
I have checked the log and this is what I get from it.
You see, it's just restarts without warnings, it's like when the player that connects to the serverver makes it lost connection to the database and it automaticly restarts
It's only when the player connects and it just happens some time.
On the samp client you get this.
Samp 0.3d
Connecting to IP.
Connected to IP.
and then nothing and you wait for like 10 seconds and then you get the Restart message and it all happens over agen.
It's hard to explain but something werd happens and the server lost connection to the DB and the server restarts.
I'm not sure that the server lost connection to the DB it's just a guess.
I really need some help.
under onplayerconnect I have this
under Initloading(playerid); I have this
Under InitOnConnection(playerid);
and under InitPlayerConnection(playerid) I have this
Sorry for all the content in this post, but I would probably get a message later about posting any of this.
But here it all are under onplayerconnect and some where the error are probably under here.
Need help, please help I'm looking forward for all suggestions for me and all help I can get.
-Best Regards
Tony
I know I post alot of posts about mysql, and this is the main reason why.
I'v tried to fix this issue a long time now but no matter what I do it seems that I never get this fixed.
Some times when you connect to the server before you are at the login dialog the server automaticly restarts without errors.
I have checked the log and this is what I get from it.
Код:
[00:00:39] Number of vehicle models: 162 [00:01:23] Incoming connection: **.***.***.**:26983 [00:01:23] [join] Ben_Sherman has joined the server (0:**.***.***.**) [00:01:33] Ben_Sherman has logged in. [00:01:38] [part] Ben_Sherman has left the server (0:1) [00:05:56] Incoming connection: **.***.***.**:3144 [00:05:56] [join] Robinson_Smith has joined the server (0:**.***.***.**) [00:06:08] [part] Robinson_Smith has left the server (0:1) [00:06:40] Incoming connection: **.***.***.**:49872 [00:06:40] [join] Jayson_Parker has joined the server (0:**.***.***.**) [00:06:44] Jayson_Parker has logged in. [00:07:36] Incoming connection: **.***.***.**:26986 [00:07:36] [join] Ben_Sherman has joined the server (1:**.***.***.**) -Server Restarts
It's only when the player connects and it just happens some time.
On the samp client you get this.
Samp 0.3d
Connecting to IP.
Connected to IP.
and then nothing and you wait for like 10 seconds and then you get the Restart message and it all happens over agen.
It's hard to explain but something werd happens and the server lost connection to the DB and the server restarts.
I'm not sure that the server lost connection to the DB it's just a guess.
I really need some help.
under onplayerconnect I have this
pawn Код:
public OnPlayerConnect(playerid)
{
Initloading(playerid);
return 1;
}
pawn Код:
public Initloading(playerid)
{
new string[500];
SendClientMessage(playerid, 0xF1B72E99, " ");
SendClientMessage(playerid, 0xF1B72E99, " ");
SendClientMessage(playerid, 0xF1B72E99, " ");
SendClientMessage(playerid, 0xF1B72E99, " ");
SendClientMessage(playerid, 0xF1B72E99, " ");
SendClientMessage(playerid, 0xF1B72E99, " ");
SendClientMessage(playerid, 0xF1B72E99, " ");
SendClientMessage(playerid, 0xF1B72E99, " ");
SendClientMessage(playerid, 0xF1B72E99, " ");
SendClientMessage(playerid, 0xF1B72E99, " ");
SendClientMessage(playerid, 0xF1B72E99, " ");
SendClientMessage(playerid, 0xF1B72E99, " ");
SendClientMessage(playerid, 0xF1B72E99, " ");
SendClientMessage(playerid, 0xF1B72E99, " ");
SendClientMessage(playerid, 0xF1B72E99, " ");
new str[160];
GetPlayerName(playerid, str, MAX_PLAYER_NAME);
for (new i = 0; i < MAX_PLAYER_NAME; i++)
if (str[i] == '_')
str[i] = ' ';
format(string, sizeof(string), "Welcome %s,", str);
SendClientMessage(playerid, 0xF1B72E99, string);
InitOnConnection(playerid);
InitPlayerConnection(playerid);
return 1;
}
pawn Код:
stock InitOnConnection(playerid)
{
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
UsedCrack[playerid] = 0;
Called[playerid] = 0;
Busline1[playerid][0] = 0;
Busline2[playerid][0] = 0;
Busline3[playerid][0] = 0;
BusShowLocation[playerid][0] = 0;
BusShowLocationC[playerid] = 0;
SellCar[playerid] = 0;
Training[playerid] = 0;
PlayerStoned[playerid] = 0;
Taze1[playerid] = 0;
Taze2[playerid] = 0;
InAFoodPlace[playerid] = 0;
InAFoodPlace[playerid] = 0;
ViewingBox[playerid] = 0;
UseSunGlasses[playerid] = 0;
editingcd[playerid] = -1;
editingcdveh[playerid] = -1;
CharacterStatus[playerid] = 0;
editingcdvehnew[playerid] = 0;
RobStart[playerid] = 0;
IsCuttingTrees[playerid] = 0;
GunStore[playerid] = 0;
RobReady[playerid] = 0;
Question[playerid] = 0;
Radio[playerid] = 0;
editingcdvehpos[playerid] = 0;
playertryrobbed[playerid] = 0;
LoadStats(playerid);
LostHP[playerid] = 0;
LostHP2[playerid] = 0;
UsedWeed[playerid] = 0;
SelectChar[playerid] = 0;
HidePM[playerid] = 0;
NoText[playerid] = 0;
HideBriefcase[playerid] = 0;
PhoneOnline[playerid] = 0;
Seatbelt[playerid] = 0;
SelectCharID[playerid] = 0;
SelectCharPlace[playerid] = 0;
ChosenSkin[playerid] = 0;
GettingJob[playerid] = 0;
GuardOffer[playerid] = 999;
GuardPrice[playerid] = 0;
OwnableCarOffer[playerid] = 999;
OwnableCarID[playerid] = 0;
OwnableCarPrice[playerid] = 0;
CallLawyer[playerid] = 0;
WantLawyer[playerid] = 0;
IceCreamOffer[playerid] = 999;
IceCreamPrice[playerid] = 0;
KickPlayer[playerid] = 0;
CurrentMoney[playerid] = 0;
CP[playerid] = 0;
Robbed[playerid] = 0;
SpawnChange[playerid] = 1;
CarOffer[playerid] = 999;
CarPrice[playerid] = 0;
RadioT[playerid] = 0;
CarID[playerid] = 0;
CarCalls[playerid] = 0;
RobbedTime[playerid] = 0;
MoneyMessage[playerid] = 0;
Condom[playerid] = 0;
STIPlayer[playerid] = 0;
SexOffer[playerid] = 999;
SexPrice[playerid] = 0;
RepairOffer[playerid] = 999;
RepairPrice[playerid] = 0;
RepairCar[playerid] = 0;
BlowjobOffer[playerid] = 999;
BlowjobPrice[playerid] = 0;
TalkingLive[playerid] = 255;
LiveOffer[playerid] = 999;
TakingLesson[playerid] = 0;
RefillOffer[playerid] = 999;
RefillPrice[playerid] = 0;
MapIconsShown[playerid] = 0;
PotOffer[playerid] = 999;
PlayerCuffed[playerid] = 0;
PlayerCuffedTime[playerid] = 0;
CrackOffer[playerid] = 999;
PotPrice[playerid] = 0;
CrackPrice[playerid] = 0;
RegistrationStep[playerid] = 0;
TutStep[playerid] = 0;
Ticket1[playerid] = 0;
Ticket2[playerid] = 0;
OnCK[playerid] = 999;
GettingCK[playerid] = 999;
PotGram[playerid] = 0;
CrackGram[playerid] = 0;
ConnectedToPC[playerid] = 0;
TogSpeed[playerid] = 0;
OrderReady[playerid] = 0;
JailPrice[playerid] = 0;
MedicBill[playerid] = 0;
GotHit[playerid] = 0;
GoChase[playerid] = 999;
GetChased[playerid] = 999;
PlacedNews[playerid] = 0;
OnDuty[playerid] = 0;
DrivingTest[playerid] = 0;
DrivingTest2[playerid] = 0;
BoxWaitTime[playerid] = 0;
SchoolSpawn[playerid] = 0;
ChangePos2[playerid][1] = 0;
SafeTime[playerid] = 60;
TransportDuty[playerid] = 0;
PlayerTied[playerid] = 0;
BusCallTime[playerid] = 0;
TaxiCallTime[playerid] = 0;
MedicCallTime[playerid] = 0;
MechanicCallTime[playerid] = 0;
FindTimePoints[playerid] = 0;
FindTime[playerid] = 0;
DrivingStep[playerid] = 0;
DrivingCar[playerid] = 0;
DrivingBike[playerid] = 0;
DrivingTruck[playerid] = 0;
JobDuty[playerid] = 0;
Mobile[playerid] = 255;
Music[playerid] = 0;
BoxOffer[playerid] = 999;
PlayerBoxing[playerid] = 0;
DrugDeliver[playerid] = 0;
Spectate[playerid] = 255;
PlayerDrunk[playerid] = 0;
PlayerDrunkTime[playerid] = 0;
PlayerDrunkTimeLeft[playerid] = 0;
Unspec[playerid][sLocal] = 255;
MatDeliver[playerid] = 0;
PlayerPaintballing[playerid] = 0;
PlayerPaintballKills[playerid] = 0;
WritingPaper[playerid] = 0;
WritingPaperNumber[playerid] = 999;
WritingLine[playerid] = 0;
BringingPaper[playerid] = 0;
GotPaper[playerid] = 0;
PaperOffer[playerid] = 999;
ConsumingMoney[playerid] = 0;
MatDeliver2[playerid] = 0;
gLastCar[playerid] = 0;
gOoc[playerid] = 0;
gNews[playerid] = 0;
BigEar[playerid] = 0;
BigEarW[playerid] = 0;
BigEarG[playerid] = 0;
BigEarsON[playerid] = 0;
gDice[playerid] = 0;
gFam[playerid] = 0;
gSpeedo[playerid] = 0;
gGas[playerid] = 0;
pOnHand[playerid] = 0;
IsMilkingCows[playerid] = 0;
IsFarmingWeed[playerid] = 0;
gPlayerLogged[playerid] = 0;
gPlayerLogTries[playerid] = 0;
gPlayerAccount[playerid] = 0;
CowEndTime[playerid] = 0;
FarmEndTime[playerid] = 0;
gPlayerSpawned[playerid] = 0;
IsCollectingRubbish[playerid] = 0;
GarbageEndTime[playerid] = 0;
GarbageTime[playerid] = 0;
BinTime[playerid] = 0;//garbagejob
PlayerTazeTime[playerid] = 0;
EnterCarTime[playerid] = 0;
EnterCarTimeH[playerid] = 0;
LoadTankerTime[playerid] = 0;
UnloadTankerTime[playerid] = 0;//ftjob
StartTime[playerid] = 0;
TicketOffer[playerid] = 999;
TicketMoney[playerid] = 0;
CowTime[playerid] = 0;
MatsHolding[playerid] = 0;
TutTime[playerid] = 0;
LicDTest[playerid] = 0;
LicDTest2[playerid] = 0;
LicDTest3[playerid] = 0;
LicDTest4[playerid] = 0;
LicDTime[playerid] = 0;
LicDTime2[playerid] = 0;
LicDTime3[playerid] = 0;
LicDTime4[playerid] = 0;
LicDTime5[playerid] = 0;
gPlayerMission[playerid] = 0;
TaxiAccepted[playerid] = 999;
BusAccepted[playerid] = 999;
NoFuel[playerid] = 0;
HireCar[playerid] = 299;
PlayersChannel[playerid] = 999;
Onheadset[playerid] = 1;
TransportValue[playerid] = 0;
TransportMoney[playerid] = 0;
TransportTime[playerid] = 0;
TransportCost[playerid] = 0;
TransportDriver[playerid] = 999;
Locator[playerid] = 0;
PlayerOnMission[playerid] = 0;
MissionCheckpoint[playerid] = 0;
WatchingTV[playerid] = 0;
SoonToBeDeleted[playerid] = 0;
NewbieTut[playerid] = 0;
ConnectedToMDC[playerid] = 0;
AccentOn[playerid] = 0;
FirstSpawn[playerid] = 1;
StoreRobed[playerid] = 0;
Robber[playerid] = 0;
JustReported[playerid] = 0;
PlayerNeedsHelp[playerid] = 0;
CheckMoney[playerid] = 1;
ImpoundOpen[playerid] = 0;
IsSweeping[playerid] = 0;
PlayerSmoking[playerid] = 0;
PlayerCiggs[playerid] = 0;
ProposeOffer[playerid] = 999;
MarryWitness[playerid] = 999;
MarryWitnessOffer[playerid] = 999;
MarriageCeremoney[playerid] = 0;
ProposedTo[playerid] = 999;
GotProposedBy[playerid] = 999;
DivorceOffer[playerid] = 999;
Mask[playerid] = 1;
HelpMessages[playerid] = 1;
harvested[playerid] = 0;
LockX[playerid] = 0;
LockY[playerid] = 0;
LockZ[playerid] = 0;
LockedOnce[playerid] = 0;
CCTVSpeed[playerid] = 0;
DMVName[playerid] = 0;
DMVMessage[playerid] = 0;
ClearCrime(playerid);
ClearMarriage(playerid);
SetPlayerColor(playerid,COLOR_GRAD2);
new string[256];
GetPlayerName(playerid, plname, sizeof(plname));
new loginname[64];
new playersip[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
GetPlayerIp(playerid,playersip,sizeof(playersip));
format(string, sizeof(string), "%s [ID:%d] Has connected (( %s ))", loginname, playerid, playersip);
SendAdminMessage(0xDE1BCF96, string);
return 1;
}
pawn Код:
stock InitPlayerConnection(playerid)
{
new Query[512], DataString[128], EscapedName[MAX_PLAYER_NAME], JaName[MAX_PLAYER_NAME];
new loginstring[128];
GetPlayerName(playerid, JaName, sizeof(JaName));
mysql_real_escape_string(JaName, EscapedName);
#pragma unused Name
format(Query, sizeof(Query), "SELECT * FROM `accounts` WHERE `pName` = '%s'", EscapedName);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() >= 1)
{
if(mysql_num_rows() >= 2)
{
mysql_free_result();
SendClientMessage(playerid, -1, "There seems to be duplicates of your account, please contact a high-level admin.");
Kick(playerid);
}
else
{
mysql_fetch_field("UserID", DataString);
DatabaseID[playerid] = strval(DataString);
format(Query, sizeof(Query), "SELECT * FROM `accounts` WHERE `pName` = '%s'", EscapedName);
mysql_query(Query);
mysql_store_result();
mysql_fetch_field("pKey", DataString);
format(PlayerInfo[playerid][pKey], 128, "%s", DataString);*/
format(loginstring,sizeof(loginstring),"Welcome. \n \nThat name is registered.\nPlease enter your password below:");
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"Login.",loginstring,"Login","Exit");
}
}
else
{
mysql_free_result();
SendClientMessage(playerid, -1, "[INFO] Please signup at our UCP to play here");
SendClientMessage(playerid, -1, " ");
SendClientMessage(playerid, -1, "We are looking forward to see you soon...");
Kick(playerid);
}
}
But here it all are under onplayerconnect and some where the error are probably under here.
Need help, please help I'm looking forward for all suggestions for me and all help I can get.
-Best Regards
Tony