how to save?
#1

who i need to do,to levels,who im buy will be saved when im left from server?
when im join to server,i want to levels be these,who i buy first exit the server.

sry,my english is bad,im from latvia..

ミ墟セミエ:
//|~~~~~~~~|=============================================================================|~~~~~~~~|
//|~~~~~~~~|	 |By [HiC]Thekiller & ~CueBall~ Translated to spanish by Hernan_ER|   |~~~~~~~~|
//|~~~~~~~~|=============================================================================|~~~~~~~~|
//------ includes
#include <a_samp>
#include <dutils>
#include <DINI>
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//-------level!
new LVL[MAX_PLAYERS];
new Kills[MAX_PLAYERS];
#define LVL_SAVE//If you want the players level to save when they disconnect! If not comment it!
#define LVL_WEPONS //Comment if you do not want any of the weapon/armor/health things on spawn ("//")!
#define LVL_MESSAGE_COLOR 0x00B8FF
//Colores defines
#define c_y 0xFFFF00AA
#define c_r 0xAA3333AA
#define c_w 0xFFFFFFAA
#define c_a 0x00FFFFFF
//-------Nivel defines!
#define LVL_1 200000 //La cantidad de muertes que se necesita para ascender al prムベimo nivel!
#define LVL_2 400000//La cantidad de muertes que se necesita para ascender al prムベimo nivel!
#define LVL_3 500000 //La cantidad de muertes que se necesita para ascender al prムベimo nivel!
#define LVL_4 650000 //La cantidad de muertes que se necesita para ascender al prムベimo nivel!
#define LVL_5 900000 //La cantidad de muertes que se necesita para ascender al prムベimo nivel!
#define LVL_6 1200000//La cantidad de muertes que se necesita para ascender al prムベimo nivel!
#define LVL_7 1500000//La cantidad de muertes que se necesita para ascender al prムベimo nivel!
#define LVL_8 1900000 //La cantidad de muertes que se necesita para ascender al prムベimo nivel!
#define LVL_9 2200000//La cantidad de muertes que se necesita para ascender al prムベimo nivel!
#define LVL_10 2500000 //La cantidad de muertes que se necesita para ascender al prムベimo nivel!
//=====================================
//Leave bellow the same if you don't want to use or change if you do :P ;)
#define LVL_1_WEAPON1 23 	  // Arma 1 [ID].
#define LVL_1_WEAPON1_AMMO 500 // Arma 1 [Municiムハ].
#define LVL_1_WEAPON2 25 	  // Arma 2 [ID].
#define LVL_1_WEAPON2_AMMO 200 // Arma 2 [Municiムハ].
#define LVL_1_WEAPON3 29    // Arma 3 [ID].
#define LVL_1_WEAPON3_AMMO 800 // Arma 3 [Municiムハ].
#define LVL_1_HEALTH 100 	  // Salud [Cantidad].
#define LVL_1_ARMOR 0 		  // Chaleco antibalas [Cantidad].
//-
#define LVL_2_WEAPON1 23
#define LVL_2_WEAPON1_AMMO 700
#define LVL_2_WEAPON2 25
#define LVL_2_WEAPON2_AMMO 300
#define LVL_2_WEAPON3 29
#define LVL_2_WEAPON3_AMMO 1500
#define LVL_2_HEALTH 100
#define LVL_2_ARMOR 0
//-
#define LVL_3_WEAPON1 23
#define LVL_3_WEAPON1_AMMO 800
#define LVL_3_WEAPON2 25
#define LVL_3_WEAPON2_AMMO 300
#define LVL_3_WEAPON3 29
#define LVL_3_WEAPON3_AMMO 2000
#define LVL_3_HEALTH 100
#define LVL_3_ARMOR 0
//-
#define LVL_4_WEAPON1 23
#define LVL_4_WEAPON1_AMMO 1000
#define LVL_4_WEAPON2 25
#define LVL_4_WEAPON2_AMMO 500
#define LVL_4_WEAPON3 29
#define LVL_4_WEAPON3_AMMO 2500
#define LVL_4_HEALTH 100
#define LVL_4_ARMOR 0
//-
#define LVL_5_WEAPON1 22
#define LVL_5_WEAPON1_AMMO 1200
#define LVL_5_WEAPON2 27
#define LVL_5_WEAPON2_AMMO 600
#define LVL_5_WEAPON3 28
#define LVL_5_WEAPON3_AMMO 3000
#define LVL_5_HEALTH 100
#define LVL_5_ARMOR 0
//-
#define LVL_6_WEAPON1 22
#define LVL_6_WEAPON1_AMMO 1400
#define LVL_6_WEAPON2 27
#define LVL_6_WEAPON2_AMMO 800
#define LVL_6_WEAPON3 28
#define LVL_6_WEAPON3_AMMO 3500
#define LVL_6_HEALTH 100
#define LVL_6_ARMOR 0
//-
#define LVL_7_WEAPON1 22
#define LVL_7_WEAPON1_AMMO 1600
#define LVL_7_WEAPON2 27
#define LVL_7_WEAPON2_AMMO 1000
#define LVL_7_WEAPON3 28
#define LVL_7_WEAPON3_AMMO 3800
#define LVL_7_HEALTH 100
#define LVL_7_ARMOR 0
//-
#define LVL_8_WEAPON1 22
#define LVL_8_WEAPON1_AMMO 1800
#define LVL_8_WEAPON2 27
#define LVL_8_WEAPON2_AMMO 1200
#define LVL_8_WEAPON3 28
#define LVL_8_WEAPON3_AMMO 4000
#define LVL_8_HEALTH 100
#define LVL_8_ARMOR 0
//-
#define LVL_9_WEAPON1 32
#define LVL_9_WEAPON1_AMMO 5000
#define LVL_9_WEAPON2 26
#define LVL_9_WEAPON2_AMMO 2000
#define LVL_9_WEAPON3 31
#define LVL_9_WEAPON3_AMMO 6000
#define LVL_9_HEALTH 100
#define LVL_9_ARMOR 0
//-
#define LVL_10_WEAPON1 32
#define LVL_10_WEAPON1_AMMO 999999
#define LVL_10_WEAPON2 26
#define LVL_10_WEAPON2_AMMO 999999
#define LVL_10_WEAPON3 31
#define LVL_10_WEAPON3_AMMO 999999
#define LVL_10_HEALTH 100
#define LVL_10_ARMOR 0
//===========================|

public OnFilterScriptInit()
{
	print("\n---------------------------------------------------------------------------------");
	print("  [HiC]TheKiller's Level script - Editado y traducido al espan~ol por Hernan_ER  ");
	print("---------------------------------------------------------------------------------\n");
	SetTimer("level",500,true);//Cambia esto si queres que cheque el nivel mas a menudo o menos.
  if(!dini_Exists("Niveles.cfg"))
	{
  	dini_Create("Niveles.cfg");
	}

 	if(!dini_Exists("Asesinatos.cfg"))
	{
  	dini_Create("Asesinatos.cfg");
	}
	return 1;
}

public OnPlayerConnect(playerid)
{
  #if defined LVL_SAVE
  new Pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, Pname, sizeof(Pname));
	LVL[playerid] = dini_Int("Niveles.cfg", Pname);
	Kills[playerid] = dini_Int("Asesinatos.cfg", Pname);
	#endif
	return 1;
}


public OnPlayerDisconnect(playerid)
{
  #if defined LVL_SAVE
	new Pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, Pname, sizeof(Pname));
	dini_IntSet("Niveles.cfg", Pname, LVL[playerid]);
	dini_IntSet("Asesinatos.cfg", Pname, Kills[playerid]);
	#endif
	return 1;
}

	#if defined LVL_WEPONS
public OnPlayerSpawn(playerid)
{
//-------Armas, salud y chaleco antibalas que da cada nivel.
	if (LVL[playerid]==1)
	{
		GivePlayerWeapon(playerid,LVL_1_WEAPON1,LVL_1_WEAPON1_AMMO);
		GivePlayerWeapon(playerid,LVL_1_WEAPON2,LVL_1_WEAPON2_AMMO);
		GivePlayerWeapon(playerid,LVL_1_WEAPON3,LVL_1_WEAPON3_AMMO);
		SetPlayerHealth(playerid,LVL_1_HEALTH);
		SetPlayerArmour(playerid,LVL_1_ARMOR);
 	}

	if (LVL[playerid]==2)
	{
		GivePlayerWeapon(playerid,LVL_2_WEAPON1,LVL_2_WEAPON1_AMMO);
		GivePlayerWeapon(playerid,LVL_2_WEAPON2,LVL_2_WEAPON2_AMMO);
		GivePlayerWeapon(playerid,LVL_2_WEAPON3,LVL_2_WEAPON3_AMMO);
		SetPlayerHealth(playerid,LVL_2_HEALTH);
		SetPlayerArmour(playerid,LVL_2_ARMOR);
	}

	if (LVL[playerid]==3)
	{
		GivePlayerWeapon(playerid,LVL_3_WEAPON1,LVL_3_WEAPON1_AMMO);
		GivePlayerWeapon(playerid,LVL_3_WEAPON2,LVL_3_WEAPON2_AMMO);
		GivePlayerWeapon(playerid,LVL_3_WEAPON3,LVL_3_WEAPON3_AMMO);
		SetPlayerHealth(playerid,LVL_3_HEALTH);
		SetPlayerArmour(playerid,LVL_3_ARMOR);
	}

	if (LVL[playerid]==4)
	{
		GivePlayerWeapon(playerid,LVL_4_WEAPON1,LVL_4_WEAPON1_AMMO);
		GivePlayerWeapon(playerid,LVL_4_WEAPON2,LVL_4_WEAPON2_AMMO);
		GivePlayerWeapon(playerid,LVL_4_WEAPON3,LVL_4_WEAPON3_AMMO);
		SetPlayerHealth(playerid,LVL_4_HEALTH);
		SetPlayerArmour(playerid,LVL_4_ARMOR);
	}

	if (LVL[playerid]==5)
	{
		GivePlayerWeapon(playerid,LVL_5_WEAPON1,LVL_5_WEAPON1_AMMO);
		GivePlayerWeapon(playerid,LVL_5_WEAPON2,LVL_5_WEAPON2_AMMO);
		GivePlayerWeapon(playerid,LVL_5_WEAPON3,LVL_5_WEAPON3_AMMO);
		SetPlayerHealth(playerid,LVL_5_HEALTH);
		SetPlayerArmour(playerid,LVL_5_ARMOR);
	}

	if (LVL[playerid]==6)
	{
		GivePlayerWeapon(playerid,LVL_6_WEAPON1,LVL_6_WEAPON1_AMMO);
		GivePlayerWeapon(playerid,LVL_6_WEAPON2,LVL_6_WEAPON2_AMMO);
		GivePlayerWeapon(playerid,LVL_6_WEAPON3,LVL_6_WEAPON3_AMMO);
		SetPlayerHealth(playerid,LVL_6_HEALTH);
		SetPlayerArmour(playerid,LVL_6_ARMOR);
	}

	if (LVL[playerid]==7)
	{
		GivePlayerWeapon(playerid,LVL_7_WEAPON1,LVL_7_WEAPON1_AMMO);
		GivePlayerWeapon(playerid,LVL_7_WEAPON2,LVL_7_WEAPON2_AMMO);
		GivePlayerWeapon(playerid,LVL_7_WEAPON3,LVL_7_WEAPON3_AMMO);
		SetPlayerHealth(playerid,LVL_7_HEALTH);
		SetPlayerArmour(playerid,LVL_7_ARMOR);
	}

	if (LVL[playerid]==8)
	{
		GivePlayerWeapon(playerid,LVL_8_WEAPON1,LVL_8_WEAPON1_AMMO);
		GivePlayerWeapon(playerid,LVL_8_WEAPON2,LVL_8_WEAPON2_AMMO);
		GivePlayerWeapon(playerid,LVL_8_WEAPON3,LVL_8_WEAPON3_AMMO);
		SetPlayerHealth(playerid,LVL_8_HEALTH);
		SetPlayerArmour(playerid,LVL_8_ARMOR);
	}

	if (LVL[playerid]==9)
	{
		GivePlayerWeapon(playerid,LVL_9_WEAPON1,LVL_9_WEAPON1_AMMO);
		GivePlayerWeapon(playerid,LVL_9_WEAPON2,LVL_9_WEAPON2_AMMO);
		GivePlayerWeapon(playerid,LVL_9_WEAPON3,LVL_9_WEAPON3_AMMO);
		SetPlayerHealth(playerid,LVL_9_HEALTH);
		SetPlayerArmour(playerid,LVL_9_ARMOR);
	}

	if (LVL[playerid]==10)
	{
		GivePlayerWeapon(playerid,LVL_10_WEAPON1,LVL_10_WEAPON1_AMMO);
		GivePlayerWeapon(playerid,LVL_10_WEAPON2,LVL_10_WEAPON2_AMMO);
		GivePlayerWeapon(playerid,LVL_10_WEAPON3,LVL_10_WEAPON3_AMMO);
		SetPlayerHealth(playerid,LVL_10_HEALTH);
		SetPlayerArmour(playerid,LVL_10_ARMOR);
	}
	return 1;
}
#endif



forward level(playerid);
public level(playerid)
{
	for(new i=0; i < MAX_PLAYERS; i++)
	{
	  if(GetPlayerMoney(i) >= LVL_1 && LVL[i] == 0)
		{
    	SendClientMessage(i,LVL_MESSAGE_COLOR,"Apsveicam! Jナォs esat sasniedzis 1. lトォmeni!");
     	LVL[i] = 1;
      SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
     	GivePlayerMoney(playerid,-200000);//SetPlayerScore(playerid, LVL);
		}

		if(GetPlayerMoney(i) >= LVL_2 && LVL[i] == 1)
		{
    	SendClientMessage(i,LVL_MESSAGE_COLOR,"Apsveicam! Jナォs esat sasniedzis 2. lトォmeni!");
     	LVL[i] = 2;
     	SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
     	GivePlayerMoney(playerid,-400000);
		}

	  if(GetPlayerMoney(i) >= LVL_3 && LVL[i] == 2)
		{
    	SendClientMessage(i,LVL_MESSAGE_COLOR,"Apsveicam! Jナォs esat sasniedzis 3. lトォmeni!");
     	LVL[i] = 3;
     	SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
     	GivePlayerMoney(playerid,-500000);
		}

		if(GetPlayerMoney(i) >= LVL_4 && LVL[i] == 3)
		{
    	SendClientMessage(i,LVL_MESSAGE_COLOR,"Apsveicam! Jナォs esat sasniedzis 4. lトォmeni!");
     	LVL[i] = 4;
     	SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
     	GivePlayerMoney(playerid,-650000);
		}

 	  if(GetPlayerMoney(i) >= LVL_5 && LVL[i] == 4)
		{
    	SendClientMessage(i,LVL_MESSAGE_COLOR,"Apsveicam! Jナォs esat sasniedzis 5. lトォmeni!");
     	LVL[i] = 5;
     	SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
     	GivePlayerMoney(playerid,-900000);
		}

		if(GetPlayerMoney(i) >= LVL_6 && LVL[i] == 5)
		{
    	SendClientMessage(i,LVL_MESSAGE_COLOR,"Apsveicam! Jナォs esat sasniedzis 6. lトォmeni!");
     	LVL[i] = 6;
     	SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
     	GivePlayerMoney(playerid,-1200000);
		}

	  if(GetPlayerMoney(i) >= LVL_7 && LVL[i] == 6)
		{
    	SendClientMessage(i,LVL_MESSAGE_COLOR,"Apsveicam! Jナォs esat sasniedzis 7. lトォmeni!");
     	LVL[i] = 7;
     	SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
     	GivePlayerMoney(playerid,-1500000);
		}

		if(GetPlayerMoney(i) >= LVL_8 && LVL[i] == 7)
		{
    	SendClientMessage(i,LVL_MESSAGE_COLOR,"Apsveicam! Jナォs esat sasniedzis 8. lトォmeni!");
     	LVL[i] = 8;
     	SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
     	GivePlayerMoney(playerid,-1900000);
		}

 		if(GetPlayerMoney(i) >= LVL_9&& LVL[i] == 8)
		{
    	SendClientMessage(i,LVL_MESSAGE_COLOR,"Apsveicam! Jナォs esat sasniedzis 19. lトォmeni!");
     	LVL[i] = 9;
     	SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
     	GivePlayerMoney(playerid,-	2200000);
		}

		if(GetPlayerMoney(i) >= LVL_10 && LVL[i] == 9)
		{
    	SendClientMessage(i,LVL_MESSAGE_COLOR,"Apsveicam! Jナォs esat sasniedzis 10. lトォmeni!");
     	LVL[i] = 10;
     	SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
     	GivePlayerMoney(playerid,-2500000);

		}
	}
	return 1;
}

public OnPlayerDeath(playerid,killerid,reason)
{
	if(killerid != INVALID_PLAYER_ID)
	{
		Kills[killerid]++;
	}
	return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/niveles", cmdtext, true, 10) == 0)
	{
	  new string1[512],string2[512];
	  format(string1, sizeof (string1), "Nivel 1: %d \r\n Nivel 2: %d \r\n Nivel 3: %d \r\n Nivel 4: %d \r\n Nivel 5: %d \r\n ",LVL_1,LVL_2,LVL_3,LVL_4,LVL_5);
	  format(string2, sizeof (string2), "Nivel 6: %d \r\n Nivel 7: %d \r\n Nivel 8: %d \r\n Nivel 9: %d \r\n Nivel 10: %d \r\n",LVL_6,LVL_7,LVL_8,LVL_9,LVL_10);
    SendClientMessage(playerid,0xAA3333AA,"Niveles:");
		SendClientMessage(playerid,0xF4FFFFFF,string1);
		SendClientMessage(playerid,0xF4FFFFFF,string2);
		SendClientMessage(playerid,0xF414FFFF,"Tu nivel sera' guardado cuando salgas!");
		return 1;
	}
	//------DCMD Commands
	dcmd(nivel, 5, cmdtext);
	dcmd(asesinatos, 10, cmdtext);
	dcmd(LevelSet, 8, cmdtext);
	return 0;
}

dcmd_nivel(playerid, params[])
{
  new id, pname[24] ,string[256];
	if (sscanf(params, "d", id))
	return SendClientMessage(playerid, 0xAA3333AA, "USO: /nivel [ID Jugador]");
	else if (!IsPlayerConnected(id))
	return SendClientMessage(playerid, 0xAA3333AA, "El jugador no esta' conectado");
  	else
  {
    GetPlayerName(id,pname,24);
 		format(string, sizeof (string), "%s es nivel %d",pname,LVL[id]);
  	SendClientMessage(playerid,0x0660FF,string);
  }

	return 1;
}

dcmd_asesinatos(playerid, params[])
{
  new id, pname[24] ,string[256];
	if (sscanf(params, "d", id))
	return SendClientMessage(playerid, 0xAA3333AA, "USO: /asesinatos [ID Jugador]");
	else if (!IsPlayerConnected(id))
	return SendClientMessage(playerid, 0xAA3333AA, "El jugador no esta' conectado");
	else
	{
	  GetPlayerName(id,pname,MAX_PLAYER_NAME);
	  format(string,sizeof(string),"%s tiene %d asesinatos",pname,Kills[id]);
	  SendClientMessage(playerid,0x0660FF,string);
	}
	return 1;
}


dcmd_LevelSet(playerid, params[])
{

  new id,LVL2 ,string[256],name[24];
  GetPlayerName(playerid,name,24);
	if (sscanf(params, "d,i", id,LVL2))
	return SendClientMessage(playerid, 0xAA3333AA, "USO: /levelset [ID Jugador] [Nivel]");
	else if (!IsPlayerConnected(id))
	return SendClientMessage(playerid, 0xAA3333AA, "El jugador no esta' conectado");
	else if (!IsPlayerAdmin(playerid))
	return SendClientMessage(playerid, 0xAA3333AA, "No sos administrador");
	else if (LVL2>10&&LVL2<0)
	return SendClientMessage(playerid, 0xAA3333AA, "Los niveles pueden ser entre 0-10!");
	else if (LVL2==0)
	{
		LVL[id] =0;
		format(string, sizeof (string), "%s te ha hecho nivel 0",name);
		SetPlayerScore(id,0);
		SendClientMessage(id,0x0660FF,string);
		Kills[id]=0;
	}
	else if (LVL2==1)
	{
		LVL[id] =1;
		format(string, sizeof (string), "%s te ha hecho nivel 1",name);
		SendClientMessage(id,0x0660FF,string);
		Kills[id]=LVL_1;
	}
	else if (LVL2==2)
	{
 		LVL[id] =2;
 		format(string, sizeof (string), "%s te ha hecho nivel 2",name);
 		SendClientMessage(id,0x0660FF,string);
 		Kills[id]=LVL_2;
 	}
	else if (LVL2==3){
		LVL[id] =3;
		format(string, sizeof (string), "%s te ha hecho nivel 3",name);
		SendClientMessage(id,0x0660FF,string);
		Kills[id]=LVL_3;
	}
	else if (LVL2==4)
 	{
 		LVL[id] =4;
 		format(string, sizeof (string), "%s te ha hecho nivel 4",name);
 		SendClientMessage(id,0x0660FF,string);
 		Kills[id]=LVL_4;

 	}
	else if (LVL2==5)
	{
 		LVL[id] =5;
 		format(string, sizeof (string), "%s te ha hecho nivel 5",name);
 		SendClientMessage(id,0x0660FF,string);
 		Kills[id]=LVL_5;
 	}
	else if (LVL2==6)
	{
 		LVL[id] =6;
 		format(string, sizeof (string), "%s te ha hecho nivel 6",name);
 		SendClientMessage(id,0x0660FF,string);
 		Kills[id]=LVL_6;
 	}
	else if (LVL2==7)
 	{
		LVL[id] =7;
		format(string, sizeof (string), "%s te ha hecho nivel 7",name);
		SendClientMessage(id,0x0660FF,string);
		Kills[id]=LVL_7;
	}
	else if (LVL2==8)
	{
		LVL[id] =8;
		format(string, sizeof (string), "%s te ha hecho nivel 8",name);
		SendClientMessage(id,0x0660FF,string);
		Kills[id]=LVL_8;
 	}
	else if (LVL2==9)
 	{
		LVL[id] =9;
		format(string, sizeof (string), "%s te ha hecho nivel 9",name);
		SendClientMessage(id,0x0660FF,string);
		Kills[id]=LVL_9;
	}
	else if (LVL2==10){
		LVL[id] =10;
		format(string, sizeof (string), "%s te ha hecho nivel 10",name);
		SendClientMessage(id,0x0660FF,string);
		Kills[id]=LVL_10;
	}

	return 1;
}


stock GetPlayerKills(playerid)
{
	return Kills[playerid];
}
//----------------------------------------------Sccanaf---------------------------------------------------
stock sscanf(string[], format[], {Float,_}:...)
{
	new
		formatPos = 0,
		stringPos = 0,
		paramPos = 2,
		paramCount = numargs();
	while (paramPos < paramCount && string[stringPos])
	{
		switch (format[formatPos++])
		{
			case '\0':
			{
				return 0;
			}
			case 'i', 'd':
			{
				new
					neg = 1,
					num = 0,
					ch = string[stringPos];
				if (ch == '-')
				{
					neg = -1;
					ch = string[++stringPos];
				}
				do
				{
					stringPos++;
					if (ch >= '0' && ch <= '9')
					{
						num = (num * 10) + (ch - '0');
					}
					else
					{
						return 1;
					}
				}
				while ((ch = string[stringPos]) && ch != ' ');
				setarg(paramPos, 0, num * neg);
			}
			case 'h', 'x':
			{
				new
					ch,
					num = 0;
				while ((ch = string[stringPos++]))
				{
					switch (ch)
					{
						case 'x', 'X':
						{
							num = 0;
							continue;
						}
						case '0' .. '9':
						{
							num = (num << 4) | (ch - '0');
						}
						case 'a' .. 'f':
						{
							num = (num << 4) | (ch - ('a' - 10));
						}
						case 'A' .. 'F':
						{
							num = (num << 4) | (ch - ('A' - 10));
						}
						case ' ':
						{
							break;
						}
						default:
						{
							return 1;
						}
					}
				}
				setarg(paramPos, 0, num);
			}
			case 'c':
			{
				setarg(paramPos, 0, string[stringPos++]);
			}
			case 'f':
			{
				new tmp[25];
				strmid(tmp, string, stringPos, stringPos+sizeof(tmp)-2);
				setarg(paramPos, 0, _:floatstr(tmp));
			}
			case 's', 'z':
			{
				new
					i = 0,
					ch;
				if (format[formatPos])
				{
					while ((ch = string[stringPos++]) && ch != ' ')
					{
						setarg(paramPos, i++, ch);
					}
					if (!i) return 1;
				}
				else
				{
					while ((ch = string[stringPos++]))
					{
						setarg(paramPos, i++, ch);
					}
				}
				stringPos--;
				setarg(paramPos, i, '\0');
			}
			default:
			{
				continue;
			}
		}
		while (string[stringPos] && string[stringPos] != ' ')
		{
			stringPos++;
		}
		while (string[stringPos] == ' ')
		{
			stringPos++;
		}
		paramPos++;
	}
	while (format[formatPos] == 'z') formatPos++;
	return format[formatPos];
}
//-----------------------------END-------------------------
Reply


Messages In This Thread
how to save? - by Hawkz_Ryder - 05.08.2009, 17:37
Re: how to save? - by Anarkien - 05.08.2009, 17:38
Re: how to save? - by Hawkz_Ryder - 05.08.2009, 17:52
Re: how to save? - by Correlli - 05.08.2009, 18:00

Forum Jump:


Users browsing this thread: 2 Guest(s)