Jump to content

PotatoHead

Members
  • Posts

    34
  • Joined

  • Last visited

Everything posted by PotatoHead

  1. Last issue. Now I am getting a stack overflow error. These are my scripts in full. c_spawnist.lua local player = getLocalPlayer() function createSpawnList() local sW, sH = guiGetScreenSize() wdwList = guiCreateWindow((sW-830)/2, (sH-538)/2, 830, 538, "Spawn List", false) guiWindowSetSizable(wdwList, false) guiWindowSetMovable(wdwList, false) glistMainList = guiCreateGridList((830-711)/2, (538-441)/2, 711, 441, false, wdwList) guiGridListAddColumn(glistMainList, "Spawn Points", 0.9) btnSpawn = guiCreateButton((830-264)/2, (538-35), 264, 35, "Spawn", false, wdwList) addEventHandler("onClientGUIClick", btnSpawn, spawnHandler, false) makeList() end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() createSpawnList() guiSetVisible(wdwList, false) end ) function showSpawnList() if not guiGetVisible(wdwList) then guiSetVisible(wdwList, true) showCursor(true, true) end end addCommandHandler("spawn", showSpawnList) function makeList() local file = xmlLoadFile("spawnpoints.xml") if file then for _, spawns in ipairs (xmlNodeGetChildren(file)) do local row = guiGridListAddRow(glistMainList) local name = xmlNodeGetAttribute(spawns, "name") local x = xmlNodeGetAttribute(spawns, "x") local y = xmlNodeGetAttribute(spawns, "y") local z = xmlNodeGetAttribute(spawns, "z") guiGridListSetItemText(glistMainList, row, 1, name, false, false) guiGridListSetItemData(glistMainList, row, 1, {x, y, z}) end xmlUnloadFile(file) end end function spawnHandler(button, state) if button == "left" and state == "up" then local row, col = guiGridListGetSelectedItem(glistMainList) local data = guiGridListGetItemData(glistMainList, row, col) if row and col and row ~= -1 and col ~=-1 then local x, y, z = unpack(data) triggerServerEvent("spawnPlayer", player, x, y, z, player) end end end s_spawnlist.lua function spawnPlayer(x, y, z, player) spawnPlayer(player, x, y, z) end addEvent("spawnPlayer", true) addEventHandler("spawnPlayer", getRootElement(), spawnPlayer)
  2. Works great. Thanks Solidsnake. You rock man!
  3. Hello once again Solidsnake. I hope this will be my final request. Right now I just get the output of nil. c_spawnlist.lua - Client Side function makeList() local file = xmlLoadFile("spawnpoints.xml") if file then for _, spawns in ipairs (xmlNodeGetChildren(file)) do local row = guiGridListAddRow(glistMainList) local name = xmlNodeGetAttribute(spawns, "name") local x = xmlNodeGetAttribute(spawns, "x") local y = xmlNodeGetAttribute(spawns, "y") local z = xmlNodeGetAttribute(spawns, "z") guiGridListSetItemText(glistMainList, row, 1, name, false, false) guiGridListSetItemData(glistMainList, row, 1, {x, y, z}) end xmlUnloadFile(file) end end function spawnHandler(button, state) if button == "left" and state == "up" then local row, col = guiGridListGetSelectedItem(glistMainList) local data = guiGridListGetItemData(glistMainList, row, col) if row and col and row ~= -1 and col ~=-1 then for i, v in ipairs (data) do unpack(data) outputChatBox(x) outputChatBox(y) outputChatBox(z) end --local x, y, z = guiGridListGetItemData(glistMainList, row, col) --x = tonumber(x) --y = tonumber(y) --z = tonumber(z) --outputChatBox(x) end end end spawnpoints.xml "-503" y="-517" z="26" name="Fallen Tree, Los Santos"/> "" y="" z="" name="This one"/> "" y="" z ="" name="That one"/> "" y="" z="" name="You get the point..."/> "" y="" z="" name="I hope."/>
  4. Hello. I am not much of a scripter to make a RolePlay gamemode yet but I could help out with mapping, or some of the bhasic things. Maybe creating GUI and such. So if any scripters needs help with this project for mapping or GUIS or whatever PM me.
  5. Thnaks Solidsnake. One problem where would I put that whne retriving the guiGridListGetData? The code starts by taking the cords from an XML file then sets each x, y, and z cord on those values then sets the gridlist data. Now how could I retrive them in that order with the unpack function?
  6. Okay. But will it send automatically in x, y, z data? If you need the piece of code let me know.
  7. Hey. Thanks it worked. Now I am wondering if there is a way to transfer it to a server side script. I want to know because I am working with spawn cords. I wish to use the X Y Z values in a spawnPlayer() function.
  8. So I am working on a GridList and I am trying to set the date. What I want to know is if there is a way to have multiple data points. I wish to know so I can find out how to place the data if you need the script posted please let me now. Thanks.
  9. Well thanks denny will try this today. Thanks for the help everyone. I will be making a post for my gamemode soon.
  10. Not a pro at this but I am just suggesting a few things. getAccountData setAccountData
  11. call has been suggested. I don understand it. And triggerEvent I dont think it will wont but I will try it and get back to you.
  12. Thanks for the help everyone but I cant seem to get anything to work... I dont really understand the Export and call functions and what Sasuke* suggested isnt working right now.
  13. Oh okay so say I am runnning a client function called myRes that is in the arena_c. I wouls use this in the login_c myRes() and that would run it?
  14. addCommandHandler("devmode", function ( ) if ( getDevelopmentMode( ) == false ) then setDevelopmentMode( true ) else setDevelopmentMode( false ) end end end) Try that. I think it sohuld work. He forgot to close one bracket so. If that doesnt work try it this way. function devMode() if (getDevelopmentMode() == false) then setDevelopmentMode(true) else setDevelopmentMode(false) end end end addCommandHandler("togdev", devMode) CMD for that is /togdev
  15. Aww damn could you explain how to use that. I checked the wiki but it is confusing to me. And thanks
  16. I have a question like the title states. I am wondering if I have files set up like so: MTA Server/mods/deathmatch/resources/login/login_c.lua Then I have a file like so: MTA Server/mods/deathmatch/resources/login/arena_c.lua So my question is "Can I use 'triggerClientEvent' in the login file to trigger something in the arena file? I tested it and it didnt seem to work so I decided to ask.
  17. OMG! IT WORKS! Jk Not that excited but thanks lol. Well I feel dumb now... Thanks anyway lol
  18. Oh Okay thanks. I didnt know that.
  19. Okay E.G. My script is in Login-System/login_c.lua. If my sound file is in Login-System/sounds/sound.mp3 then this would be the code playSound("sounds/sound.mp3") I am not the best at this yet but that's how I would do it.
  20. You dont need the Folder name if the .lua script is in there. Just the sounds folder should do.
  21. I am working on a custom script for a server and I have three buttons after a login screen. I only have one coded right now but it does not seem to work. Here is my code. Also I am not getting any errors any where. Client Side: function makeArena() local sW, sH = guiGetScreenSize() wdwArena = guiCreateWindow((sW-802)/2, (sH-80)/2, 802, 80, "", false) guiWindowSetMovable(wdwArena, false) guiWindowSetSizable(wdwArena, false) btnArenaOne = guiCreateButton(10, (80-42)/2, 167, 42, "Arena One", false, wdwArena) btnArenaTwo = guiCreateButton((802-167)/2, (80-42)/2, 167, 42, "Arena Two", false, wdwArena) btnArenaThree = guiCreateButton(802-167-10, (80-42)/2, 167, 42, "Arena Three", false, wdwArena) addEventHandler("onClientGUIClick", btnArenaOne, selectOne, false) addEventHandler("onClientGUIClick", btnArenaTwo, selectTwo, false) addEventHandler("onClientGUIClick", btnArenaThree, selectThree, false) end function showArena() makeArena() if (wdwArena ~= nil) then guiSetVisible(wdwArena, true) setCameraMatrix(2821.47876, -1859.8666, 59.6480, 350, 1000, -1700) end end addEvent("showArena", true) addEventHandler("showArena", root, showArena) function destroyArena() showChat(true) destroyElement(wdwArena) end addEvent("onSelect", true) addEventHandler("onSelect", getRootElement(), destroyArena) function selectOne(button, state) if (button == "left" and state == "up") then triggerServerEvent("selectedOne", root, player) end end function selectTwo(button, state) if (button == "left" and state == "up") then triggerServerEvent("selectedTwo", root) end end function selectThree(button, state) if (button == "left" and state == "up") then triggerServerEvent("selectedThree", root) end end Server: function arenaOneHandler(player) spawnPlayer(player, -1394.20, 987.62, 1023.96) setElementInterior(player, 15) setCameraTarget(player, player) fadeCamera(player, 3.0) triggerClientEvent("onSelect", root) end addEvent("selectedOne", true) addEventHandler("seletedOne", root, arenaOneHandler) function arenaTwoHandler() end addEvent("selectedTwo", true) addEventHandler("selectedTwo", root, arenaTwoHandler) function arenaThreeHandler() end addEvent("selectedThree", true) addEventHandler("selectedThree", root, arenaThreeHandler) Note: At the very top of each script I have a local root = getRootElement() .
  22. That goes in the script that adds the interior.. I think. I PMed you the name of the server.
  23. I just tried that and it keeps just giving me black empty space. Here is my other code. { 3, 635.24976, -255.57161, 1081.03284, 50}, -- 135 County General Hospital, (TeddyBear)
×
×
  • Create New...