Jump to content

getElementsByType for a player


Estevam2d

Recommended Posts

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

Solidsnake14 Thanks again, helping me always. :D

BlipsMarkPlayer = getPlayerFromName ( guiGridListGetItemText ( Gradradarplayer, guiGridListGetSelectedItem ( Gradradarplayer ), 1 ) )  
                        local blip = createBlipAttachedTo(BlipsMarkPlayer, 3, 2, 0, 0, 0, 255, 1) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...