29.01.2013, 12:08
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...
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(playerid, 1, WeaponInfo[playerid][Weapon1], WeaponInfo[playerid][Ammo1]);
GetPlayerWeaponData(playerid, 2, WeaponInfo[playerid][Weapon2], WeaponInfo[playerid][Ammo2]);
GetPlayerWeaponData(playerid, 3, WeaponInfo[playerid][Weapon3], WeaponInfo[playerid][Ammo3]);
GetPlayerWeaponData(playerid, 4, WeaponInfo[playerid][Weapon4], WeaponInfo[playerid][Ammo4]);
GetPlayerWeaponData(playerid, 5, WeaponInfo[playerid][Weapon5], WeaponInfo[playerid][Ammo5]);
GetPlayerWeaponData(playerid, 6, WeaponInfo[playerid][Weapon6], WeaponInfo[playerid][Ammo6]);
GetPlayerWeaponData(playerid, 7, WeaponInfo[playerid][Weapon7], WeaponInfo[playerid][Ammo7]);
GetPlayerWeaponData(playerid, 8, WeaponInfo[playerid][Weapon8], WeaponInfo[playerid][Ammo8]);
GetPlayerWeaponData(playerid, 9, WeaponInfo[playerid][Weapon9], WeaponInfo[playerid][Ammo9]);
GetPlayerWeaponData(playerid, 10, WeaponInfo[playerid][Weapon10], WeaponInfo[playerid][Ammo10]);
GetPlayerWeaponData(playerid, 11, WeaponInfo[playerid][Weapon11], WeaponInfo[playerid][Ammo11]);
GetPlayerWeaponData(playerid, 12, WeaponInfo[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(playerid, pname, sizeof(pname));
switch(reason)
{
case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", pname);
case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pname);
case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", pname);
}
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
}