09.04.2014, 09:18
(
Последний раз редактировалось AndySedeyn; 09.04.2014 в 10:00.
)
Hello folks,
I made a quite advanced /inventory (for weapons) and made two commands:
/putgun - To put a gun inside the "bag" / inventory.
/takegun - To take a gun from the "bag" / inventory.
The weapons in the inventory save excellent. But the guns that the player didn't put in the bag don't save.
What is the problem here?
Here is my pInfo enum:
The saving:
The loading:
The publics:
Solutions?
Thanks!
I made a quite advanced /inventory (for weapons) and made two commands:
/putgun - To put a gun inside the "bag" / inventory.
/takegun - To take a gun from the "bag" / inventory.
The weapons in the inventory save excellent. But the guns that the player didn't put in the bag don't save.
What is the problem here?
Here is my pInfo enum:
pawn Код:
enum pInfo
{
pWeapons,
}
pawn Код:
INI_WriteInt(File,"Weapons", PlayerInfo[playerid][pWeapons]);
pawn Код:
INI_Int("Weapons", PlayerInfo[playerid][pWeapons]);
pawn Код:
public SafeGivePlayerWeapon(playerid, weaponid, ammo)
{
ScriptWeaponsUpdated[playerid] = 1;
GivePlayerWeapon(playerid, weaponid, ammo);
SetTimerEx("UpdateWeapons",2500,false,"i",playerid);
return 1;
}
public UpdateWeapons(plyid)
{
new weaponid, ammo;
for(new i = 0; i < 13; i++)
{
GetPlayerWeaponData(plyid, i, weaponid, ammo);
ScriptWeapons[plyid][i] = weaponid;
}
ScriptWeaponsUpdated[plyid] = 0;
return 1;
}
public RemovePlayerWeapon(playerid, weaponid)
{
new plyWeapons[12] = 0;
new plyAmmo[12] = 0;
for(new slot = 0; slot != 12; slot++)
{
new wep, ammo;
GetPlayerWeaponData(playerid, slot, wep, ammo);
if(wep != weaponid && ammo != 0)
{
GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
}
}
SafeResetPlayerWeapons(playerid);
for(new slot = 0; slot != 12; slot++)
{
if(plyAmmo[slot] != 0)
{
SafeGivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot]);
}
}
return 1;
}
public SafeResetPlayerWeapons(playerid)
{
ScriptWeaponsUpdated[playerid] = 1;
ResetPlayerWeapons(playerid);
SetTimerEx("UpdateWeapons",2500,false,"i",playerid);
return 1;
}
Thanks!