Karuzo Posted February 8, 2014 Posted February 8, 2014 Hey Guys, so i have a little problem with my World-Panel. i want to check which row the player has selected. but it doesn't really works. function DeathMatchMaps() if guiGridListGetItemText(World.gridlist[1],guiGridListGetSelectedItem(World.gridlist[1])) ~= "1200" then triggerServerEvent("DeathMatch1" , getLocalPlayer()) outputChatBox("Deathmatch 1'ye warplandin!", 0, 255,0, false) elseif (guiGridListGetItemText == DM2) and (guiGridListGetItemText == DMDim2) then triggerServerEvent("DeathMatch1", getLocalPlayer()) outputChatBox("Deathmatch 2'ye warplandin!", 0, 255, 0, false) end end addEventHandler("onClientGUIClick", World.button[1], DeathMatchMaps) I think that's all you'll need Thank you for your help.
xXMADEXx Posted February 8, 2014 Posted February 8, 2014 Try this: function DeathMatchMaps() local row, col = guiGridListGetSelectedItem ( World.gridlist[1] ) if ( row == -1 ) then return end local text = guiGridListGetItemText ( World.gridlist[1], row, col ) if ( text == "1200" ) then triggerServerEvent("DeathMatch1" , getLocalPlayer() ) outputChatBox("Deathmatch 1'ye warplandin!", 0, 255,0, false) elseif ( text == "DM2" ) then triggerServerEvent("DeathMatch1", getLocalPlayer()) outputChatBox("Deathmatch 2'ye warplandin!", 0, 255, 0, false) end end addEventHandler("onClientGUIClick", World.button[1], DeathMatchMaps)
Karuzo Posted February 8, 2014 Author Posted February 8, 2014 Hey again, i think it's a small question so i don't make another topic. How can i make a table with some positions for setElementPosition?
xXMADEXx Posted February 8, 2014 Posted February 8, 2014 Like this? local positions = { { x, y, z }, { x, y, z}, -- & so on }
Karuzo Posted February 8, 2014 Author Posted February 8, 2014 ye, but how do i take that coords out ? e.g.: setElementPosition(source, math.random(table) ) I want to choose them randomly.
xXMADEXx Posted February 8, 2014 Posted February 8, 2014 local positions = { { x, y, z }, { x, y, z}, -- & so on } function getRandomCoordinates ( ) return unpack ( positions [ math.random ( #positions ) ] ) end
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