Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Problem with data being saved

$
0
0
I remade my weapon save sys and this is the problem.

Here's what you need to know:

Weapon1 - Melee
Weapon2 - Pistols
Weapon3 - Automatics

When relogging, it doesn't spawn Weapon2. If you have Weapon3, the ammo duplicates. Here's how weapon is saved. I have it under a timer for 1000ms.
PHP Code:

public WeaponSave()
{
    for(new 
0MAX_PLAYERSi++)
    {
        new 
string[128], Name[MAX_PLAYER_NAME];
        
GetPlayerName(iNamesizeof(Name));
        
format(stringsizeof(string), "Accounts/%s.ini"Name);

        
GetPlayerWeaponData(i1WeaponInfo[i][Weapon1], WeaponInfo[i][Weapon1a]);
          
GetPlayerWeaponData(i2WeaponInfo[i][Weapon2], WeaponInfo[i][Weapon2a]);

        if(
WeaponInfo[i][Weapon3a] > 0)
        {
             switch(
WeaponInfo[i][Weapon3a])
              {
                  case 
25:
                  {
                    
GetPlayerWeaponData(i3WeaponInfo[i][Weapon3], WeaponInfo[i][Weapon3a]);
                  }
                   case 
282932:
                   {
                      
GetPlayerWeaponData(i4WeaponInfo[i][Weapon3], WeaponInfo[i][Weapon3a]);
                   }
                   case 
3031:
                {
                    
GetPlayerWeaponData(i5WeaponInfo[i][Weapon3], WeaponInfo[i][Weapon3a]);
                }
                case 
3334:
                {
                    
GetPlayerWeaponData(i6WeaponInfo[i][Weapon3], WeaponInfo[i][Weapon3a]);
                 }
              }
        }

         
dini_IntSet(string"Weapon1",WeaponInfo[i][Weapon1]);
          
dini_IntSet(string"Weapon1a",WeaponInfo[i][Weapon1a]);
           
dini_IntSet(string"Weapon2",WeaponInfo[i][Weapon2]);
        
dini_IntSet(string"Weapon2a",WeaponInfo[i][Weapon2a]);
        
dini_IntSet(string"Weapon3",WeaponInfo[i][Weapon3]);
        
dini_IntSet(string"Weapon3a",WeaponInfo[i][Weapon3a]);
    }
    return 
1;


I have GivePlayerRealWeapon on spawn.
PHP Code:

public GivePlayerRealWeapons(playerid)
{
    new 
string[128], Name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridNamesizeof(Name));
    
format(stringsizeof(string), "Accounts/%s.ini"Name);
    
WeaponInfo[playerid][Weapon1] = dini_Int(string"Weapon1");
    
WeaponInfo[playerid][Weapon1a] = dini_Int(string"Weapon1a");
    
WeaponInfo[playerid][Weapon2] = dini_Int(string"Weapon2");
    
WeaponInfo[playerid][Weapon2a] = dini_Int(string"Weapon2a");
     
WeaponInfo[playerid][Weapon3] = dini_Int(string"Weapon3");
      
WeaponInfo[playerid][Weapon3a] = dini_Int(string"Weapon3a");
    
GivePlayerWeapon(playeridWeaponInfo[playerid][Weapon1], WeaponInfo[playerid][Weapon1a]);
     
GivePlayerWeapon(playeridWeaponInfo[playerid][Weapon2], WeaponInfo[playerid][Weapon2a]);
      
GivePlayerWeapon(playeridWeaponInfo[playerid][Weapon3], WeaponInfo[playerid][Weapon3a]);
    return 
1;



Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>