Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. I know about this, i was just too lazy to explain it etc so just made the script, next time i will not post whole code
  2. first this is not a requesting forum and second you should check out the wiki but anyway i've made it for you this time, i hope it works i didn't had time to test it. server.lua: function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "team") if (accountData) then setPlayerTeam(source,accountData) end end end addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) function onQuit (quitType, reason, responsibleElement,thePreviousAccount) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then local team = getPlayerTeam(source) local teamname = getTeamName(team) setAccountData (account, "team", teamname) end end end addEventHandler ("onPlayerQuit", getRootElement(), onQuit) function onLogout(prevAccount) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then local team = getPlayerTeam(source) local teamname = getTeamName(team) setAccountData (account, "team", teamname) end end end addEventHandler("onPlayerLogout", getRootElement(), onLogout) meta.xml: <meta> <info author="Castillo" version="1.0.0" type="script" description="team saver when quit/logout" /> <script src="server.lua" type="server"/> </meta>
  3. Castillo

    SCORE BOARD

    how to create a rank of kills and deaths for each player in freeroam? start resource called "scores" and that should do the job.
  4. no, i guess he put that to tell us which was client or which was server
  5. dunno but i've done some stuff and i made it working with a different way anyway, here is the working code. localPlayer = getLocalPlayer() wnd_window = {} addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), function ( theResource ) --outputConsole( "wnd_showServerInfo called" ) --outputConsole( " source: ".. tostring( source ) ) --outputConsole( " resourceStarted: ".. tostring( theResource ) ) if source == getResourceRootElement( theResource ) then --outputConsole( " passed if: source == resource" ) local xml = xmlLoadFile( "server.xml" ) local contents = xmlNodeGetValue( xml ) wnd_create( "welcome to server", "logo.png", contents ) end end ) function wnd_close() guiSetVisible( wnd_window.wnd, false ) showCursor( false ) end addEvent( "window_text", true ) function wnd_create( title, logo, content ) --outputConsole( "wnd_create called" ) if not wnd_window.wnd then --outputConsole( " passed if" ) wnd_window.wnd = guiCreateWindow( 0.1, 0.15, 0.8, 0.7, title, true ) guiWindowSetSizable( wnd_window.wnd, false ) guiWindowSetMovable( wnd_window.wnd, false ) guiSetVisible( wnd_window.wnd, true ) wnd_window.logo = guiCreateStaticImage( 0.01, 0.035, 0.98, 0.25, logo, true, wnd_window.wnd ) --wnd_window.text = content wnd_window.memo = guiCreateMemo( 0, 0.3, 1, .6, content, true, wnd_window.wnd ) guiMemoSetReadOnly( wnd_window.memo, true ) wnd_window.close_btn = guiCreateButton( 0, .91, .3, 1, "Close", true, wnd_window.wnd ) --outputConsole( " window created: ".. tostring( wnd_window.wnd ) ) showCursor( true ) addEventHandler( "onClientGUIClick", wnd_window.close_btn, wnd_close ) end end function create() guiSetVisible( wnd_window.wnd, true ) showCursor(true) end addEvent( "window_text", true ) addEventHandler( "window_text", getRootElement(), create )
  6. Castillo

    SCORE BOARD

    I'm sorry but i don't understand what you mean, can you please tell us what exactly you need?
  7. you got totally wrong, first you need to do getPedOccupiedVehicle then you can teleport it etc, here is the code done and working function aa (source) local vehicle = getPedOccupiedVehicle(source) if vehicle then setElementVelocity(vehicle,0,0,0) setElementPosition ( vehicle, 384.0750,2541.4612,16.5391) outputChatBox ( "You Have Been Teleported To The Old Airport!!", source, 0, 255, 0 ) end end addCommandHandler ( "aa", aa )
  8. this is becuase addAccount if i'm right dosn't require that "player" argument.
  9. Castillo

    nemesis

    You got wrong what i said, i meant that when i make a simple ped with createPed function all starts to lag like hell not just slothbot's, this way i had to delete all the shop ped's cause they was causing lot of lag.
  10. well this part you got to script it, you need this events, onPlayerQuit onPlayerLogin and functions easiest way should be using account data so.. setAccountData getAccountData getPlayerMoney givePlayerMoney
  11. function DMWin(mapInfo) local alivePlayers = getAlivePlayers() info = mapInfo.modename if info == "Destruction derby" then if #alivePlayers == 1 then local playername = getPlayerName(alivePlayers[1]) givePlayerMoney(source,2500) outputChatBox(playername.." took $2500 for last player alive!",getRootElement(),255,255,0) end end end addEventHandler("onPlayerWasted", getRootElement(), DMWin) hope it works it used to work on my race userpanel i made for a friend
  12. hmm better copy my code and check how i made it btw, i edited this lines, 24, 25, 26, 27 those are: wndHelp = guiCreateWindow(196,93,622,437, "Help", false) tPanel = guiCreateTabPanel(10,29,602,363, false, wndHelp) btnClose = guiCreateButton(245,396,139,23, "Close", false, wndHelp) and the memo for the text, line 141: memo[resource] = guiCreateMemo(10,7,583,324, helptext, false, tab[resource])
  13. local localPlayer = getLocalPlayer() local rootElement = getRootElement() local thisResourceRoot = getResourceRootElement(getThisResource()) local pagesXml local wndHelp, wndBlock, tPanel, btnClose local tab = {} local memo = {} local popupQueue = {} local HELP_KEY = "F9" local HELP_COMMAND = "gamehelp" local POPUP_TIMEOUT = 15000 --ms local FADE_DELTA = .03 --alpha per frame local MAX_ALPHA = .9 addEvent("doShowHelp", true) addEvent("doHideHelp", true) addEvent("onHelpShown") addEvent("onHelpHidden") addEventHandler("onClientResourceStart", thisResourceRoot, function () wndHelp = guiCreateWindow(196,93,622,437, "Help", false) wndBlock = guiCreateWindow(0, 0, 1, 1, "", true) tPanel = guiCreateTabPanel(10,29,602,363, false, wndHelp) btnClose = guiCreateButton(245,396,139,23, "Close", false, wndHelp) guiSetVisible(wndHelp, false) guiSetVisible(wndBlock, false) guiWindowSetSizable(wndHelp, false) guiSetAlpha(wndBlock, 0) addEventHandler("onClientGUIClick", btnClose, function() if source == this then clientToggleHelp(false) end end ) pagesXml = xmlLoadFile("seen.xml") if not pagesXml then pagesXml = xmlCreateFile("seen.xml", "seen") end for i, resourceRoot in ipairs(getElementsByType("resource")) do --!w local resource = getResourceFromName(getElementID(resourceRoot)) if resource then addHelpTabFromXML(resource) end end addCommandHandler(HELP_COMMAND, clientToggleHelp) bindKey(HELP_KEY, "down", clientToggleHelp) end ) addEventHandler("onClientResourceStop", thisResourceRoot, function() showCursor(false) end ) -- exports function showHelp() return clientToggleHelp(true) end addEventHandler("doShowHelp", rootElement, showHelp) function hideHelp() return clientToggleHelp(false) end addEventHandler("doHideHelp", rootElement, hideHelp) function addHelpTab(resource, showPopup) if showPopup == nil then showPopup = true end -- block duplicates if tab[resource] then return false end local tabtext = getResourceName(resource) local helpnode = getResourceConfig(":" .. getResourceName(resource) .. "/help.xml") if helpnode then local nameattribute = xmlNodeGetAttribute(helpnode, "title"); if nameattribute then tabtext = nameattribute; end end tab[resource] = guiCreateTab( tabtext , tPanel) if showPopup then addHelpPopup(resource) end return tab[resource] end function removeHelpTab(resource) if not tab[resource] then return false end if memo[resource] then destroyElement(memo[resource]) memo[resource] = nil end guiDeleteTab(tab[resource], tPanel) tab[resource] = nil return true end addEventHandler("onClientResourceStop", rootElement, removeHelpTab) --private function addHelpTabFromXML(resource) -- block duplicates if tab[resource] then return false end local helpnode = getResourceConfig(":"..getResourceName(resource).."/help.xml") if helpnode then local helptext = xmlNodeGetValue(helpnode) local showPopup = not (xmlNodeGetAttribute(helpnode, "popup") == "no") if helptext then addHelpTab(resource, showPopup) memo[resource] = guiCreateMemo(10,7,583,324, helptext, false, tab[resource]) guiMemoSetReadOnly(memo[resource], true) end end end addEventHandler("onClientResourceStart", rootElement, addHelpTabFromXML) function clientToggleHelp(state) if state ~= true and state ~= false then state = not guiGetVisible(wndHelp) end guiSetVisible(wndHelp, state) guiSetVisible(wndBlock, state) if state == true then triggerEvent("onHelpShown", localPlayer) guiBringToFront(wndBlock) guiBringToFront(wndHelp) showCursor(true) else triggerEvent("onHelpHidden", localPlayer) showCursor(false) end return true end local function fadeIn(wnd) local function raiseAlpha() local newAlpha = guiGetAlpha(wnd) + FADE_DELTA if newAlpha <= MAX_ALPHA then guiSetAlpha(wnd, newAlpha) else removeEventHandler("onClientRender", rootElement, raiseAlpha) end end addEventHandler("onClientRender", rootElement, raiseAlpha) end local function fadeOut(wnd) local function lowerAlpha() local newAlpha = guiGetAlpha(wnd) - FADE_DELTA if newAlpha >= 0 then guiSetAlpha(wnd, newAlpha) else removeEventHandler("onClientRender", rootElement, lowerAlpha) destroyElement(wnd) table.remove(popupQueue, 1) if #popupQueue > 0 then showHelpPopup(popupQueue[1]) end end end addEventHandler("onClientRender", rootElement, lowerAlpha) end function addHelpPopup(resource) local xmlContents = xmlNodeGetValue(pagesXml) local seenPages = split(xmlContents, string.byte(',')) local resourceName = getResourceName(resource) for i, page in ipairs(seenPages) do if page == resourceName then return end end xmlNodeSetValue(pagesXml, xmlContents..resourceName..",") xmlSaveFile(pagesXml) table.insert(popupQueue, resource) if #popupQueue == 1 then showHelpPopup(resource) end end function showHelpPopup(resource) local screenX, screenY = guiGetScreenSize() local wndPopup = guiCreateWindow(0, screenY - 20, screenX, 0, '', false) --350 local restitle = getResourceName(resource) local helpnode = getResourceConfig(":" .. getResourceName(resource) .. "/help.xml") if helpnode then local nameattribute = xmlNodeGetAttribute(helpnode, "title"); if nameattribute then restitle = nameattribute; end end local text = "Help page available for ".. restitle .."! ".. "Press "..HELP_KEY.." or type /"..HELP_COMMAND.." to read it." guiSetText(wndPopup, text) guiSetAlpha(wndPopup, 0) guiWindowSetMovable(wndPopup, false) guiWindowSetSizable(wndPopup, false) fadeIn(wndPopup) setTimer(fadeOut, POPUP_TIMEOUT, 1, wndPopup) end notice: i've made my own gui window cause you forgot stuff on your GUI like tab panel.
  14. That fails, check his signature "Do not PM me with questions about scripting or begging for help/script. I will just ignore you." haha just post the whole resource here and wait for an answer.
  15. wndHelp = guiCreateWindow(.2, .2, .6, .6, "Help", true) wndBlock = guiCreateWindow(0, 0, 1, 1, "", true) tPanel = guiCreateTabPanel(0, .05, 1, .85, true, wndHelp) btnClose = guiCreateButton(.4, .92, .2, .08, "Close", true, wndHelp) memo[resource] = guiCreateMemo(.05, .05, .9, .9, helptext, true, tab[resource])
  16. Yes i mean that, Yes i tried but i cant see were to edit it, And does that work with GUIeditor? I only want my own GUI menu not the regular one Thanks for quick response ! You can just copy the cords from the GUI window and paste it on the one you want to edit..
  17. wow this is alot of scripting work!! i hope if you release they the one who gonna use it won't remove the credits
  18. maybe he thinks we want to steal his resource
  19. I use in-game debug script and notepad++ when i'm scripting.
  20. this is strange it never happend to me, are you sure the name of resource is login?
  21. with help menu do you mean the one that popups with F9? if yes then you must edit the "helpmanager" if i'm right.
  22. Castillo

    RadarBlips

    I don't understand your question, maybe re-explain?
  23. try this, addEventHandler("onPlayerWasted", getRootElement(), function(ammo, killer) if getElementType(killer) == "player" then outputChatBox(getPlayerName(killer).." has just killed you!", source, 0, 255, 0) end end ) Yeah syntax was knackered, outputChatBox(getPlayerName(killer[b]))..[/b]" has just killed you!", source, 0, 255, 0) should be: outputChatBox(getPlayerName(killer[b]).[/b]." has just killed you!", source, 0, 255, 0) as said above, I apologise. And as varez mentioned, this isn't a gamemode, just run this serverside script along with freeroam for example. meta.xml if you were in doubt: <meta> <script src="server.lua" /> </meta> Please check the post he did b4 thats what i actually fixed, i removed one of the ")" cause it was making an error.
×
×
  • Create New...