Estevam2d Posted January 27, 2015 Share Posted January 27, 2015 get a table of all the players in the server, but how to get just one? Sorry for the question is that really do not know. for k, thePlayer in ipairs(getElementsByType("player")) do Link to comment
Estevam2d Posted January 27, 2015 Author Share Posted January 27, 2015 I'm having trouble creating a blips to select a player name in the list. Ai this playerBlips = {} ----playerradar addEventHandler ("onClientGUIClick", getRootElement(), function() if (source == playersradar) then Gradradarplayer = guiCreateGridList(43.5,80,265,300, false, Image) guiGridListSetSortingEnabled( Gradradarplayer, false ) Locais = guiGridListAddColumn(Gradradarplayer, "Jogadores online", 0.9) Blipsfix = guiCreateButton(46.4,390,260,30,"Fixar Blips no Jogador",false,Image) for id, playeritem in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( Gradradarplayer ) guiGridListSetItemText ( Gradradarplayer, row, Locais, getPlayerName ( playeritem ) or "Sem dados", false, false ) addEventHandler ("onClientGUIClick", getRootElement(), function() if (isElement(blib)) then destroyElement(blib) end if (source == Blipsfix) then for k, thePlayer in ipairs(getElementsByType("player")) do --My difficulty is here if not (playerBlips[thePlayer]) and not (thePlayer == localPlayer) then playerBlips[thePlayer] = createBlipAttachedTo(thePlayer, 3, 2, 0, 0, 0, 255, 1) setElementParent(playerBlips[thePlayer], playerBlipRoot) guiSetVisible(Gradradarplayer, false) guiSetVisible(Blipsfix, false) showCursor(false) end end end end ) Link to comment
Castillo Posted January 27, 2015 Share Posted January 27, 2015 getPlayerFromName That function is used to get a player element by it's name, so you can use it when the player selects an item from the grid list. Link to comment
Estevam2d Posted January 27, 2015 Author Share Posted January 27, 2015 Solidsnake14 Thanks again, helping me always. BlipsMarkPlayer = getPlayerFromName ( guiGridListGetItemText ( Gradradarplayer, guiGridListGetSelectedItem ( Gradradarplayer ), 1 ) ) local blip = createBlipAttachedTo(BlipsMarkPlayer, 3, 2, 0, 0, 0, 255, 1) Link to comment
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