09.03.2012, 04:10
You have to use GetPlayerWeaponData for each weapon and assign it to the vars used for your saving system. This is how I implement saving of guns in my game mode.
EDIT: Nevermind took me awhile to see that you already did.
pawn Код:
new ammo;
public SaveAccount(playerid) // Saving
{
GetPlayerWeaponData(playerid,1,pInfo[playerid][pGun1],ammo);
GetPlayerWeaponData(playerid,2,pInfo[playerid][pGun2],ammo);
GetPlayerWeaponData(playerid,3,pInfo[playerid][pGun3],ammo);
GetPlayerWeaponData(playerid,4,pInfo[playerid][pGun4],ammo);
GetPlayerWeaponData(playerid,5,pInfo[playerid][pGun5],ammo);
GetPlayerWeaponData(playerid,6,pInfo[playerid][pGun6],ammo);
GetPlayerWeaponData(playerid,7,pInfo[playerid][pGun7],ammo);
GetPlayerWeaponData(playerid,8,pInfo[playerid][pGun8],ammo);
GetPlayerWeaponData(playerid,9,pInfo[playerid][pGun9],ammo);
GetPlayerWeaponData(playerid,10,pInfo[playerid][pGun10],ammo);
GetPlayerWeaponData(playerid,11,pInfo[playerid][pGun11],ammo);
GetPlayerWeaponData(playerid,12,pInfo[playerid][pGun12],ammo);
new
Float:x = pInfo[playerid][pPosX],
Float:y = pInfo[playerid][pPosY],
Float:z = pInfo[playerid][pPosZ],
Float:a = pInfo[playerid][pAngle],
Float:h = pInfo[playerid][pHealth],
Float:ar = pInfo[playerid][pArmour];
GetPlayerPos(playerid,x,y,z);
pInfo[playerid][pAngle] = GetPlayerFacingAngle(playerid,a);
pInfo[playerid][pSkin] = GetPlayerSkin(playerid);
pInfo[playerid][pHealth] = GetPlayerHealth(playerid,h);
pInfo[playerid][pArmour] = GetPlayerArmour(playerid,ar);
pInfo[playerid][pInterior] = GetPlayerInterior(playerid);
pInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Bank",pInfo[playerid][pBank]);
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Faction",pInfo[playerid][pFaction]);
INI_WriteInt(File,"OnDuty",pInfo[playerid][pDuty]);
INI_WriteInt(File,"Rank",pInfo[playerid][pRank]);
INI_WriteInt(File,"Leader",pInfo[playerid][pLeader]);
INI_WriteInt(File,"Job",pInfo[playerid][pJob]);
INI_WriteInt(File,"Mats",pInfo[playerid][pMats]);
INI_WriteInt(File,"Crack",pInfo[playerid][pCrack]);
INI_WriteInt(File,"HasInvite",pInfo[playerid][pHasInvite]);
INI_WriteInt(File,"CanKill",pInfo[playerid][pCanKill]);
INI_WriteInt(File,"Skin",pInfo[playerid][pSkin]);
INI_WriteFloat(File,"LastX",x);
INI_WriteFloat(File,"LastY",y);
INI_WriteFloat(File,"LastZ",z);
INI_WriteFloat(File,"Angle",a);
INI_WriteFloat(File,"Health",h);
INI_WriteFloat(File,"Armour",ar);
INI_WriteInt(File,"AdminLevel",pInfo[playerid][pAdmin]);
INI_WriteInt(File,"Accent",pInfo[playerid][pAccent]);
INI_WriteInt(File,"Jailed",pInfo[playerid][pJailed]);
INI_WriteInt(File,"JailTime",pInfo[playerid][pJailTime]);
INI_WriteInt(File,"Gun1",pInfo[playerid][pGun1]);
INI_WriteInt(File,"Gun2",pInfo[playerid][pGun2]);
INI_WriteInt(File,"Gun3",pInfo[playerid][pGun3]);
INI_WriteInt(File,"Gun4",pInfo[playerid][pGun4]);
INI_WriteInt(File,"Gun5",pInfo[playerid][pGun5]);
INI_WriteInt(File,"Gun6",pInfo[playerid][pGun6]);
INI_WriteInt(File,"Gun7",pInfo[playerid][pGun7]);
INI_WriteInt(File,"Gun8",pInfo[playerid][pGun8]);
INI_WriteInt(File,"Gun9",pInfo[playerid][pGun9]);
INI_WriteInt(File,"Gun10",pInfo[playerid][pGun10]);
INI_WriteInt(File,"Gun11",pInfo[playerid][pGun11]);
INI_WriteInt(File,"Gun12",pInfo[playerid][pGun12]);
INI_WriteInt(File,"Interior",pInfo[playerid][pInterior]);
INI_WriteInt(File,"VirtualWorld",pInfo[playerid][pVW]);
INI_WriteInt(File,"Cuffed",pInfo[playerid][pCuffed]);
INI_Close(File);
return 1;
}
stock LoadUserWeapons(playerid,name[],value[]) // Loading
{
INI_Int("Gun1",pInfo[playerid][pGun1]);
INI_Int("Gun2",pInfo[playerid][pGun2]);
INI_Int("Gun3",pInfo[playerid][pGun3]);
INI_Int("Gun4",pInfo[playerid][pGun4]);
INI_Int("Gun5",pInfo[playerid][pGun5]);
INI_Int("Gun6",pInfo[playerid][pGun6]);
INI_Int("Gun7",pInfo[playerid][pGun7]);
INI_Int("Gun8",pInfo[playerid][pGun8]);
INI_Int("Gun9",pInfo[playerid][pGun9]);
INI_Int("Gun10",pInfo[playerid][pGun10]);
INI_Int("Gun11",pInfo[playerid][pGun11]);
INI_Int("Gun12",pInfo[playerid][pGun12]);
return 1;
}
public OnPlayerSpawn(playerid) // Gives them the guns on spawn
{
if(pInfo[playerid][pPosX] == 0)
{
SetPlayerPos(playerid,2102.6221,-104.2249,2.2702);
SetPlayerSkin(playerid,299);
SetPlayerHealth(playerid,100);
SetCameraBehindPlayer(playerid);
SetPlayerFacingAngle(playerid,304.6372);
GivePlayerMoney(playerid,10000);
pInfo[playerid][pBank] = 20000;
TogglePlayerControllable(playerid,1);
}
else
{
SetPlayerPos(playerid,pInfo[playerid][pPosX],pInfo[playerid][pPosY],pInfo[playerid][pPosZ]);
SetPlayerSkin(playerid,pInfo[playerid][pSkin]);
SetPlayerFacingAngle(playerid,pInfo[playerid][pAngle]);
SetPlayerHealth(playerid,pInfo[playerid][pHealth]);
SetPlayerArmour(playerid,pInfo[playerid][pArmour]);
SetPlayerVirtualWorld(playerid,pInfo[playerid][pVW]);
SetPlayerInterior(playerid,pInfo[playerid][pInterior]);
GivePlayerMoney(playerid,pInfo[playerid][pCash]);
SetCameraBehindPlayer(playerid);
GivePlayerWeapon(playerid,pInfo[playerid][pGun1],999999);
GivePlayerWeapon(playerid,pInfo[playerid][pGun2],999999);
GivePlayerWeapon(playerid,pInfo[playerid][pGun3],999999);
GivePlayerWeapon(playerid,pInfo[playerid][pGun4],999999);
GivePlayerWeapon(playerid,pInfo[playerid][pGun5],999999);
GivePlayerWeapon(playerid,pInfo[playerid][pGun6],999999);
GivePlayerWeapon(playerid,pInfo[playerid][pGun7],999999);
GivePlayerWeapon(playerid,pInfo[playerid][pGun8],999999);
GivePlayerWeapon(playerid,pInfo[playerid][pGun9],999999);
GivePlayerWeapon(playerid,pInfo[playerid][pGun10],999999);
GivePlayerWeapon(playerid,pInfo[playerid][pGun11],999999);
GivePlayerWeapon(playerid,pInfo[playerid][pGun12],999999);
TogglePlayerControllable(playerid,1);
}