їCуmo lo hago?
#1

Lo vengo tratando de pensar hace rato, trasladar esto a MYSQL, especнficamente uso la R20, lo tratй de hacer, el creado normal, pero el cargado no me funcionу asн que borrй todo y recurro acб a ver si alguien me ayuda, asн es el cуdigo no es mucho, es algo simple.

Код:
stock Tags_Save(playerid, iIndex)
{
	if(IsPlayerConnected(playerid))
	{
		new
			szFile[32], szLine[128], szName[MAX_PLAYER_NAME]
		;

		GetPlayerName(playerid, szName, MAX_PLAYER_NAME);
		format(szFile, 32, SPRAYTAG_FOLDER, szName);
		if(!DOF2_FileExists(szFile)) DOF2_CreateFile(szFile);
		{
			format(szLine, sizeof szLine, "Text%i", iIndex); DOF2_SetString(szFile, szLine, SprayTags[playerid][iIndex][_spText]);
			format(szLine, sizeof szLine, "Font%i", iIndex); DOF2_SetString(szFile, szLine, SprayTags[playerid][iIndex][_spFont]);
			format(szLine, sizeof szLine, "FontSize%i", iIndex); DOF2_SetInt(szFile, szLine, SprayTags[playerid][iIndex][_spFontSize]);
			format(szLine, sizeof szLine, "FontBold%i", iIndex); DOF2_SetInt(szFile, szLine, SprayTags[playerid][iIndex][_spBold]);
			format(szLine, sizeof szLine, "FontColor%i", iIndex); DOF2_SetInt(szFile, szLine, SprayTags[playerid][iIndex][_spFontColor]);
			format(szLine, sizeof szLine, "PosX%i", iIndex); DOF2_SetFloat(szFile, szLine, SprayTags[playerid][iIndex][_spPosX]);
			format(szLine, sizeof szLine, "PosY%i", iIndex); DOF2_SetFloat(szFile, szLine, SprayTags[playerid][iIndex][_spPosY]);
			format(szLine, sizeof szLine, "PosZ%i", iIndex); DOF2_SetFloat(szFile, szLine, SprayTags[playerid][iIndex][_spPosZ]);
			format(szLine, sizeof szLine, "RotX%i", iIndex); DOF2_SetFloat(szFile, szLine, SprayTags[playerid][iIndex][_spPosRX]);
			format(szLine, sizeof szLine, "RotY%i", iIndex); DOF2_SetFloat(szFile, szLine, SprayTags[playerid][iIndex][_spPosRY]);
			format(szLine, sizeof szLine, "RotZ%i", iIndex); DOF2_SetFloat(szFile, szLine, SprayTags[playerid][iIndex][_spPosRZ]);
			format(szLine, sizeof szLine, "VirtualWorld%i", iIndex); DOF2_SetInt(szFile, szLine, SprayTags[playerid][iIndex][_spVW]);
			format(szLine, sizeof szLine, "Interior%i", iIndex); DOF2_SetInt(szFile, szLine, SprayTags[playerid][iIndex][_spInt]);
			DOF2_SaveFile();
		}
	}
	return 1;
}
stock Tag_Load(playerid)
{
	if(IsPlayerConnected(playerid))
	{
		new
			szFile[40], szLine[28], szName[MAX_PLAYER_NAME]
		;
		GetPlayerName(playerid, szName, MAX_PLAYER_NAME);
		format(szFile, 40, SPRAYTAG_FOLDER, szName);

		for(new i; i < MAX_PLAYERS_TAGS; i++)
		{
			format(szLine, sizeof szLine, "Text%i", i); format(SprayTags[playerid][i][_spText], 50, DOF2_GetString(szFile, szLine));
			format(szLine, sizeof szLine, "Font%i", i); format(SprayTags[playerid][i][_spFont], 50, DOF2_GetString(szFile, szLine));
			format(szLine, sizeof szLine, "FontSize%i", i); SprayTags[playerid][i][_spFontSize] = DOF2_GetInt(szFile, szLine);
			format(szLine, sizeof szLine, "FontBold%i", i); SprayTags[playerid][i][_spBold] = DOF2_GetInt(szFile, szLine);
			format(szLine, sizeof szLine, "FontColor%i", i); SprayTags[playerid][i][_spFontColor] = DOF2_GetInt(szFile, szLine);
			format(szLine, sizeof szLine, "PosX%i", i); SprayTags[playerid][i][_spPosX] = DOF2_GetFloat(szFile, szLine);
			format(szLine, sizeof szLine, "PosY%i", i); SprayTags[playerid][i][_spPosY] = DOF2_GetFloat(szFile, szLine);
			format(szLine, sizeof szLine, "PosZ%i", i); SprayTags[playerid][i][_spPosZ] = DOF2_GetFloat(szFile, szLine);
			format(szLine, sizeof szLine, "RotX%i", i); SprayTags[playerid][i][_spPosRX] = DOF2_GetFloat(szFile, szLine);
			format(szLine, sizeof szLine, "RotY%i", i); SprayTags[playerid][i][_spPosRY] = DOF2_GetFloat(szFile, szLine);
			format(szLine, sizeof szLine, "RotZ%i", i); SprayTags[playerid][i][_spPosRZ] = DOF2_GetFloat(szFile, szLine);
			format(szLine, sizeof szLine, "VirtualWorld%i", i); SprayTags[playerid][i][_spVW] = DOF2_GetInt(szFile, szLine);
			format(szLine, sizeof szLine, "Interior%i", i); SprayTags[playerid][i][_spInt] = DOF2_GetInt(szFile, szLine);

			if(SprayTags[playerid][i][_spPosX] != 0.0)
			{
				SprayTag_Spawn(playerid, i);
			}
		}
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)