Maybe somebody can help me (Weapon System not loading)
#1

So I have some problem.. I don't know why my weapons are not saved in file.. File Creates everything is working but still they aren't loading... All weapons and ammo = 0..
And I have one warning...
Код:
warning 219: local variable "file" shadows a variable at a preceding level
PHP код:
    //Same as OnDialogResponse, we will save their stats inside of their user's account
    
if(fexist(Path(playerid)))//Will check if the file is exit or not inside of User's folder that we have created.
    
{
        new 
INI:file INI_Open(Path(playerid)); //will open their their file
        
INI_SetTag(file,"Player's Data");//We will set a tag inside of user's account called "Player's Data"
         
INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]); //If you've set his/her admin level, then his/her admin level will be saved inside of his/her account
        
INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
        
INI_WriteInt(file,"Money",GetPlayerMoney(playerid));//We will save his score inside of his account
        
INI_WriteInt(file,"Scores",GetPlayerScore(playerid));//As explained above
        
INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);//As explained above
        
INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);//As explained above
        
INI_WriteInt(file,"GangLeader",pInfo[playerid][GangLeader]);
        
INI_WriteInt(file,"GangMember",pInfo[playerid][GangMember]);
        
INI_WriteInt(file,"PlayingTime",pInfo[playerid][pPlayingTime]);
        
//Weapon
        
GetPlayerWeaponData(playerid1WeaponInfo[playerid][Weapon1], WeaponInfo[playerid][Ammo1]);
        
GetPlayerWeaponData(playerid2WeaponInfo[playerid][Weapon2], WeaponInfo[playerid][Ammo2]);
        
GetPlayerWeaponData(playerid3WeaponInfo[playerid][Weapon3], WeaponInfo[playerid][Ammo3]);
        
GetPlayerWeaponData(playerid4WeaponInfo[playerid][Weapon4], WeaponInfo[playerid][Ammo4]);
        
GetPlayerWeaponData(playerid5WeaponInfo[playerid][Weapon5], WeaponInfo[playerid][Ammo5]);
        
GetPlayerWeaponData(playerid6WeaponInfo[playerid][Weapon6], WeaponInfo[playerid][Ammo6]);
        
GetPlayerWeaponData(playerid7WeaponInfo[playerid][Weapon7], WeaponInfo[playerid][Ammo7]);
        
GetPlayerWeaponData(playerid8WeaponInfo[playerid][Weapon8], WeaponInfo[playerid][Ammo8]);
        
GetPlayerWeaponData(playerid9WeaponInfo[playerid][Weapon9], WeaponInfo[playerid][Ammo9]);
        
GetPlayerWeaponData(playerid10WeaponInfo[playerid][Weapon10], WeaponInfo[playerid][Ammo10]);
        
GetPlayerWeaponData(playerid11WeaponInfo[playerid][Weapon11], WeaponInfo[playerid][Ammo11]);
        
GetPlayerWeaponData(playerid12WeaponInfo[playerid][Weapon12], WeaponInfo[playerid][Ammo12]);
        if(
fexist(pWeaponSave(playerid)))
        {
            new 
INI:file INI_Open(pWeaponSave(playerid));//HERE IS THE WARNING
            //    Weapon Save
            
INI_WriteInt(file"Weapon1"WeaponInfo[playerid][Weapon1]);
            
INI_WriteInt(file"Weapon2"WeaponInfo[playerid][Weapon2]);
            
INI_WriteInt(file"Weapon3"WeaponInfo[playerid][Weapon3]);
            
INI_WriteInt(file"Weapon4"WeaponInfo[playerid][Weapon4]);
            
INI_WriteInt(file"Weapon5"WeaponInfo[playerid][Weapon5]);
            
INI_WriteInt(file"Weapon6"WeaponInfo[playerid][Weapon6]);
            
INI_WriteInt(file"Weapon7"WeaponInfo[playerid][Weapon7]);
            
INI_WriteInt(file"Weapon8"WeaponInfo[playerid][Weapon8]);
            
INI_WriteInt(file"Weapon9"WeaponInfo[playerid][Weapon9]);
            
INI_WriteInt(file"Weapon10"WeaponInfo[playerid][Weapon10]);
            
INI_WriteInt(file"Weapon11"WeaponInfo[playerid][Weapon11]);
            
INI_WriteInt(file"Weapon12"WeaponInfo[playerid][Weapon12]);
            
//    Ammo Save
            
INI_WriteInt(file"Ammo1"WeaponInfo[playerid][Ammo1]);
            
INI_WriteInt(file"Ammo2"WeaponInfo[playerid][Ammo2]);
            
INI_WriteInt(file"Ammo3"WeaponInfo[playerid][Ammo3]);
            
INI_WriteInt(file"Ammo4"WeaponInfo[playerid][Ammo4]);
            
INI_WriteInt(file"Ammo5"WeaponInfo[playerid][Ammo5]);
            
INI_WriteInt(file"Ammo6"WeaponInfo[playerid][Ammo6]);
            
INI_WriteInt(file"Ammo7"WeaponInfo[playerid][Ammo7]);
            
INI_WriteInt(file"Ammo8"WeaponInfo[playerid][Ammo8]);
            
INI_WriteInt(file"Ammo9"WeaponInfo[playerid][Ammo9]);
            
INI_WriteInt(file"Ammo10"WeaponInfo[playerid][Ammo10]);
            
INI_WriteInt(file"Ammo11"WeaponInfo[playerid][Ammo11]);
            
INI_WriteInt(file"Ammo12"WeaponInfo[playerid][Ammo12]);
        }
        
INI_Close(file);//Now after we've done saving their data, we now need to close the file
        
new pname[MAX_PLAYER_NAME], string[39 MAX_PLAYER_NAME];
        
GetPlayerName(playeridpnamesizeof(pname));
        switch(
reason)
        {
            case 
0format(stringsizeof(string), "%s has left the server. (Lost Connection)"pname);
            case 
1format(stringsizeof(string), "%s has left the server. (Leaving)"pname);
            case 
2format(stringsizeof(string), "%s has left the server. (Kicked)"pname);
        }
        
SendClientMessageToAll(0xAAAAAAAAstring);
        return 
1;
    } 
Reply
#2

Код:
warning 219: local variable "file" shadows a variable at a preceding level
The variable "file" is being used in the script "anywhere" there already..
so you will have to change it..
Код:
new INI:file
to for example:
Код:
new INI:Hfile
and make the following changes to the rest..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)