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);
}
}
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);
}
|
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);
}
}
Код:
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);
}
|
udb_UserSetInt(ReturnAccount(playerid), strWep, wepinfo[i][0]);
stock ReturnAccount(playerid)
{
new PlayerName[30], str[30];
GetPlayerName(playerid, PlayerName, 30);
format(str, 30, "%s", PlayerName);
return PlayerName;
}