Jump to content

PotatoHead

Members
  • Posts

    34
  • Joined

  • Last visited

Details

  • Gang
    guns

PotatoHead's Achievements

Rat

Rat (9/54)

0

Reputation

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