Pickups doesn't save
#1

what's wrong with that code ? ? i see this correctly but it doesn't work

after creating a dutymenu it doesnt save after restart server



PHP код:
SaveDutyMenus()
{
    for(new 
1MAX_DUTYMENUSi++)
    {
        if(
DutyMenuIDTaken[i] == 0) continue;
        new 
file[100];
        new var[
32];
        
format(filesizeof(file), "DutyMenus/%d.ini"i);
        if(
INI_Open(file))
        {
            
INI_WriteString("DutyMenuCommand"DutyMenuStatistics[i][DutyMenuCommand]);
            
INI_WriteFloat("DutyMenuX"DutyMenuStatistics[i][DutyMenuX]);
            
INI_WriteFloat("DutyMenuY"DutyMenuStatistics[i][DutyMenuY]);
            
INI_WriteFloat("DutyMenuZ"DutyMenuStatistics[i][DutyMenuZ]);
            
INI_WriteInt("DutyMenuFaction"DutyMenuStatistics[i][DutyMenuFaction]);
            for(new 
047g++)
            {
                
format(var, sizeof(var), "DutyMenuGun%d"g);
                
INI_WriteInt(var, DutyMenuStatistics[i][DutyMenuGuns][g]);
                
format(var, sizeof(var), "DutyMenuGunRank%d"g);
                
INI_WriteInt(var, DutyMenuStatistics[i][DutyMenuGunRank][g]);
             }
            
INI_WriteInt("DutyMenuMask"DutyMenuStatistics[i][DutyMenuMask]);
            
INI_WriteInt("DutyMenuMaskRank"DutyMenuStatistics[i][DutyMenuMaskRank]);
            
INI_WriteInt("DutyMenuVirtual"DutyMenuStatistics[i][DutyMenuVirtual]);
            
INI_Save();
            
INI_Close();
        }
    }
    return 
1;

PHP код:
//-----------------------------------------[Duty-Menu system]---------------------//
    
if(strcmp(cmd"/dutymenu"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] >= 1337)
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) return SyntaxMessage(playerid"/dutymenu [faction] [command name (example: /dutymenu 1 lspd)]");
            new 
factionid strval(tmp);
            if(
factionid || factionid MAX_FACTIONS 1) return SendClientMessage(playeridGREY"Faction ID must be above 1, and below 10.");
            if(
DutyMenuIDTaken[factionid]) return SendClientMessage(playeridGREY"This faction already has a duty menu.");
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) return SyntaxMessage(playerid"/dutymenu [faction] [command name (example: /dutymenu 1 lspd)]");
            new 
Float:xFloat:yFloat:z;
            
GetPlayerPos(playeridxyz);
            
DutyMenuStatistics[factionid][DutyMenuPickup] = CreateDynamicPickup(123923xyzGetPlayerVirtualWorld(playerid));
            
DutyMenuStatistics[factionid][DutyMenuX] = x;
            
DutyMenuStatistics[factionid][DutyMenuY] = y;
            
DutyMenuStatistics[factionid][DutyMenuZ] = z;
            
DutyMenuStatistics[factionid][DutyMenuFaction] = factionid;
            
DutyMenuStatistics[factionid][DutyMenuVirtual] = GetPlayerVirtualWorld(playerid);
            
strmid(DutyMenuStatistics[factionid][DutyMenuCommand], tmp0strlen(tmp), 255);
            for(new 
047i++)
            {
                
DutyMenuStatistics[factionid][DutyMenuGuns][i] = 0;
            }
            
DutyMenuIDTaken[factionid] = 1;
            
format(stringsizeof(string), "Duty Menu created for faction ID %d, use /addgun %d or /deletedutymenu %d."factionidfactionidfactionid);
            
SendClientMessage(playeridLIGHTBLUEstring);
        }
        return 
1;
    }
    if(
strcmp(cmd"/addmask"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] >= 1337)
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) return SyntaxMessage(playerid"/addmask [duty menu ID] [mask rank]");
            new 
factionid strval(tmp);
            if(
factionid || factionid MAX_FACTIONS 1) return SendClientMessage(playeridGREY"Faction ID must be above 1, and below 10.");
            if(!
DutyMenuIDTaken[factionid]) return SendClientMessage(playeridGREY"This faction doesn't have a duty menu.");
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) return SyntaxMessage(playerid"/addmask [duty menu ID] [mask rank]");
            new 
rank strval(tmp);
            if(
rank || rank MAX_RANKS 1) return SendClientMessage(playeridGREY"Invalid rank ID.");
            if (
DutyMenuStatistics[factionid][DutyMenuMask] == 0)
            {
                
DutyMenuStatistics[factionid][DutyMenuMask] = 1;
                
DutyMenuStatistics[factionid][DutyMenuMaskRank] = rank;
                
format(stringsizeof(string), "Mask added to faction %d's duty menu, available for rank %d+."factionidrank);
                
SendClientMessage(playeridLIGHTBLUEstring);
                return 
1;
            }
            else return 
SendClientMessage(playeridGREY"Use /removemask.");
        }
        return 
1;
    }
    if(
strcmp(cmd"/removemask"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] >= 1337)
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) return SyntaxMessage(playerid"/removemask [duty menu ID]");
            new 
factionid strval(tmp);
            if(
factionid || factionid MAX_FACTIONS 1) return SendClientMessage(playeridGREY"Faction ID must be above 1, and below 10.");
            if(!
DutyMenuIDTaken[factionid]) return SendClientMessage(playeridGREY"This faction doesn't have a duty menu.");
            if(
DutyMenuStatistics[factionid][DutyMenuMask] == 1)
            {
                
DutyMenuStatistics[factionid][DutyMenuMask] = 0;
                
DutyMenuStatistics[factionid][DutyMenuMaskRank] = 0;
                
format(stringsizeof(string), "Mask removed from faction %d's duty menu."factionid);
                
SendClientMessage(playeridLIGHTBLUEstring);
                return 
1;
            }
            else return 
SendClientMessage(playeridGREY"This faction doesn't have a mask.");
        }
        return 
1;
    }
    if(
strcmp(cmd"/addgun"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] >= 1337)
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) return SyntaxMessage(playerid"/addgun [duty menu ID] [weapon ID] [rank]");
            new 
factionid strval(tmp);
            if(
factionid || factionid MAX_FACTIONS 1) return SendClientMessage(playeridGREY"Faction ID must be above 1, and below 10.");
            if(!
DutyMenuIDTaken[factionid]) return SendClientMessage(playeridGREY"This faction doesn't have a duty menu.");
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) return SyntaxMessage(playerid"/addgun [duty menu ID] [weapon ID] [rank]");
            new 
weaponid strval(tmp);
            if(
weaponid || weaponid == 19 || weaponid == 20 || weaponid == 21 || weaponid 46) return SendClientMessage(playeridGREY"Invalid weapon ID.");
            
tmp strtok(cmdtextidx);
            if (!
strlen(tmp)) return SyntaxMessage(playerid"/addgun [duty menu ID] [weapon ID] [rank]");
            new 
rank strval(tmp);
            if (
rank || rank MAX_RANKS 1) return SendClientMessage(playeridGREY"Invalid rank.");
            for(new 
047i++)
            {
                if(
DutyMenuStatistics[factionid][DutyMenuGuns][i] == 0)
                {
                    
DutyMenuStatistics[factionid][DutyMenuGuns][i] = weaponid;
                    
DutyMenuStatistics[factionid][DutyMenuGunRank][i] = rank;
                    break;
                }
            }
            
format(stringsizeof(string), "Weapon %d added to faction %d's duty menu successfully."weaponidfactionid);
            
SendClientMessage(playeridLIGHTBLUEstring);
        }
        return 
1;
    }
    if(
strcmp(cmd"/deletedutymenu"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] >= 1337)
        {
            new 
file[100];
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) return SyntaxMessage(playerid"/deletedutymenu [factionid]");
            new 
factionid strval(tmp);
            if(
factionid || factionid MAX_FACTIONS 1) return SendClientMessage(playeridGREY"Faction ID must be above 1, and below 10.");
            if(!
DutyMenuIDTaken[factionid]) return SendClientMessage(playeridGREY"This faction doesn't have a duty menu.");
            
DutyMenuIDTaken[factionid] = 0;
            
DestroyDynamicPickup(DutyMenuStatistics[factionid][DutyMenuPickup]);
            
DutyMenuStatistics[factionid][DutyMenuX] = 0;
            
DutyMenuStatistics[factionid][DutyMenuY] = 0;
            
DutyMenuStatistics[factionid][DutyMenuZ] = 0;
            
DutyMenuStatistics[factionid][DutyMenuFaction] = 0;
            for(new 
047i++)
            {
                
DutyMenuStatistics[factionid][DutyMenuGuns][i] = 0;
                
DutyMenuStatistics[factionid][DutyMenuGunRank][i] = 0;
            }
            
DutyMenuStatistics[factionid][DutyMenuMask] = 0;
            
DutyMenuStatistics[factionid][DutyMenuVirtual] = 0;
            
DutyMenuStatistics[factionid][DutyMenuMaskRank] = 0;
            
strmid(DutyMenuStatistics[factionid][DutyMenuCommand], "none"0strlen("none"), 255);
            
format(stringsizeof(string), "Faction %d's duty menu was deleted."factionid);
            
SendClientMessage(playeridLIGHTBLUEstring);
            
format(filesizeof(file), "DutyMenus/%d.ini"factionid);
            if(
fexist(file)) fremove(file);
        }
        return 
1;
    }
    if(
strcmp(cmd"/dutymenuloc"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] >= 1337)
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) return SyntaxMessage(playerid"/dutymenuloc [factionid]");
            new 
factionid strval(tmp);
            if(
factionid || factionid MAX_FACTIONS 1) return SendClientMessage(playeridGREY"Faction ID must be above 1, and below 10.");
            if(!
DutyMenuIDTaken[factionid]) return SendClientMessage(playeridGREY"This faction doesn't have a duty menu.");
            new 
Float:xFloat:yFloat:z;
            
GetPlayerPos(playeridxyz);
            
DutyMenuStatistics[factionid][DutyMenuX] = x;
            
DutyMenuStatistics[factionid][DutyMenuY] = y;
            
DutyMenuStatistics[factionid][DutyMenuZ] = z;
            
DutyMenuStatistics[factionid][DutyMenuVirtual] = GetPlayerVirtualWorld(playerid);
            
DestroyDynamicPickup(DutyMenuStatistics[factionid][DutyMenuPickup]);
            
DutyMenuStatistics[factionid][DutyMenuPickup] = CreateDynamicPickup(123923xyzGetPlayerVirtualWorld(playerid));
            return 
1;
        }
        return 
1;
    }
    if(
strcmp(cmd"/removegun"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] >= 1337)
        {
            new 
guns;
            new 
GunID[47];
            new 
RankID[47];
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) return SyntaxMessage(playerid"/removegun [duty menu ID] [gun ID]");
            new 
factionid strval(tmp);
            if(
factionid || factionid MAX_FACTIONS 1) return SendClientMessage(playeridGREY"Faction ID must be above 1, and below 10.");
            if(!
DutyMenuIDTaken[factionid]) return SendClientMessage(playeridGREY"This faction doesn't have a duty menu.");
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp)) return SyntaxMessage(playerid"/removegun [duty menu ID] [gun ID]");
            new 
weaponid strval(tmp);
            if(
weaponid || weaponid 46) return 1;
            
weaponid -= 1;
            
DutyMenuStatistics[factionid][DutyMenuGuns][weaponid] = 0;
            
DutyMenuStatistics[factionid][DutyMenuGunRank][weaponid] = 0;
            
format(stringsizeof(string), "Weapon %d removed from faction %d's duty menu successfully."weaponid+1factionid);
            
SendClientMessage(playeridLIGHTBLUEstring);
            for(new 
0<= 46i++)
            {
                if(
DutyMenuStatistics[factionid][DutyMenuGuns][i])
                {
                    
GunID[guns] = DutyMenuStatistics[factionid][DutyMenuGuns][i];
                    
RankID[guns] = DutyMenuStatistics[factionid][DutyMenuGunRank][i];
                    
DutyMenuStatistics[factionid][DutyMenuGuns][i] = 0;
                    
DutyMenuStatistics[factionid][DutyMenuGunRank][i] = 0;
                    
guns++;
                }
            }
            for(new 
0<= 46i++)
            {
                if(
GunID[i])
                {
                    
DutyMenuStatistics[factionid][DutyMenuGuns][i] = GunID[i];
                }
                if(
RankID[i])
                {
                    
DutyMenuStatistics[factionid][DutyMenuGunRank][i] = RankID[i];
                }
            }
        }
        return 
1;
    } 
Reply


Messages In This Thread
Pickups doesn't save - by MCZOFT - 24.10.2014, 11:25
Re: Pickups doesn't save - by Rudy_ - 24.10.2014, 11:33
Re : Pickups doesn't save - by MCZOFT - 24.10.2014, 11:35
Re: Pickups doesn't save - by Rudy_ - 24.10.2014, 11:38
Re : Pickups doesn't save - by MCZOFT - 24.10.2014, 11:41
Re: Pickups doesn't save - by Rudy_ - 24.10.2014, 11:46
Re : Pickups doesn't save - by MCZOFT - 24.10.2014, 11:54

Forum Jump:


Users browsing this thread: 2 Guest(s)