SA-MP Forums Archive
Help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help. (/showthread.php?tid=648731)



Help. - XavierTM - 27.01.2018

My server when I say, for example to while ago I said that they used the save account command, and the server restarted, and when we reached 50 there are times that it restarts. What can it be? In OnPlayerUpdate I do not have many functions, I updated the plugins and others.

Any solution?


Re: Help. - Fratello - 27.01.2018

I'm sorry, I don't understand. Could you please elaborate your question?


Re: Help. - XavierTM - 27.01.2018

When you save the server accounts, the server restarts and also restarts the 50 users sometimes


Re: Help. - Fratello - 27.01.2018

"restarts the 50 users sometimes" -> What do you mean by this? Perhaps that some of the accounts get completely deleted?


Re: Help. - XavierTM - 27.01.2018

The server restarts when overloaded when there are many users or when accounts are saved


Re: Help. - Fratello - 27.01.2018

Oh, so when you commit /saveaccounts server sometimes crashes when there are 50 + users on the server? Use crashdetect and on the next crash post logs here, they might/might not be useful.

Also, are you using y_ini saving file algorithm? If so, consider merging to SQLite or MySQL as an option. Or eventually try to get better server host provider.

You can lookup (on the forums) for any other thought.


Re: Help. - XavierTM - 27.01.2018

We use VPS, so I doubt it is her, I use the save system y_ini but the problem is that the crashdetect is that when there is a crash, all the people enter, and there are many records and it is very difficult to register the log, and it is difficult for me to move the server to SQLite since there are many things that are saved and it is complicated

Is there no other solution to know what is wrong?


Re: Help. - Fratello - 27.01.2018

First of all,

Y_INI algorithm is designed for low-end server base (< 20/30). I can assume that you're updating a tons of data per user + receiving data from the server. (e.g GetPlayerScore).

You can some sort of request on YSI Github repo. They might be able to help you more. Could you atleast try to track down the right registry crash?


Re: Help. - XavierTM - 27.01.2018

If I put SQLITE there should not be any reboots, right? only happens when saving the accounts, I will make the effort even if I do not have much knowledge.


Re: Help. - XavierTM - 28.01.2018

Here is the command to save full account.

Code:
CMD:save(playerid, params[])
{
	if(gPlayerLogged{playerid})
	{
 		if(Info[playerid][pSavedTime] > 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can only use this command every 5 minutes.");
   		Info[playerid][pSavedTime] = 300;
     	SendClientMessage(playerid, -1, "Your account has been saved correctly, you can only use this command every 5 minutes.");
		OnPlayerSavedStats(playerid);
	}
	return 1;
}
Code:
OnPlayerSavedStats(playerid)
{
    if(GetPVarInt(playerid, "TempName") == 1) return 1;
    if(!gPlayerLogged{playerid}) return 1;
	new playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid, playername, sizeof(playername));
    if(INI_Exist(playername))
    {
		new PlayerFile[ 13 + MAX_PLAYER_NAME + 1];
	    format( PlayerFile , sizeof PlayerFile, USERFILE, playername);
	    new INI:File = INI_Open(PlayerFile);
	    INI_SetTag(File,"data");
	    INI_WriteInt(File,"TarjetaCredito",Info[playerid][pTarjetaCredito]);
	    INI_WriteInt(File,"Level",Info[playerid][pLevel]);
	    INI_WriteInt(File,"AdminNivelZC",Info[playerid][pAdminZC]);
	    INI_WriteInt(File,"AdminZC",Info[playerid][pLvlAdminZC]);
	    INI_WriteInt(File,"BanAppealer",Info[playerid][pBanAppealer]);
		INI_WriteInt(File,"FactionModerator",Info[playerid][pFactionModerator]);
		INI_WriteInt(File,"ModStaff",Info[playerid][pModStaff]);
		INI_WriteInt(File,"Encubierto",Info[playerid][pEncubierto]);
		INI_WriteInt(File,"GangModerator",Info[playerid][pGangModerator]);
		INI_WriteInt(File,"Helper",Info[playerid][pHelper]);
		INI_WriteInt(File,"ConnectedTime",Info[playerid][pConnectTime]);
		INI_WriteInt(File,"Registered",Info[playerid][pReg]);
		INI_WriteInt(File,"Sex",Info[playerid][pSex]);
		INI_WriteInt(File,"Age",Info[playerid][pAge]);
		INI_WriteInt(File,"Origin",Info[playerid][pOrigin]);
		INI_WriteInt(File,"Respect",Info[playerid][pExp]);
        INI_WriteInt(File,"Money",GetPVarInt(playerid, "Cash"));
        INI_WriteInt(File,"Bank",Info[playerid][pAccount]);
        INI_WriteString(File,"IP", Info[playerid][pIP]);
        INI_WriteInt(File,"Kills",Info[playerid][pKills]);
        INI_WriteInt(File,"Deaths",Info[playerid][pDeaths]);
        INI_WriteInt(File,"Arrested",Info[playerid][pArrested]);
        INI_WriteInt(File,"JailAdmin",Info[playerid][pJailAdmin]);
        INI_WriteInt(File,"LottoNr",Info[playerid][pLottoNr]);
        INI_WriteInt(File,"Job",Info[playerid][pJob]);
        INI_WriteInt(File,"NewMuted",Info[playerid][pNMute]);
        INI_WriteInt(File,"NewMutedTotal",Info[playerid][pNMuteTotal]);
        INI_WriteInt(File,"Warn",Info[playerid][pWarn]);
        INI_WriteInt(File,"WRestricted",Info[playerid][pWRestricted]);
        INI_WriteInt(File,"Jailed",Info[playerid][pJailed]);
        INI_WriteInt(File,"JailTime",Info[playerid][pJailTime]);
        INI_WriteInt(File,"Materials",Info[playerid][pMats]);
        INI_WriteInt(File,"Packages",GetPVarInt(playerid, "Packages"));
        INI_WriteInt(File,"Drugs",Info[playerid][pDrugs]);
        INI_WriteInt(File,"Cosecha",Info[playerid][pCosecha]);
        INI_WriteInt(File,"Crack",Info[playerid][pCrack]);
        INI_WriteInt(File,"Pot",Info[playerid][pPot]);
        INI_WriteInt(File,"Crates",Info[playerid][pCrates]);
        INI_WriteInt(File,"Adic",Info[playerid][pAdiccion]);
        INI_WriteInt(File,"Leader",Info[playerid][pLeader]);
        INI_WriteInt(File,"Member",Info[playerid][pMember]);
        INI_WriteInt(File,"FMember",Info[playerid][pFMember]);
        INI_WriteInt(File,"Division",Info[playerid][pDivision]);
        INI_WriteInt(File,"Rank",Info[playerid][pRank]);
        INI_WriteInt(File,"Char",Info[playerid][pChar]);
		if(GetPVarInt(playerid, "EventToken") == 0 && GetPVarInt(playerid, "IsInArena") == 0){
		    GetPlayerHealth(playerid,Info[playerid][pHealth]);
		}
		INI_WriteFloat(File,"pHealth",Info[playerid][pHealth]);
		if(GetPVarInt(playerid, "EventToken") == 0 && GetPVarInt(playerid, "IsInArena") == 0){
		    GetPlayerArmour(playerid,Info[playerid][pArmour]);
		}
        INI_WriteFloat(File,"pArmour",Info[playerid][pArmour]);
        INI_WriteInt(File,"Team",Info[playerid][pTeam]);
        INI_WriteInt(File,"Model",Info[playerid][pModel]);
        INI_WriteInt(File,"PhoneNr",Info[playerid][pPnumber]);
        INI_WriteInt(File,"Sprunk",Info[playerid][pSprunk]);
        INI_WriteInt(File,"Phonebook",Info[playerid][pPhoneBook]);
        INI_WriteInt(File,"House",Info[playerid][pPhousekey]);
        INI_WriteInt(File,"House2",Info[playerid][pPhousekey2]);
        INI_WriteInt(File,"Int", Info[playerid][pInt]);
        INI_WriteFloat(File,"Pos_x",Info[playerid][pPos_x]);
        INI_WriteFloat(File,"Pos_y",Info[playerid][pPos_y]);
        INI_WriteFloat(File,"Pos_z",Info[playerid][pPos_z]);
        INI_WriteFloat(File,"SPos_r",Info[playerid][pPos_r]);
        INI_WriteInt(File,"CarLic",Info[playerid][pCarLic]);
        INI_WriteInt(File,"FlyLic",Info[playerid][pFlyLic]);
        INI_WriteInt(File,"BoatLic",Info[playerid][pBoatLic]);
        INI_WriteInt(File,"GunLic",Info[playerid][pGunLic]);
        INI_WriteInt(File,"Gafas",Info[playerid][pGafas]);
        INI_WriteInt(File,"Tutorial",Info[playerid][pTut]);
        INI_WriteInt(File,"Test",Info[playerid][pTestTut]);
        INI_WriteInt(File,"VWorld",Info[playerid][pVW]);
        INI_WriteInt(File,"Lighter",Info[playerid][pLighter]);
        INI_WriteInt(File,"Cigarettes",Info[playerid][pCigarettes]);
        INI_WriteInt(File,"BanZC",Info[playerid][pBannedZC]);
        INI_WriteInt(File,"DisabledZC",Info[playerid][pDisabledZC]);
        INI_WriteInt(File,"BlockBug",Info[playerid][pBlockBug]);
        INI_WriteInt(File,"DNI",Info[playerid][pDNI]);
        INI_WriteInt(File,"VSkill",Info[playerid][pArmsSkill]);
        INI_WriteInt(File,"TSkill",Info[playerid][pTruckSkill]);
        INI_WriteInt(File,"SmugglerSkill",Info[playerid][pSmugSkill]);
        INI_WriteInt(File,"DrugsSkill",Info[playerid][pDrugsSkill]);
        INI_WriteInt(File,"SIDA",Info[playerid][pSIDA]);
        INI_WriteInt(File,"Cancer" ,Info[playerid][pCancer]);
        INI_WriteInt(File,"Epilepsia",Info[playerid][pEpilepsia]);
        INI_WriteInt(File,"Dengue",Info[playerid][pDengue]);
        INI_WriteInt(File,"FStyle",Info[playerid][pFStyle]);
        INI_WriteInt(File,"Busqueda",Info[playerid][pWantedLevel]);
        INI_WriteInt(File,"AntiSIDA",Info[playerid][pAntiSIDA]);
        INI_WriteInt(File,"AntiCancer",Info[playerid][pAntiCancer]);
        INI_WriteInt(File,"AntiEpilepsia",Info[playerid][pAntiEpilepsia]);
        INI_WriteInt(File,"Rent",Info[playerid][pRenting]);
        INI_WriteInt(File,"prMoney",Info[playerid][p_Pr_Money]);
        INI_WriteInt(File,"Rob",Info[playerid][pRob]);
        INI_WriteInt(File,"Premium",Info[playerid][pVIP]);
        INI_WriteInt(File,"FichasCash",Info[playerid][pPTR]);
        INI_WriteInt(File,"CarPremium",Info[playerid][pCarKey2]);
        INI_WriteInt(File,"BanDuda",Info[playerid][pBanDuda]);
        INI_WriteInt(File,"ReportMuted",Info[playerid][pRMuted]);
        INI_WriteInt(File,"ReportMutedTotal",Info[playerid][pRMutedTotal]);
        INI_WriteInt(File,"ReportMutedTime",Info[playerid][pRMutedTime]);
        INI_WriteInt(File,"Pasaporte",Info[playerid][pPasaporte]);
        INI_WriteInt(File,"RadioP", Info[playerid][pRadio]);
        INI_WriteInt(File,"KHZ",Info[playerid][pRadioFreq]);
        INI_WriteInt(File,"Ipad",Info[playerid][pIpadMusic]);
        INI_WriteInt(File,"GiftTime",Info[playerid][pGiftTime]);
		for( new m = 0; m < 12; m++ )
		{
		    new mStr[24];
		    format(mStr,sizeof(mStr), "Gun%d", m);
		    INI_WriteInt(File,mStr, Info[playerid][pWeapons][m]);
		}
		INI_WriteInt(File,"Acento",Info[playerid][pAccent]);
		INI_WriteInt(File,"PTokens",Info[playerid][pPaintTokens]);
		INI_WriteInt(File,"Undercover",Info[playerid][pUndercover]);
		INI_WriteInt(File,"Head",Info[playerid][pHead]);
		INI_WriteInt(File,"TaxiLicense", Info[playerid][pTaxiLicense]);
		INI_WriteInt(File,"Hospital",Info[playerid][pHospital]);
		INI_WriteInt(File,"CHits",Info[playerid][pCHits]);
		INI_WriteInt(File,"FHits",Info[playerid][pFHits]);
		INI_WriteInt(File,"Spraycan",Info[playerid][pSpraycan]);
		INI_WriteInt(File,"Married",Info[playerid][pMarried]);
		INI_WriteString(File,"MarriedTo",Info[playerid][pMarriedTo]);
		INI_WriteString(File,"ContractBy",Info[playerid][pContractBy]);
		INI_WriteString(File,"ContractDetail",Info[playerid][pContractDetail]);
		INI_WriteInt(File,"pWExists",Info[playerid][pWExists]);
		INI_WriteFloat(File,"pWX",Info[playerid][pWX]);
		INI_WriteFloat(File,"pWY",Info[playerid][pWY]);
		INI_WriteFloat(File,"pWZ",Info[playerid][pWZ]);
		INI_WriteInt(File,"pWVW",Info[playerid][pWVW]);
		INI_WriteInt(File,"pWInt",Info[playerid][pWInt]);
		INI_WriteInt(File,"pWValue",Info[playerid][pWValue]);
		INI_WriteInt(File,"pWSeeds",Info[playerid][pWSeeds]);
		INI_WriteInt(File,"PayEx",Info[playerid][YaCobre]);
		INI_WriteInt(File,"AdMuted",Info[playerid][pADMute]);
		INI_WriteInt(File,"AdMutedTotal",Info[playerid][pADMuteTotal]);
		INI_WriteString(File,"Warrants",Info[playerid][pWarrant]);
		INI_WriteInt(File,"JudgeJailTime",Info[playerid][pJudgeJailTime]);
		INI_WriteInt(File,"JudgeJailType",Info[playerid][pJudgeJailType]);
		INI_WriteInt(File,"BeingSentenced",Info[playerid][pBeingSentenced]);
		INI_WriteInt(File,"ProbationTime",Info[playerid][pProbationTime]);
		INI_WriteInt(File,"RewardsHours",Info[playerid][pRHours]);
		INI_WriteInt(File,"ADTime",Info[playerid][pADTime]);
		INI_WriteInt(File,"Otros",Info[playerid][pOther]);
		INI_WriteInt(File,"GGTokens",Info[playerid][pGTokens]);
		INI_WriteInt(File,"HDExp",Info[playerid][pDobleExp]);
		INI_WriteInt(File,"DPHoras",Info[playerid][pDPHours]);
		INI_WriteInt(File,"DPTiempo",Info[playerid][pDPTime]);
		INI_WriteInt(File,"DPTotal",Info[playerid][pDPTotal]);
		INI_WriteInt(File,"Order",Info[playerid][pOrder]);
		INI_WriteInt(File,"TempVIP",Info[playerid][pTempVIP]);
		INI_WriteInt(File,"VIPInviteDay",Info[playerid][pVIPInviteDay]);
		INI_WriteInt(File,"BuddyInvite",Info[playerid][pBuddyInvited]);
		INI_WriteInt(File,"VTokens",Info[playerid][pVTokens]);
		INI_WriteInt(File,"Job2",Info[playerid][pJob2]);
		INI_WriteInt(File,"TypeSpawn",Info[playerid][pTypeSpawn]);
		INI_WriteInt(File,"ShopTech",Info[playerid][pShopTech]);
		INI_WriteInt(File,"Status",Info[playerid][pEstado]);
		INI_WriteInt(File,"DayVIP",Info[playerid][pVIPDateD]);
		INI_WriteInt(File,"MonthVIP",Info[playerid][pVIPDateM]);
		INI_WriteInt(File,"IDRegalo",Info[playerid][pRegalo]);
		for( new m = 0; m < 11; m++ )
		{
		    new mStr[24];
		    format(mStr,sizeof(mStr), "Mueble%d", m);
		    INI_WriteInt(File,mStr, Info[playerid][pMuebles][m]);
		}
		INI_WriteInt(File,"Screwdrivers", Info[playerid][pScrewdriver]);
		INI_WriteInt(File,"Firstaid", Info[playerid][pFirstaid]);
		INI_WriteInt(File,"CamOculta", Info[playerid][pSurveillance]);
		INI_WriteInt(File,"Negocio",Info[playerid][pPbizzkey]);
		INI_WriteInt(File,"skinn",Info[playerid][pgskin]);
		INI_WriteInt(File,"robita",Info[playerid][probita]);
		INI_WriteInt(File,"DNIFalse",Info[playerid][pDNIFalse]);
 		INI_WriteString( File, "DNIName",Info[playerid][pDNIName]);
 		INI_WriteInt(File,"Boombox",Info[playerid][pBoombox]);
	    for(new v = 0; v < MAX_PLAYERTOYS; v++)
    	{
	    	new string[64];
			format( string,64, "pt%dModelID", v);
			INI_WriteInt(File,string, PlayerToyInfo[playerid][v][ptModelID]);
			format(string, 64, "pt%dBone",v);
			INI_WriteInt(File,string, PlayerToyInfo[playerid][v][ptBone]);
			format(string, 64, "pt%dPosX",v);
			INI_WriteFloat(File,string, PlayerToyInfo[playerid][v][ptPosX]);
			format(string, 64, "pt%dPosY",v);
			INI_WriteFloat(File,string, PlayerToyInfo[playerid][v][ptPosY]);
			format(string, 64, "pt%dPosZ",v);
			INI_WriteFloat(File,string, PlayerToyInfo[playerid][v][ptPosZ]);
			format(string, 64, "pt%dRotX",v);
			INI_WriteFloat(File,string,PlayerToyInfo[playerid][v][ptRotX]);
			format(string, 64, "pt%dRotY",v);
			INI_WriteFloat(File,string,PlayerToyInfo[playerid][v][ptRotY]);
			format(string, 64, "pt%dRotZ",v);
			INI_WriteFloat(File,string,PlayerToyInfo[playerid][v][ptRotZ]);
			format(string, 64, "pt%dSizX",v);
			INI_WriteFloat(File,string,PlayerToyInfo[playerid][v][ftscaleX]);
			format(string, 64, "pt%dSizY",v);
			INI_WriteFloat(File,string,PlayerToyInfo[playerid][v][ftscaleY]);
			format(string, 64, "pt%dSizZ",v);
			INI_WriteFloat(File,string,PlayerToyInfo[playerid][v][ftscaleZ]);
    	}
    	for(new v = 0; v < MAX_PLAYERVEHICLES; v++)
    	{
    	    new string[64];
        	format(string, 64, "pv%dPosX",v);
        	INI_WriteFloat(File,string,PlayerVehicleInfo[playerid][v][pvPosX]);
        	format(string, 64, "pv%dPosY",v);
        	INI_WriteFloat(File,string,PlayerVehicleInfo[playerid][v][pvPosY]);
        	format(string, 64, "pv%dPosZ",v);
        	INI_WriteFloat(File,string,PlayerVehicleInfo[playerid][v][pvPosZ]);
        	format(string, 64, "pv%dPosAngle",v);
        	INI_WriteFloat(File,string,PlayerVehicleInfo[playerid][v][pvPosAngle]);
			format(string, 64, "pv%dVirtualW",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvVW]);
			format(string, 64, "pv%dModelId",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvModelId]);
			format(string, 64, "pv%dLock",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvLock]);
			format(string, 64, "pv%dLocked",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvLocked]);
			format(string, 64, "pv%dPaintJob",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvPaintJob]);
			format(string, 64, "pv%dColor1",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvColor1]);
			format(string, 64, "pv%dColor2",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvColor2]);
			format(string, 64, "pv%dPrice",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvPrice]);
			format(string, 64, "pv%dTicket",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvTicket]);
			format(string, 64, "pv%dWeapon0",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvWeapons][0]);
			format(string, 64, "pv%dWeapon1",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvWeapons][1]);
			format(string, 64, "pv%dWeapon2",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvWeapons][2]);
			format(string, 64, "pv%dWeapon3",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvWeapons][3]);
			format(string, 64, "pv%dWeapon4",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvWeapons][4]);
			format(string, 64, "pv%dWeapon5",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvWeapons][5]);
			format(string, 64, "pv%dWeapon6",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvWeapons][6]);
			format(string, 64, "pv%dWeapon7",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvWeapons][7]);
			format(string, 64, "pv%dWepUpgrade",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvWepUpgrade]);
			format(string, 64, "pv%dFuel",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvFuel]);
			format(string, 64, "pv%dImpound",v);
			INI_WriteInt(File,string,PlayerVehicleInfo[playerid][v][pvImpounded]);
			format(string, 64, "pv%dHealth",v);
			INI_WriteFloat(File,string,PlayerVehicleInfo[playerid][v][pvHealth]);
			for(new m = 0; m < MAX_MODS; m++)
			{
			    new strings[64];
			    format(strings, 64, "pv%dMod%d", v, m);
			    INI_WriteInt(File,strings,PlayerVehicleInfo[playerid][v][pvMods][m]);
			}
		}
		INI_Close(File);
   	}
   	return 1;
}



Re: Help. - edyun - 28.01.2018

You are updating tons of data trough Y_Ini, of course the server crashes,try using MySQL you should not see crashes anymore..


Re: Help. - Fratello - 28.01.2018

Quote:
Originally Posted by XavierTM
Посмотреть сообщение
If I put SQLITE there should not be any reboots, right? only happens when saving the accounts, I will make the effort even if I do not have much knowledge.
No there won't be any reboots. You can start learning SQL Language from any code-learning websites right now. There are tons of tutorials on SA-MP forums affiliated with (My)SQL(ite).