public OnPlayerUpdate
#1

Necesito colocar update de las cuentas en el gm pero tiene un cуdigo mal que hace que el gm le de muy lag es este
Код:
//SetTimerEx("YSI_Save_Account", 60000, true, "i", playerid);
Si me pasan uno correcto ya que dura mucho para guardar cuentas, posiciones, cosas, etc.
Reply
#2

este es el mejor creo yo:

Код:
public OnPlayerDisconnect(playerid, reason)
{
    YSI_Save_Account(playerid);
    return 1;
}
el uso de timers para guardar cuentas podria provocar lag

o lo otro que puedes hacer al momento de que quieras guardar algo importante, como por ejemplo la casa del jugador, solo haz que se guarde eso (algunos por guardar solo una cosa terminan guardando a cada rato score, dinero, vida, chaleco, skin, y muchas cosas que no son necesarias guardar en el momento)
Reply
#3

Si ese si esta ahн pero resulta que si te registras y duras menos de 1 minuto en el server, no se guarda la cuenta si no despuйs en un rato

Por cierto para no hacer tanto spam con temas tengo un problema en un login me da el error error 075: input line too long (after substitutions) y usa el string en

Код:
#define MAX_TEXT_CHAT           (250)
Код:
new MsgRegister[MAX_TEXT_CHAT + 1000];
Код:
format(MsgRegister, sizeof(MsgRegister),
Osea hago lo posible por aumentar y me sigue dando error alguna forma de aumentar parar seguir aumentado mis palabras en el login
Reply
#4

Haber pasa la funcion YSI_Save_Account
Reply
#5

Код:
public YSI_Save_Account(playerid)
{
	if(Logueado[playerid] == true)
	{
 		new PlayerAccountData[MAX_PLAYER_ACCOUNT_DATA];
		format(PlayerAccountData, sizeof(PlayerAccountData), "%s%s.ini", DIR_CUENTAS, GetPlayerNameTwo(playerid));
		new INI:PlayerStatsData = INI_Open(PlayerAccountData);
		INI_WriteString(PlayerStatsData, 	"Password", 		GetPlayerData[playerid][P_Pass]);
		INI_WriteInt(PlayerStatsData, 		"Skin", 			GetPlayerData[playerid][P_Skin]);
		INI_WriteInt(PlayerStatsData, 		"Admin",       		GetPlayerData[playerid][P_Admin]);
		INI_WriteInt(PlayerStatsData, 		"Registrado",       GetPlayerData[playerid][P_Registred]);
		INI_WriteFloat(PlayerStatsData, 	"PosX",				GetPlayerData[playerid][P_Position][0]);
		INI_WriteFloat(PlayerStatsData, 	"PosY",				GetPlayerData[playerid][P_Position][1]);
		INI_WriteFloat(PlayerStatsData, 	"PosZ",				GetPlayerData[playerid][P_Position][2]);
		INI_WriteFloat(PlayerStatsData, 	"Vida",       		GetPlayerData[playerid][P_Health]);
		INI_WriteFloat(PlayerStatsData, 	"Chaleco",       	GetPlayerData[playerid][P_Armour]);
		INI_WriteInt(PlayerStatsData, 		"Interior",       	GetPlayerData[playerid][P_Interior]);
		INI_WriteInt(PlayerStatsData, 		"MundoV",       	GetPlayerData[playerid][P_World]);
		INI_WriteInt(PlayerStatsData, 		"Dinero",       	GetPlayerData[playerid][P_Money]);
		INI_WriteInt(PlayerStatsData, 		"Lider",       		GetPlayerData[playerid][P_Leader]);
		INI_WriteInt(PlayerStatsData, 		"Miembro",       	GetPlayerData[playerid][P_Member]);
		INI_WriteInt(PlayerStatsData, 		"Rango",       		GetPlayerData[playerid][P_Rank]);
		INI_WriteInt(PlayerStatsData, 		"FaccionID",       	GetPlayerData[playerid][P_FactionID]);
		INI_WriteInt(PlayerStatsData, 		"Baneado",       	GetPlayerData[playerid][P_Banned]);
		INI_WriteInt(PlayerStatsData, 		"Edad",       		GetPlayerData[playerid][P_Age]);
		INI_WriteInt(PlayerStatsData, 		"IsJailed",       	GetPlayerData[playerid][P_Jailed]);
		INI_WriteInt(PlayerStatsData, 		"JailedTime",       GetPlayerData[playerid][P_JailedTime]);
		INI_WriteInt(PlayerStatsData, 		"Reloj",       		GetPlayerData[playerid][P_Clock]);
		INI_WriteInt(PlayerStatsData, 		"Telefono",       	GetPlayerData[playerid][P_Phone]);
		INI_WriteInt(PlayerStatsData, 		"RadioOnline",      GetPlayerData[playerid][P_RadioOnline]);
		INI_WriteInt(PlayerStatsData, 		"Nivel",      		GetPlayerData[playerid][P_Level]);
		INI_WriteInt(PlayerStatsData, 		"PlateNum",       	GetPlayerData[playerid][P_PlateNum]);
		INI_WriteInt(PlayerStatsData, 		"WelcomeMusic",     GetPlayerData[playerid][P_WelcomeMusic]);
		INI_WriteInt(PlayerStatsData, 		"FightStyle",     	GetPlayerData[playerid][P_FightStyle]);
		INI_WriteInt(PlayerStatsData, 		"Ganzuas",      	GetPlayerData[playerid][P_Ganzuas]);
		INI_WriteInt(PlayerStatsData, 		"Materiales",      	GetPlayerData[playerid][P_Materiales]);
		INI_WriteInt(PlayerStatsData, 		"Drogas",      		GetPlayerData[playerid][P_Drugs][0]);
		INI_WriteInt(PlayerStatsData, 		"TimeLeft",      	GetPlayerData[playerid][P_TimeLeft]);
		INI_WriteInt(PlayerStatsData, 		"TotalTimeLeft",    GetPlayerData[playerid][P_TotalTimeLeft]);
		INI_WriteInt(PlayerStatsData, 		"Banco",      		GetPlayerData[playerid][P_BankAccount]);
		INI_WriteInt(PlayerStatsData, 		"Trabajo",      	GetPlayerData[playerid][P_Trabajo]);
		INI_WriteInt(PlayerStatsData, 		"TrabajoTime",     	GetPlayerData[playerid][P_TrabajoTime]);
		INI_WriteInt(PlayerStatsData, 		"Cospel",      		GetPlayerData[playerid][P_Cospel]);
		INI_WriteInt(PlayerStatsData, 		"Pasaporte",      	GetPlayerData[playerid][P_Pasaporte]);
		INI_WriteInt(PlayerStatsData, 		"CashInBag",      	GetPlayerData[playerid][P_CashInBag]);
		INI_WriteInt(PlayerStatsData, 		"PhoneType",      	GetPlayerData[playerid][P_PhoneType]);
		INI_WriteInt(PlayerStatsData, 		"Muertes",      	GetPlayerData[playerid][P_Deaths]);
		INI_WriteInt(PlayerStatsData, 		"Asesinatos",      	GetPlayerData[playerid][P_Kills]);
		INI_WriteInt(PlayerStatsData, 		"Carnadas",      	GetPlayerData[playerid][P_Carnadas]);
		INI_WriteInt(PlayerStatsData, 		"Fishes",      		GetPlayerData[playerid][P_Fishes]);
		INI_WriteInt(PlayerStatsData, 		"FishTool",      	GetPlayerData[playerid][P_FishTool]);
		INI_WriteInt(PlayerStatsData, 		"RentedHouse",     	GetPlayerData[playerid][P_RentedHouse]);
		INI_WriteInt(PlayerStatsData, 		"RentedHousePay",   GetPlayerData[playerid][P_RentedHousePay]);
		INI_WriteInt(PlayerStatsData, 		"HungryLevel",		GetPlayerData[playerid][P_HungryLevel]);
		INI_WriteInt(PlayerStatsData, 		"TutorialLevel",	GetPlayerData[playerid][P_TutoLevel]);
		INI_WriteInt(PlayerStatsData,       "DaysOn",    		GetPlayerData[playerid][P_DaysOn]);
		INI_WriteInt(PlayerStatsData,       "HoursOn",    		GetPlayerData[playerid][P_HoursOn]);
		INI_WriteInt(PlayerStatsData,       "MinsOn",    		GetPlayerData[playerid][P_MinsOn]);
		INI_WriteInt(PlayerStatsData,       "DoingTutorial",    GetPlayerData[playerid][P_DoingTutorial]);
		INI_WriteInt(PlayerStatsData,       "P_AnsweredQuest",  GetPlayerData[playerid][P_AnsweredQuest]);
		INI_WriteInt(PlayerStatsData,       "P_AnsweredReports",GetPlayerData[playerid][P_AnsweredReports]);
		INI_WriteInt(PlayerStatsData,       "P_DisableSpeedo",  GetPlayerData[playerid][P_DisableSpeedo]);
		INI_WriteInt(PlayerStatsData,       "WalkStyle",    	GetPlayerData[playerid][P_WalkStyle]);
		INI_WriteInt(PlayerStatsData,       "NextPay",    		GetPlayerData[playerid][P_NextPay]);
		INI_WriteInt(PlayerStatsData,       "NextTeam",    		GetPlayerData[playerid][P_NextTeam]);
		INI_WriteInt(PlayerStatsData,       "Horas",    		GetPlayerData[playerid][pHoras]);
		INI_WriteInt(PlayerStatsData,       "Minutos",    		GetPlayerData[playerid][pMinutos]);
		INI_WriteInt(PlayerStatsData,       "Segundos",    		GetPlayerData[playerid][pSegundos]);
 		INI_WriteInt(PlayerStatsData,       "Orina",    		GetPlayerData[playerid][pOrina]);
		INI_WriteInt(PlayerStatsData, 	"HambreJugador",       	GetPlayerData[playerid][pHambre]);
		INI_WriteInt(PlayerStatsData, 	"MensajesPrivados",       	GetPlayerData[playerid][pWhispers]);
		INI_WriteInt(PlayerStatsData, 	"Casco",       	GetPlayerData[playerid][pCasco]);
		INI_WriteInt(PlayerStatsData, 	"MinutosCel",       	GetPlayerData[playerid][pMinutes]);
		INI_WriteInt(PlayerStatsData, 	"MensajesCel",       	GetPlayerData[playerid][pMTexto]);
 	    INI_WriteString(PlayerStatsData, "Note1", 		GetPlayerData[playerid][pNote1]);
     	INI_WriteString(PlayerStatsData, "Note2", 		GetPlayerData[playerid][pNote2]);
     	INI_WriteString(PlayerStatsData, "Note3", 		GetPlayerData[playerid][pNote3]);
     	INI_WriteString(PlayerStatsData, "Note4", 		GetPlayerData[playerid][pNote4]);
     	INI_WriteString(PlayerStatsData, "Note5", 		GetPlayerData[playerid][pNote5]);
     	INI_WriteString(PlayerStatsData, "Note6", 		GetPlayerData[playerid][pNote6]);
		// Variables sin 'GetPlayerData'
		INI_WriteInt(PlayerStatsData, 		"Player_Entered_Bizz", 	Player_Entered_Bizz[playerid]);
		INI_WriteInt(PlayerStatsData, 		"PhoneStatus",      	PhoneStatus[playerid]);
		DoLoop(SlotID, false, MAX_PLAYER_FISHES)
		{
		    new FishSlotInfo[MAX_TEXTOS_CORTOS];
		    format(FishSlotInfo, sizeof(FishSlotInfo), "FishInSlot[%i]", 	SlotID);
			INI_WriteInt(PlayerStatsData,				FishSlotInfo,		GetPlayerData[playerid][P_FishInSlot][SlotID]);
		}
		DoLoop(ComidaID, false, MAX_PLAYER_COMIDAS)
		{
		    new EatInfo[MAX_TEXTOS_CORTOS];
		    format(EatInfo, sizeof(EatInfo), 	"ComidaComprada[%i]", 	ComidaID);
  			INI_WriteInt(PlayerStatsData, 		EatInfo, 				ComidaComprada[playerid][ComidaID]);
		}
		DoLoop(WeaponID, false, MAX_PLAYER_WEAPON)
		{
		    new WeaponInfo[MAX_TEXTOS_CORTOS];
		    format(WeaponInfo, sizeof(WeaponInfo), "Arma[%i]", 		WeaponID, GetPlayerData[playerid][P_Weapon][WeaponID]);
		    INI_WriteInt(PlayerStatsData, 			WeaponInfo, 	GetPlayerData[playerid][P_Weapon][WeaponID]);
		    format(WeaponInfo, sizeof(WeaponInfo), "Balas[%i]", 	WeaponID, GetPlayerData[playerid][P_Ammo][WeaponID]);
	    	INI_WriteInt(PlayerStatsData, 			WeaponInfo,		GetPlayerData[playerid][P_Ammo][WeaponID]);
		}
		DoLoop(All, false, MAX_PLAYER_LICENCES)
		{
		    new LicenceInfo[MAX_TEXTOS_CORTOS];
		    format(LicenceInfo, sizeof(LicenceInfo), 	"Licencias[%i]", 	All);
  			INI_WriteInt(PlayerStatsData, 		 		LicenceInfo, 		GetPlayerData[playerid][P_Licences][All]);
  		}
  		DoLoop(BlockID, false, MAX_BLOCK_COUNT)
		{
		    new CommandInfo[MAX_TEXTOS_CORTOS];
		    format(CommandInfo, sizeof(CommandInfo), 	"BlockCommands[%i]", BlockID);
  			INI_WriteString(PlayerStatsData, 		 	CommandInfo, 		 Player_Command_Blocked[playerid][BlockID]);
		}
    	INI_WriteString(PlayerStatsData,		"Sexo", 			GetPlayerData[playerid][P_SexName]);
	   	INI_WriteString(PlayerStatsData,		"Ciudad", 			GetPlayerData[playerid][P_City]);
	    INI_WriteString(PlayerStatsData,		"LastIP", 			GetPlayerData[playerid][P_MyLastIP]);
		INI_WriteString(PlayerStatsData,		"JailRazon", 		GetPlayerData[playerid][P_JailedReason]);
		INI_Close(PlayerStatsData);
	}
	return 1;
}
Reply
#6

Aumenta el tiempo de actualizaciуn como ъltima.

Aunque mejor quitalo y actualiza datos solo cuando desconecta. El uso de archivos, en SA-MP (actualmente), a diferencia de MySQL (por el plugin de blueG) se ejecuta en el mismo hilo del demбs cуdigo, por lo que provocarб lag por obvias razones.
Reply
#7

Es que en disconet esta pero como actualizo su tiempo?

Код:
public OnPlayerDisconnect(playerid, reason)
{
    YSI_Save_Account(playerid);
Reply
#8

El segundo parбmetro de la funciуn "SetTimerEx" son los mili segundos que deberбn transcurrir para que la callback sea llamada.
Reply
#9

Pero no me recomendaron que no lo usara que me provoca lag cosa que lo hace?
Reply
#10

Sн. Con las funciones nativas serб lento.

Mira esto: https://sampforum.blast.hk/showthread.php?tid=286453

Dudo que lo entiendas... solo fнjate en el color celeste ese... es bonito. Jaja.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)