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
#2

Is this SII?
and are you loading them when Game mode Starts?
Reply
#3

In this mode , i can create their duties ingame wich make the way esier but !!

it doesnt save after i'll restart my serveur
i mean if i've done dutymenu .. addgun ... etc evrything i do after restart doesnt save that's my problem ..

NOTE : ( I have already the files in scriptfiles : Dutymenu DutymenuGun Dutymenugunrank .. )
Reply
#4

Create a duty ingame, Check if it's created. If it is means it's saving them, And the problem is in Loading
Reply
#5

it creats in game the dutymenu and it works but it doesnt save after restart i ccant find it and i need to re-create it

you understand me brother ?
Reply
#6

You are saving it, YOU NEED to LOAD IT, when you Re-Start the server.
Reply
#7

PHP код:
LoadDutyMenus()
{
    for(new 
1MAX_DUTYMENUSi++)
    {
        new 
command[17];
        new 
file[100];
        new var[
32];
        
format(filesizeof(file), "DutyMenus/%d.ini"i);
        if(
fexist(file) && INI_Open(file))
        {
            
INI_ReadString(command"DutyMenuCommand");
            
DutyMenuStatistics[i][DutyMenuX] = INI_ReadFloat("DutyMenuX");
            
DutyMenuStatistics[i][DutyMenuY] = INI_ReadFloat("DutyMenuY");
            
DutyMenuStatistics[i][DutyMenuZ] = INI_ReadFloat("DutyMenuZ");
            
DutyMenuStatistics[i][DutyMenuFaction] = INI_ReadInt("DutyMenuFaction");
            for(new 
047g++)
            {
                
format(var, sizeof(var), "DutyMenuGun%d"g);
                
DutyMenuStatistics[i][DutyMenuGuns][g] = INI_ReadInt(var);
                
format(var, sizeof(var), "DutyMenuGunRank%d"g);
                
DutyMenuStatistics[i][DutyMenuGunRank][g] = INI_ReadInt(var);
            }
            
DutyMenuStatistics[i][DutyMenuMask] = INI_ReadInt("DutyMenuMask");
            
DutyMenuStatistics[i][DutyMenuMaskRank] = INI_ReadInt("DutyMenuMaskRank");
            
DutyMenuStatistics[i][DutyMenuVirtual] = INI_ReadInt("DutyMenuVirtual");
            
DutyMenuStatistics[i][DutyMenuPickup] = CreateDynamicPickup(123923DutyMenuStatistics[i][DutyMenuX], DutyMenuStatistics[i][DutyMenuY], DutyMenuStatistics[i][DutyMenuZ], DutyMenuStatistics[i][DutyMenuVirtual]);
            
strmid(DutyMenuStatistics[i][DutyMenuCommand], command0strlen(command), 255);
            
DutyMenuIDTaken[i] = 1;
            
INI_Close();
        }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)