Jump to content

Jaysds1

Members
  • Posts

    4,961
  • Joined

  • Last visited

Everything posted by Jaysds1

  1. Jaysds1

    kill timer

    Thanks everyone for helping.
  2. Jaysds1

    kill timer

    I want to make a kill script, if the player tries to kill them selves again, they have to wait 3mins until it automatically kills them. here's what I got already: local player = getlocalPlayer() function kill() if (player) then killPlayer(source) setTimer(30000, 0) else isTimer(kill) killPlayer(source) end end
  3. Jaysds1

    Problems

    It's ok CowTurbo, We all have bad days
  4. Jaysds1

    Problems

    Thanks Castillo
  5. Jaysds1

    Problems

    How do you make a script on, when a admin login and automatically adds "{SERVERNAME}" at the beginning of the admin name? My server-side script: function iamAdmin(player) local account = getPlayerAccount(player) if not account then return end local accountName = getAccountName(account) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then local tag = "{JWORLD}" local oldName = getPlayerName ( client ) local newName = tag .. oldName setPlayerName (source, newName) setPlayerTeam" class="kw6">setPlayerTeam (source, teamA) ouputChatBox ("ADMIN ON LINE") end if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderator" ) ) then local tag = "{JWORLD MODERATOR}" local oldName = getPlayerName ( client ) local newName = tag .. oldName setPlayerName (source, newName) setPlayerTeam" class="kw6">setPlayerTeam (source, teamM) ouputChatBox ("MODERATOR ON LINE") end end addEventHandler("onPlyerLogin", getRootElement(), iamAdmin)
  6. Jaysds1

    Problems

    ok, thanks THAT'S SOOOO BETTER!
  7. Jaysds1

    Problems

    attitude.... I'm just trying to learn like everybody else.... GOOOSH!
  8. Jaysds1

    Problems

    so, the playerElement could be "source" or "client"?
  9. Jaysds1

    Problems

    No, I meant only showing the gui to the person not to others. Sorry about the first question.
  10. thanks for the code, I needed it to block users from putting {JWORLD}. Edit: There I'm not posting without a reason.
  11. Jaysds1

    Problems

    how do you show the gui to the client when triggering a Client Event?
  12. U guyz do know this topic is only for joining or asking questions about it.
  13. My first resource: Delete: https://community.multitheftauto.com/index.php?p=resources&s=details&id=2246
  14. Jaysds1

    Problems

    ok, Now can you guyz get on Topic, I need help with this update gui thing.
  15. Jaysds1

    Help me pls

    You guyz are sooo off topic!
  16. it isn't stolen! Edit: I'll remove the background then.
  17. Jaysds1

    Tazer

    What's the problem? is there any error code or does the script not work?
  18. So, you want the person to spawn at the new location when they join?
  19. Jaysds1

    Problems

    I told the moderator that I'll stop.
  20. Well I think your right, there should be a resolution selector.
  21. Jaysds1

    Port Problems

    thanks, and I forgot about the mtaserver.conf
  22. Jaysds1

    Problems

    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
×
×
  • Create New...