Spawn Weapon saving system
#5

Quote:
Originally Posted by ShizNator
Well its not much but this is something i had done a while back.
Still needs some fine tuning for myself but could help you out a lot.
You will need DracoBlue's DUDB for these commands to work.

What it does is cycle through all the weapon slots and writes the data to a variable.
Then saves it to username.dudb.sav

ReturnAccount(playerid) is just a simple function I made that returns your username.
I don't need to explain anymore.

To save the weapons

Does it save automaticly your weapons?
Код:
stock SaveWeapons(playerid)
{
  new wepinfo[13][2], strWep[10], strAmmo[50], strSend[128];
  for(new i = 0; i < 13; i++)
  {
    GetPlayerWeaponData(playerid, i, wepinfo[i][0], wepinfo[i][1]);
    format(strWep, 10, "Wep%d", i);
    format(strAmmo, 50, "Ammo%d", i);
    udb_UserSetInt(ReturnAccount(playerid), strWep, wepinfo[i][0]);
    udb_UserSetInt(ReturnAccount(playerid), strAmmo, wepinfo[i][1]);
    format(strSend, 128, ":%s: All weapons and ammo saved.", "SNX");
    SendClientMessage(playerid, COLOR_GOLD, strSend);
  }
}
And this loads the weapons in their right slot.

Код:
stock LoadWeapons(playerid)
{
  new strWep[10], strAmmo[50], strSend[128];
  for(new i = 0; i < 13; i++)
  {
    format(strWep, 10, "Wep%d",i);
    format(strAmmo, 50, "Ammo%d",i);
    GivePlayerWeapon(playerid, udb_UserInt(ReturnAccount(playerid), strWep), udb_UserInt(ReturnAccount(playerid), accounts, strAmmo));
  }
  format(strSend, 128, ":%s: All weapons and ammo restored.", "SNX");
  return SendClientMessage(playerid, COLOR_GOLD, strSend);
}
DOES it save the weapons automaticly>??
Reply


Messages In This Thread
Spawn Weapon saving system - by g@k - 21.01.2009, 16:59
Re: Spawn Weapon saving system - by Rks25 - 21.01.2009, 17:38
Re: Spawn Weapon saving system - by g@k - 21.01.2009, 21:42
Re: Spawn Weapon saving system - by ShizNator - 23.01.2009, 21:48
Re: Spawn Weapon saving system - by Derksen123 - 05.06.2009, 09:49
Re: Spawn Weapon saving system - by Derksen123 - 05.06.2009, 12:34
Re: Spawn Weapon saving system - by ShizNator - 05.06.2009, 21:11

Forum Jump:


Users browsing this thread: 1 Guest(s)