08.04.2012, 01:17
Estou editando um sistema de bazuca й queria saber se tem jeito de tipo salva as balas que ele estava e quando pegava novamente vinha com as mesmas balas.
+rep
+rep
new balas = GetPlayerAmmo(playerid);
// depois
GivePlayerWeapon(playerid, 35, balas);
pawn Код:
|
new Armas[13][2];//Topo
//Quando o player sair.
new Nome[24], string[28], str[8];
GetPlayerName(playerid, Nome, 24);
format(string, sizeof(string), "/Players/%s.ini", Nome);
for (new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, Armas[i][0], Armas[i][1]);
format(str, sizeof(str), "Arma%d", i);
dini_IntSet(string, str, Armas[i][0]);
format(str, sizeof(str), "Balla%d", i);
dini_IntSet(string, str, Armas[i][1]);
}
//Quando o Player logar.
for (new i = 0; i < 13; i++)
{
format(str, sizeof(str), "Arma%d", i);
Armas[i][0] = dini_Int(string, str);
format(str, sizeof(str), "Balla%d", i);
Armas[i][1] = dini_Int(string, str);
GivePlayerWeapon(playerid, Armas[i][0], Armas[i][1]);
}
#define WEAPON_FILE "armas.cfg"
stock SaveWeapons(playerid)
{
new
pharrel[128],
string_[29],
weapon,
ammo;
for(new i=0; i<13; i++)
{
GetPlayerWeaponData(playerid, i, weapon, ammo);
format(string_, 5,"%d%d",weapon,ammo);
strcat(pharrel, string_);
}
GetPlayerName(playerid, string_, 24);
INI_Open(WEAPONS_FILE);
INI_WriteString(string_, pharrel);
INI_Close();
ResetPlayerWeapons(playerid);
return 1;
}
stock LoadWeapons(playerid)
{
new
string_[29],
pharrel[128],
weapon[13],
ammo[13];
GetPlayerName(playerid, string_, 24);
INI_Open(WEAPONS_FILE);
INI_ReadString(pharrel,string_,128);
INI_RemoveEntry(string_);
INI_Close();
unformat(pharrel, "dddddddddddddddddddddddd",weapon[0],ammo[0],weapon[1],ammo[1],weapon[2],ammo[2],weapon[3],ammo[3],weapon[4],ammo[4],weapon[5],ammo[5],weapon[6],ammo[6],weapon[7],ammo[7],weapon[8],ammo[8],weapon[9],ammo[9],weapon[10],ammo[10],weapon[11],ammo[11],weapon[12],ammo[12]);
for(new i=0; i<13; i++)
{
if(ammo[i] > 0)
GivePlayerWeapon(playerid, weapon[i], ammo[i]);
}
return 1;
}
pawn Код:
|