Bocsi.
new PlayerWeapons[12][MAX_PLAYERS];
new PlayerAmmo[12][MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
for(new w=0;w<13;w++)
{
PlayerWeapons[w][playerid]=0;
PlayerAmmo[w][playerid]=0;
}
}
Mentés:
for(new weap=0;weap<13;weap++)
{
GetPlayerWeaponData(playerid,weap,PlayerWeapons[weap][playerid],PlayerAmmo[weap][playerid]);
new slotname[20];
format(slotname,sizeof(slotname),\"Slot%d\",weap);
dini_IntSet(file,slotname,PlayerWeapons[weap][playerid]);
new slotammo[20];
format(slotammo,sizeof(slotammo),\"AmmoSlot%d\",weap);
dini_IntSet(file,slotammo,PlayerAmmo[weap][playerid]);
}
SPAWN:
for(new weap=0;weap<13;weap++)
{
new file[256];
GetPlayerName(playerid,nev,sizeof(nev));
format(file,sizeof(file),\"/Adatbazis/Karakterek/%s.ini\",nev);
new slotname[20];
format(slotname,sizeof(slotname),\"Slot%d\",weap);
new slotammo[20];
format(slotammo,sizeof(slotammo),\"AmmoSlot%d\",weap);
PlayerWeapons[weap][playerid] = strval(dini_Get(file, slotname));
PlayerAmmo[weap][playerid] = strval(dini_Get(file, slotammo));
GivePlayerWeapon(playerid, PlayerWeapons[weap][playerid], PlayerAmmo[weap][playerid]);
}
Halál:
for(new i=0;i<13;i++)
{
new file[256];
GetPlayerName(playerid,nev,sizeof(nev));
GetPlayerWeaponData(playerid,i,PlayerWeapons[playerid],PlayerAmmo[playerid]);
format(file,sizeof(file),\"/Adatbazis/Karakterek/%s.ini\",nev);
new slotname[20];
format(slotname,sizeof(slotname),\"Slot%d\",i);
dini_IntSet(file,slotname,PlayerWeapons[playerid]);
new slotammo[20];
format(slotammo,sizeof(slotammo),\"AmmoSlot%d\",i);
dini_IntSet(file,slotammo,PlayerAmmo[playerid]);
}