14.07.2014, 04:28
hey hows it going i am having trouble getting my dynamic duty menus to save everytime i restart server they dissapear and they are not saving in my scriptfiles/dutymenus
And i have it in my scriptfiles in a folder under DutyMenus .... Do i need to add anything else do you see anything i have done wrong please helpp
Thanks
Код:
LoadDutyMenus() { for(new i = 1; i < MAX_DUTYMENUS; i++) { new command[17]; new file[100]; new var[32]; format(file, sizeof(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 g = 0; g < 47; g++) { 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(1239, 23, DutyMenuStatistics[i][DutyMenuX], DutyMenuStatistics[i][DutyMenuY], DutyMenuStatistics[i][DutyMenuZ], DutyMenuStatistics[i][DutyMenuVirtual]); strmid(DutyMenuStatistics[i][DutyMenuCommand], command, 0, strlen(command), 255); DutyMenuIDTaken[i] = 1; INI_Close(); } } return 1; } SaveDutyMenus() { for(new i = 1; i < MAX_DUTYMENUS; i++) { if(DutyMenuIDTaken[i] == 0) continue; new file[100]; new var[32]; format(file, sizeof(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 g = 0; g < 47; g++) { 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; }
Код:
if(strcmp(cmd, "/dutymenu", true) == 0) { if(PlayerInfo[playerid][pAdmin] >= 1337) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SyntaxMessage(playerid, "/dutymenu [faction] [command name (example: /dutymenu 1 lspd)]"); new factionid = strval(tmp); if(factionid < 1 || factionid > MAX_FACTIONS + 1) return SendClientMessage(playerid, GREY, "Faction ID must be above 1, and below 10."); if(DutyMenuIDTaken[factionid]) return SendClientMessage(playerid, GREY, "This faction already has a duty menu."); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SyntaxMessage(playerid, "/dutymenu [faction] [command name (example: /dutymenu 1 lspd)]"); new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); DutyMenuStatistics[factionid][DutyMenuPickup] = CreateDynamicPickup(1239, 23, x, y, z, GetPlayerVirtualWorld(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], tmp, 0, strlen(tmp), 255); for(new i = 0; i < 47; i++) { DutyMenuStatistics[factionid][DutyMenuGuns][i] = 0; } DutyMenuIDTaken[factionid] = 1; format(string, sizeof(string), "Duty Menu created for faction ID %d, use /addgun %d or /deletedutymenu %d.", factionid, factionid, factionid); SendClientMessage(playerid, LIGHTBLUE, string); } return 1; }
Thanks