Castillo Posted June 12, 2011 Share Posted June 12, 2011 That's wrong, isObjectInACLGroup requires the account name but the player name, so would be: function iamAdmin(player) local account = getPlayerAccount(player) if not account then return end local accountName = getAccountName(account) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then outputChatBox("Yes.") else outputChatBox("No.") end end addCommandHandler("admin",iamAdmin) Link to comment
Jaysds1 Posted June 12, 2011 Author Share Posted June 12, 2011 I have a problem with my update Gui, every time when I press the leave button on the nick GUI the update GUI is suppose to appear but it doesn't appear. Here is my script Client-side function DONE() -- hide the gui, hide the cursor and return control to the player guiSetVisible(GUIEditor_Window[2], false) guiSetVisible(GUIEditor_Window[1], false) guiSetVisible(GUIEditor_Window[3], false) --guiSetVisible(back_Ground, false) showCursor(false) guiSetInputEnabled(false) triggerServerEvent ( "checker", getRootElement()) --HERE IS THE TRIGGER end addEvent("Done",true) addEventHandler("Done", getRootElement(), DONE) now Server-side addEvent ( "checker",true) addEventHandler ( "checker", getRootElement(), function(player) local account = getPlayerAccount(player) if not account then return end local accountName = getAccountName(account) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then triggerClientEvent ( "update",getRootElement()) end end) then back to Client-side local checking_updates = false addEvent ( "update",true) addEventHandler ( "update", getRootElement(getThisResource()), function() sx,sy = guiGetScreenSize() jupdateWindow = guiCreateWindow((sx/2)-109,(sy/2)-74,218,148,"J UPDATE",false) jupdateVersionLabel = guiCreateLabel(11,23,196,18,"J Login Version x.x.x",false,jupdateWindow) guiLabelSetHorizontalAlign(jupdateVersionLabel,"center",true) jUpdateButton = guiCreateButton(41,79,136,25,"Check for Updates",false,jupdateWindow) jUpdateLabel = guiCreateLabel(11,45,196,33,"Update Status: unknown",false,jupdateWindow) guiLabelSetHorizontalAlign(jUpdateLabel,"center",true) jUpdateCheckbox = guiCreateCheckBox(9,116,200,18,"Check for updates automaticly",false,false,jupdateWindow) addEventHandler("onClientGUIClick",jupdateWindow,function(button,state) if button == "left" and state == "up" then if source ~= jUpdateButton and source ~= jUpdateCheckbox then hideWindow() checking_updates = false elseif source == jUpdateButton then checking_updates = true triggerServerEvent("checkUpdateStatus",getLocalPlayer(),true) guiSetText(jUpdateLabel,"Checking...") end end guiWindowSetSizable(jupdateWindow,false) setElementData(jupdateWindow,"cant_edit",true) setElementData(jupdateVersionLabel,"cant_edit",true) setElementData(jUpdateButton,"cant_edit",true) setElementData(jUpdateLabel,"cant_edit",true) setElementData(jUpdateCheckbox,"cant_edit",true) setElementData(jupdateVersionLabel,"cant_highlight",true) setElementData(jUpdateLabel,"cant_highlight",true) setElementData(jUpdateCheckbox,"cant_highlight",true) guiSetVisible(jupdateWindow,false) end) end) function hideWindow() guiSetVisible(jupdateWindow,false) settings.jupdate_update_check.value = guiCheckBoxGetSelected(jUpdateCheckbox) saveSettingsFile() end addEvent("receiveUpdateCheck",true) addEventHandler("receiveUpdateCheck",getRootElement(),function(update,newVersion,oldVersion,manual) if checking_updates then if update then guiSetText(jUpdateLabel,"An update is available! (v. "..tostring(newVersion)..")") if manual == false then if not guieditor_version then guieditor_version = oldVersion end showWindow() end elseif update == false then guiSetText(jUpdateLabel,"No updates available") else guiSetText(jUpdateLabel,"Error: Check ACL permissions and MTA website availability.") end end end) function showWindow() guiSetText(jUpdateLabel,"GUI Editor Version "..tostring(guieditor_version)) guiCheckBoxSetSelected(jUpdateCheckbox,settings.guieditor_update_check.value) guiSetVisible(jupdateWindow,true) guiBringToFront(jupdateWindow) end again back to Server-side function checkForUpdates(manual) local player = client local called = callRemote("https://community.multitheftauto.com/mta/resources.php",function(n,v) updateResult(n,v,player,manual) end,"version",string.lower(getResourceName(getThisResource()))) if not called then -- outputChatBox("Error: Check ACL permissions and website availability.") triggerClientEvent(client,"receiveUpdateCheck",client,nil) end end addEvent("checkUpdateStatus",true) addEventHandler("checkUpdateStatus",root,checkForUpdates) function updateResult(name,version,player,manual) local update = false if string.lower(name):find("error") or version == 0 then update = nil end if update == false then local v1,v2,v3 = parseVersion(tostring(version)) local cv1,cv2,cv3 = parseVersion(tostring(getResourceInfo(getThisResource(),"version"))) if v1 and cv1 then if v1 > cv1 then update = true elseif v2 > cv2 then update = true elseif v3 > cv3 then update = true end end end triggerClientEvent(player,"receiveUpdateCheck",player,update,version,tostring(getResourceInfo(getThisResource(),"version")),manual) end function parseVersion(version) local parts = split(version,string.byte(".")) return parts[1],parts[2],parts[3] end Link to comment
JR10 Posted June 12, 2011 Share Posted June 12, 2011 addEvent ( "checker",true) addEventHandler ( "checker", getRootElement(), function() local account = getPlayerAccount(client) if not account then return end local accountName = getAccountName(account) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then triggerClientEvent (client, "update",getRootElement()) end end) 1- removed the player and replaced it with client and removed it from the function 2- getAccountName(account) uses account not a player you already got the player's account "account" so getAccountName(account) 3- your triggerClientEvent will trigger for all players you should specify for who should it trigger like if you are showing a GUI when u trigger it and dont specify who would it trigger for all players will see the gui so triggerClientEvent ( "update",getRootElement()) should be triggerClientEvent (client, "update",getRootElement()) Link to comment
Jaysds1 Posted June 12, 2011 Author Share Posted June 12, 2011 Why isn't my Gui checking for Updates? Client-side: local checking_updates = false addEvent ( "update",true) addEventHandler ( "update", getRootElement(getThisResource()), function() sx,sy = guiGetScreenSize() jupdateWindow = guiCreateWindow((sx/2)-109,(sy/2)-74,218,148,"J UPDATE",false) jupdateVersionLabel = guiCreateLabel(11,23,196,18,"J Login Version x.x.x",false,jupdateWindow) guiLabelSetHorizontalAlign(jupdateVersionLabel,"center",true) jUpdateButton = guiCreateButton(41,79,136,25,"Check for Updates",false,jupdateWindow) jUpdateLabel = guiCreateLabel(11,45,196,33,"Update Status: unknown",false,jupdateWindow) guiLabelSetHorizontalAlign(jUpdateLabel,"center",true) jUpdateCheckbox = guiCreateCheckBox(9,116,200,18,"Check for updates automaticly",false,false,jupdateWindow) addEventHandler("onClientGUIClick",jupdateWindow,function(button,state) if button == "left" and state == "up" then if source ~= jUpdateButton and source ~= jUpdateCheckbox then hideWindow() checking_updates = false elseif source == jUpdateButton then checking_updates = true triggerServerEvent("checkUpdateStatus",getLocalPlayer(),true) guiSetText(jUpdateLabel,"Checking...") end end guiWindowSetSizable(jupdateWindow,false) setElementData(jupdateWindow,"cant_edit",true) setElementData(jupdateVersionLabel,"cant_edit",true) setElementData(jUpdateButton,"cant_edit",true) setElementData(jUpdateLabel,"cant_edit",true) setElementData(jUpdateCheckbox,"cant_edit",true) setElementData(jupdateVersionLabel,"cant_highlight",true) setElementData(jUpdateLabel,"cant_highlight",true) setElementData(jUpdateCheckbox,"cant_highlight",true) guiSetVisible(jupdateWindow,false) end) end) function hideWindow() guiSetVisible(jupdateWindow,false) settings.jupdate_update_check.value = guiCheckBoxGetSelected(jUpdateCheckbox) saveSettingsFile() end addEvent("receiveUpdateCheck",true) addEventHandler("receiveUpdateCheck",getRootElement(),function(update,newVersion,oldVersion,manual) if checking_updates then if update then guiSetText(jUpdateLabel,"An update is available! (v. "..tostring(newVersion)..")") if manual == false then if not jupdate_version then jupdate_version = oldVersion end showWindow() end elseif update == false then guiSetText(jUpdateLabel,"No updates available") else guiSetText(jUpdateLabel,"Error: Check ACL permissions and MTA website availability.") end end end) function showWindow() guiSetText(jUpdateLabel,"GUI Editor Version "..tostring(jupdate_version)) guiCheckBoxSetSelected(jUpdateCheckbox,settings.jupdate_update_check.value) guiSetVisible(jupdateWindow,true) guiBringToFront(jupdateWindow) end Server-side function checkForUpdates(manual) local player = client local called = callRemote("https://community.multitheftauto.com/mta/resources.php",function(n,v) updateResult(n,v,player,manual) end,"version",string.lower(getResourceName(getThisResource()))) if not called then -- outputChatBox("Error: Check ACL permissions and website availability.") triggerClientEvent(client,"receiveUpdateCheck",client,nil) end end addEvent("checkUpdateStatus",true) addEventHandler("checkUpdateStatus",root,checkForUpdates) function updateResult(name,version,player,manual) local update = false if string.lower(name):find("error") or version == 0 then update = nil end if update == false then local v1,v2,v3 = parseVersion(tostring(version)) local cv1,cv2,cv3 = parseVersion(tostring(getResourceInfo(getThisResource(),"version"))) if v1 and cv1 then if v1 > cv1 then update = true elseif v2 > cv2 then update = true elseif v3 > cv3 then update = true end end end triggerClientEvent(player,"receiveUpdateCheck",player,update,version,tostring(getResourceInfo(getThisResource(),"version")),manual) end function parseVersion(version) local parts = split(version,string.byte(".")) return parts[1],parts[2],parts[3] end Settings File: settings = {} settings.gui = {} settings.jupdate_update_check = {value = false, type = "boolean"} function saveSettingsFile() local file = xmlLoadFile("settings.xml") if not file then file = xmlCreateFile("settings.xml","settings") if file then outputDebugString("Created GUI Editor settings file successfully.") else outputDebugString("Could not create GUI Editor settings file.") return end end for name,setting in pairs(settings) do if setting and setting ~= settings.gui then local node = getChild(file,tostring(name),0) if node then xmlNodeSetValue(node,tostring(setting.value)) else outputDebugString("Failed to save GUI Editor '"..tostring(name).."' setting.") end end end xmlSaveFile(file) xmlUnloadFile(file) return end function loadSettingsFile() local file = xmlLoadFile("settings.xml") if not file then outputDebugString("Couldnt find GUI Editor settings file. Creating...") saveSettingsFile(false) return end for i,node in ipairs(xmlNodeGetChildren(file)) do local value = xmlNodeGetValue(node) if value then local name = xmlNodeGetName(node) -- silly side effect of having shitty settings to begin with -- redirect deprecated names onto their new counterparts name = checkOutdatedNodes(node) local formatted = formatValue(value,name) if formatted ~= nil then settings[name].value = formatted -- outputDebugString("Loaded GUI Editor '"..name.."' setting. ("..tostring(formatted)..")") else outputDebugString("Failed to load GUI Editor '"..name.."' setting. Using default...") end end end xmlSaveFile(file) xmlUnloadFile(file) return end function checkOutdatedNodes(node) local name = xmlNodeGetName(node) if name == "updatecheck" then xmlDestroyNode(node) outputDebugString("Destroyed deprecated J Update settings node '"..name.."'.") return "jupdate_update_check" end return name end Link to comment
Jaysds1 Posted June 12, 2011 Author Share Posted June 12, 2011 And i need help with a script, I want to take the player money and fix there vehicle, but if they don't have enough then output "You don't have enough to fix you vehicle". here is my script: ONLY SERVER-SIDE function paynsprayEnter ( client ) vehicles = getElementsByType ( "vehicle" ) if getPlayerMoney ( client ) >= cost then takePlayerMoney ( client,(cost)) for vehicleKey, vehicleValue in ipairs(vehicles) do fixVehicle ( vehicleValue ) end else outputChatBox ( "You cannot afford to fix this car!",client, 0, 0, 0) end end Link to comment
JR10 Posted June 12, 2011 Share Posted June 12, 2011 what the ... first your fixing all vehicles 2- where is the cost defined use local vehicle = getPedOccupiedVehicle(client) Link to comment
Jaysds1 Posted June 12, 2011 Author Share Posted June 12, 2011 ok EDIT: It says: [2011-06-12 12:43:37] ERROR: PayNSpray\paynspray.lua:61: attempt to compare nil with number [2011-06-12 12:43:37] WARNING: PayNSpray\paynspray.lua:59: Bad 'ped' pointer @ 'getPedOccupiedVehicle'(1) [2011-06-12 12:43:37] WARNING: PayNSpray\paynspray.lua:61: Bad 'player' pointer @ 'getPlayerMoney'(1) [2011-06-12 12:43:37] ERROR: PayNSpray\paynspray.lua:61: attempt to compare nil with boolean Link to comment
JR10 Posted June 12, 2011 Share Posted June 12, 2011 can you show me the whole script? because where is the client defined where is the cost defined Link to comment
Jaysds1 Posted June 12, 2011 Author Share Posted June 12, 2011 ok here: cost = 10000 local paynspray = { } local payNSprayCol = { } local sensitiveMark = { } function paynsprayLoad ( res ) local paynsprayElements = getElementsByType ( "paynspray", getResourceRootElement(res) ) for k,v in ipairs(paynsprayElements) do local num = #paynspray+1 paynspray[num] = { } paynspray[num].Name = getElementData( v, "name" ) paynspray[num].PosX = tonumber( getElementData( v, "posX" ) ) paynspray[num].PosY = tonumber( getElementData( v, "posY" ) ) paynspray[num].PosZ = tonumber( getElementData( v, "posZ" ) ) if ( paynspray[num].PosX and paynspray[num].PosY and paynspray[num].PosZ ) then payNSprayCol = createColSphere ( paynspray[num].PosX, paynspray[num].PosY, paynspray[num].PosZ, 4 ) if getElementData( v, "isInGarage" ) ~= "false" then local garageNum = getElementData( v, "isInGarage" ) colGarage = createColSphere ( paynspray[num].PosX, paynspray[num].PosY, paynspray[num].PosZ, 13 ) setElementData ( colGarage, "garageNumber", ""..garageNum.."" ) addEventHandler( "onColShapeHit", colGarage, openGarage ) addEventHandler( "onColShapeLeave", colGarage, closeGarage ) end paynspray[num].marker = createMarker ( paynspray[num].PosX, paynspray[num].PosY, paynspray[num].PosZ, "cylinder", 3, 200, 200, 0, 200 ) paynspray[num].bliper = createBlip ( paynspray[num].PosX, paynspray[num].PosY, paynspray[num].PosZ, 63, 0, 0, 0, 255 ) addEventHandler( "onColShapeHit", payNSprayCol, paynsprayEnter ) end end end addEventHandler( "onResourceStart", getResourceRootElement(getThisResource()), paynsprayLoad ) function paynsprayUnload ( res ) for i=1,#paynspray do destroyElement(paynspray[i].marker); destroyElement(paynspray[i].bliper); end end addEventHandler( "onResourceStop", getResourceRootElement(getThisResource()), paynsprayUnload ) function openGarage (element) if ( getElementType ( element ) == "vehicle" ) then local garageNum = getElementData ( source, "garageNumber" ) if ( not isGarageOpen ( tonumber(garageNum) )) then setGarageOpen ( tonumber(garageNum), true ) end end end function closeGarage (element) if ( getElementType ( element ) == "vehicle" ) then local garageNum = getElementData ( source, "garageNumber" ) setGarageOpen ( tonumber(garageNum), false ) end end function paynsprayEnter ( client ) local vehicle = getPedOccupiedVehicle(client) vehicles = getElementsByType ( "vehicle" ) if getPlayerMoney ( client ) >= cost then takePlayerMoney ( client,(cost)) for vehicleKey, vehicleValue in ipairs(vehicles) do fixVehicle ( vehicleValue ) end else outputChatBox ( "You cannot afford to fix this car!",client, 0, 0, 0) end end Link to comment
CowTurbo Posted June 12, 2011 Share Posted June 12, 2011 cost = 10000 local paynspray = { } local payNSprayCol = { } local sensitiveMark = { } client = getLocalPlayer() function paynsprayLoad ( res ) local paynsprayElements = getElementsByType ( "paynspray", getResourceRootElement(res) ) for k,v in ipairs(paynsprayElements) do local num = #paynspray+1 paynspray[num] = { } paynspray[num].Name = getElementData( v, "name" ) paynspray[num].PosX = tonumber( getElementData( v, "posX" ) ) paynspray[num].PosY = tonumber( getElementData( v, "posY" ) ) paynspray[num].PosZ = tonumber( getElementData( v, "posZ" ) ) if ( paynspray[num].PosX and paynspray[num].PosY and paynspray[num].PosZ ) then payNSprayCol = createColSphere ( paynspray[num].PosX, paynspray[num].PosY, paynspray[num].PosZ, 4 ) if getElementData( v, "isInGarage" ) ~= "false" then local garageNum = getElementData( v, "isInGarage" ) colGarage = createColSphere ( paynspray[num].PosX, paynspray[num].PosY, paynspray[num].PosZ, 13 ) setElementData ( colGarage, "garageNumber", ""..garageNum.."" ) addEventHandler( "onColShapeHit", colGarage, openGarage ) addEventHandler( "onColShapeLeave", colGarage, closeGarage ) end paynspray[num].marker = createMarker ( paynspray[num].PosX, paynspray[num].PosY, paynspray[num].PosZ, "cylinder", 3, 200, 200, 0, 200 ) paynspray[num].bliper = createBlip ( paynspray[num].PosX, paynspray[num].PosY, paynspray[num].PosZ, 63, 0, 0, 0, 255 ) addEventHandler( "onColShapeHit", payNSprayCol, paynsprayEnter ) end end end addEventHandler( "onResourceStart", getResourceRootElement(getThisResource()), paynsprayLoad ) function paynsprayUnload ( res ) for i=1,#paynspray do destroyElement(paynspray[i].marker); destroyElement(paynspray[i].bliper); end end addEventHandler( "onResourceStop", getResourceRootElement(getThisResource()), paynsprayUnload ) function openGarage (element) if ( getElementType ( element ) == "vehicle" ) then local garageNum = getElementData ( source, "garageNumber" ) if ( not isGarageOpen ( tonumber(garageNum) )) then setGarageOpen ( tonumber(garageNum), true ) end end end function closeGarage (element) if ( getElementType ( element ) == "vehicle" ) then local garageNum = getElementData ( source, "garageNumber" ) setGarageOpen ( tonumber(garageNum), false ) end end function paynsprayEnter ( client ) local vehicle = getPedOccupiedVehicle(client) vehicles = getElementsByType ( "vehicle" ) if getPlayerMoney ( client ) >= cost then takePlayerMoney ( client,(cost)) for vehicleKey, vehicleValue in ipairs(vehicles) do fixVehicle ( vehicleValue ) end else outputChatBox ( "You cannot afford to fix this car!",client, 0, 0, 0) end end Link to comment
Jaysds1 Posted June 12, 2011 Author Share Posted June 12, 2011 NVM I don't need help with the Pay n Spray script anymore. But I still need help with the Update GUI. Link to comment
Jaysds1 Posted June 13, 2011 Author Share Posted June 13, 2011 How do you create a file and save the player position? here is my script: local playerSource = getLocalPlayer () local RootNode = xmlCreateFile("positions.xml"," newroot") local NewNode = xmlCreateChild(RootNode, "newchild") addCommandHandler ( "save", function() if ( playerSource ) then local x, y, z = getElementPosition ( playerSource ) xmlSaveFile(RootNode) end end) Link to comment
Castillo Posted June 13, 2011 Share Posted June 13, 2011 local playerSource = getLocalPlayer () local RootNode = xmlCreateFile("positions.xml"," newroot") local NewNode = xmlCreateChild(RootNode, "newchild") addCommandHandler ( "save", function() if ( playerSource ) then local x, y, z = getElementPosition ( playerSource ) xmlNodeSetAttribute(NewNode,"x",tostring(x)) xmlNodeSetAttribute(NewNode,"y",tostring(y)) xmlNodeSetAttribute(NewNode,"z",tostring(z)) xmlSaveFile(RootNode) end end) Link to comment
Jaysds1 Posted June 13, 2011 Author Share Posted June 13, 2011 It doesn't create a file. Link to comment
Castillo Posted June 13, 2011 Share Posted June 13, 2011 Yes, it does, but it creates into the client PC, client scripts folder. Go to the folder: c:\Program Files\MTA San Andreas\mods\deathmatch\resources\resource_name Link to comment
Chlorek Posted June 13, 2011 Share Posted June 13, 2011 Let's learn indroduction! Then write really scripts man... Link to comment
Jaysds1 Posted June 13, 2011 Author Share Posted June 13, 2011 NVM I'll use the other create file script. Link to comment
Castillo Posted June 13, 2011 Share Posted June 13, 2011 I guess you wanted to create it in the resource, well, then you should have used server side file functions. Link to comment
Jaysds1 Posted June 14, 2011 Author Share Posted June 14, 2011 Why isn't my Gui checking for Updates? Client-side: local checking_updates = false addEvent ( "update",true) addEventHandler ( "update", getRootElement(getThisResource()), function() sx,sy = guiGetScreenSize() jupdateWindow = guiCreateWindow((sx/2)-109,(sy/2)-74,218,148,"J UPDATE",false) jupdateVersionLabel = guiCreateLabel(11,23,196,18,"J Login Version x.x.x",false,jupdateWindow) guiLabelSetHorizontalAlign(jupdateVersionLabel,"center",true) jUpdateButton = guiCreateButton(41,79,136,25,"Check for Updates",false,jupdateWindow) jUpdateLabel = guiCreateLabel(11,45,196,33,"Update Status: unknown",false,jupdateWindow) guiLabelSetHorizontalAlign(jUpdateLabel,"center",true) jUpdateCheckbox = guiCreateCheckBox(9,116,200,18,"Check for updates automaticly",false,false,jupdateWindow) addEventHandler("onClientGUIClick",jupdateWindow,function(button,state) if button == "left" and state == "up" then if source ~= jUpdateButton and source ~= jUpdateCheckbox then hideWindow() checking_updates = false elseif source == jUpdateButton then checking_updates = true triggerServerEvent("checkUpdateStatus",getLocalPlayer(),true) guiSetText(jUpdateLabel,"Checking...") end end guiWindowSetSizable(jupdateWindow,false) setElementData(jupdateWindow,"cant_edit",true) setElementData(jupdateVersionLabel,"cant_edit",true) setElementData(jUpdateButton,"cant_edit",true) setElementData(jUpdateLabel,"cant_edit",true) setElementData(jUpdateCheckbox,"cant_edit",true) setElementData(jupdateVersionLabel,"cant_highlight",true) setElementData(jUpdateLabel,"cant_highlight",true) setElementData(jUpdateCheckbox,"cant_highlight",true) guiSetVisible(jupdateWindow,false) end) end) function hideWindow() guiSetVisible(jupdateWindow,false) settings.jupdate_update_check.value = guiCheckBoxGetSelected(jUpdateCheckbox) saveSettingsFile() end addEvent("receiveUpdateCheck",true) addEventHandler("receiveUpdateCheck",getRootElement(),function(update,newVersion,oldVersion,manual) if checking_updates then if update then guiSetText(jUpdateLabel,"An update is available! (v. "..tostring(newVersion)..")") if manual == false then if not jupdate_version then jupdate_version = oldVersion end showWindow() end elseif update == false then guiSetText(jUpdateLabel,"No updates available") else guiSetText(jUpdateLabel,"Error: Check ACL permissions and MTA website availability.") end end end) function showWindow() guiSetText(jUpdateLabel,"GUI Editor Version "..tostring(jupdate_version)) guiCheckBoxSetSelected(jUpdateCheckbox,settings.jupdate_update_check.value) guiSetVisible(jupdateWindow,true) guiBringToFront(jupdateWindow) end Server-side function checkForUpdates(manual) local player = client local called = callRemote("https://community.multitheftauto.com/mta/resources.php",function(n,v) updateResult(n,v,player,manual) end,"version",string.lower(getResourceName(getThisResource()))) if not called then -- outputChatBox("Error: Check ACL permissions and website availability.") triggerClientEvent(client,"receiveUpdateCheck",client,nil) end end addEvent("checkUpdateStatus",true) addEventHandler("checkUpdateStatus",root,checkForUpdates) function updateResult(name,version,player,manual) local update = false if string.lower(name):find("error") or version == 0 then update = nil end if update == false then local v1,v2,v3 = parseVersion(tostring(version)) local cv1,cv2,cv3 = parseVersion(tostring(getResourceInfo(getThisResource(),"version"))) if v1 and cv1 then if v1 > cv1 then update = true elseif v2 > cv2 then update = true elseif v3 > cv3 then update = true end end end triggerClientEvent(player,"receiveUpdateCheck",player,update,version,tostring(getResourceInfo(getThisResource(),"version")),manual) end function parseVersion(version) local parts = split(version,string.byte(".")) return parts[1],parts[2],parts[3] end Settings File: settings = {} settings.gui = {} settings.jupdate_update_check = {value = false, type = "boolean"} function saveSettingsFile() local file = xmlLoadFile("settings.xml") if not file then file = xmlCreateFile("settings.xml","settings") if file then outputDebugString("Created GUI Editor settings file successfully.") else outputDebugString("Could not create GUI Editor settings file.") return end end for name,setting in pairs(settings) do if setting and setting ~= settings.gui then local node = getChild(file,tostring(name),0) if node then xmlNodeSetValue(node,tostring(setting.value)) else outputDebugString("Failed to save GUI Editor '"..tostring(name).."' setting.") end end end xmlSaveFile(file) xmlUnloadFile(file) return end function loadSettingsFile() local file = xmlLoadFile("settings.xml") if not file then outputDebugString("Couldnt find GUI Editor settings file. Creating...") saveSettingsFile(false) return end for i,node in ipairs(xmlNodeGetChildren(file)) do local value = xmlNodeGetValue(node) if value then local name = xmlNodeGetName(node) -- silly side effect of having :~ settings to begin with -- redirect deprecated names onto their new counterparts name = checkOutdatedNodes(node) local formatted = formatValue(value,name) if formatted ~= nil then settings[name].value = formatted -- outputDebugString("Loaded GUI Editor '"..name.."' setting. ("..tostring(formatted)..")") else outputDebugString("Failed to load GUI Editor '"..name.."' setting. Using default...") end end end xmlSaveFile(file) xmlUnloadFile(file) return end function checkOutdatedNodes(node) local name = xmlNodeGetName(node) if name == "updatecheck" then xmlDestroyNode(node) outputDebugString("Destroyed deprecated J Update settings node '"..name.."'.") return "jupdate_update_check" end return name end Link to comment
will briggs Posted June 14, 2011 Share Posted June 14, 2011 BTW Dude, stop double posting verything, Ive even seen you do a triple post of just bull crap like 'OK' 'YA' 'HMMM' Link to comment
Jaysds1 Posted June 14, 2011 Author Share Posted June 14, 2011 I told the moderator that I'll stop. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now