Saving the players ammo.
#1

Hey guys.

I'm scripting an RP script, yet I have some issues making my gun-saving script work.

I want it to save the ammo of your weapons when you logout and enter police vehicle(I'm fucking sick of the 5 shotgun rounds) so I can reset weapons and give them back when he exits it, or when the player logs back in.

However, how can I do this with GetPlayerWeaponData?

I've seen loops and shit, but can I use that to give the weapons back with the same ammo?

My scripts works following way: (This means you can have one melee weapon(obvious), one smaller/secondary weapon(all pistols) one heavy/primary weapon(Mac10, Tec9, Mp5, shotguns, AK, M4, RPG's, Snipers, Flamethrower, all that) and a Misc weapon(spraycan, camera, grenades)

OnPlayerSpawn:
pawn Код:
GivePlayerWeapon(playerid, PlayerInfo[playerid][WepMelee], 0);
GivePlayerWeapon(playerid, PlayerInfo[playerid][WepSec], PlayerInfo[playerid][AmmoSec]);
GivePlayerWeapon(playerid, PlayerInfo[playerid][WepPrim], PlayerInfo[playerid][AmmoPrim]);
GivePlayerWeapon(playerid, PlayerInfo[playerid][WepMisc], PlayerInfo[playerid][AmmoMisc]);
When login:
pawn Код:
PlayerInfo[playerid][WepMelee] = dini_Int(file, "WepMelee");
                PlayerInfo[playerid][WepSec] = dini_Int(file, "WepSec");
                PlayerInfo[playerid][WepPrim] = dini_Int(file, "WepPrim");
                PlayerInfo[playerid][WepMisc] = dini_Int(file, "WepMisc");
                PlayerInfo[playerid][AmmoSec] = dini_Int(file, "AmmoSec");
                PlayerInfo[playerid][AmmoPrim] = dini_Int(file, "AmmoPrim");
                PlayerInfo[playerid][AmmoMisc] = dini_Int(file, "AmmoMisc");
Help is appreciated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)