Jump to content

[HELP] | Warps?


z24d

Recommended Posts

local sx,sy = guiGetScreenSize() 
local px,py = 1600,900 
local x,y =  (sx/px), (sy/py) 
  
-- Local Window -- 
teleportWindow = guiCreateWindow(x*633, y*272, x*223, y*239, ".:[ Players Teleports ]:.", false) 
guiWindowSetSizable(teleportWindow, false) 
guiSetAlpha(teleportWindow, 1.00) 
guiSetVisible ( teleportWindow, false) 
TheCheck = guiCreateCheckBox(x*41, y*199, x*158, y*15, "Cancel Warp To Me", false, false, teleportWindow) 
        guiSetFont(TheCheck, "default-bold-small") 
        guiSetProperty(TheCheck, "NormalTextColour", "FF20FE64")     
-- Local Gridlist -- 
teleportGridlist = guiCreateGridList(x*11, y*28, x*307, y*117, false, teleportWindow) 
teleportColumn = guiGridListAddColumn(teleportGridlist, "Players", 0.9) 
teleportButton = guiCreateButton(x*43, y*165, x*146, y*30, "Warp", false, teleportWindow) 
guiSetVisible ( teleportGridlist, false) 
guiSetVisible ( teleportButton, false) 
  
-- Function Open -- 
function open () 
 if ( guiGetVisible ( teleportWindow )) or ( guiGetVisible ( teleportGridlist )) or ( guiGetVisible ( teleportButton )) then 
  guiSetVisible ( teleportWindow, false ) 
  guiSetVisible ( teleportGridlist, false ) 
  guiSetVisible ( teleportButton, false ) 
  showCursor ( false ) 
  guiGridListClear( teleportGridlist ) 
 else 
  guiSetVisible ( teleportWindow, true ) 
  guiSetVisible ( teleportGridlist, true ) 
  guiSetVisible ( teleportButton, true ) 
  showCursor ( true ) 
  for i , player in pairs(getElementsByType("player")) do 
   local addrow = guiGridListAddRow( teleportGridlist ) 
   guiGridListSetItemText(teleportGridlist,addrow,teleportColumn, getPlayerName(player),false,false) 
  end 
 end 
end 
bindKey ( "F3", "down", open ) 
  
addEventHandler( "onClientGUIClick", guiRoot, 
function() 
    if ( source == TheCheck ) then 
        local CheckData = getElementData( localPlayer, "DataCheck" ) 
        if ( guiCheckBoxGetSelected( source ) ) then 
            if ( not CheckData ) or ( CheckData ~= true ) then setElementData( localPlayer, "DataCheck", true ) end 
        else 
            if ( not CheckData ) or ( CheckData ~= false ) then setElementData( localPlayer, "DataCheck", false ) end 
        end 
    elseif ( source == teleportButton ) then 
        local addrow = guiGridListGetSelectedItem( source ) 
        if ( addrow ~= -1 ) then 
            local Target = getPlayerFromName( guiGridListGetItemText( source, addrow, 1 ) ) 
            if ( Target ) then 
                local CheckData = getElementData( Target, "DataCheck" ) 
                if ( not CheckData ) or ( CheckData == false ) then 
                    local TargetX, TargetY, TargetZ = getElementPosition( Target ) 
                    setElementPosition( localPlayer, TargetX, TargetY, TargetZ + 2 ) 
                end 
            end 
        end 
    end 
end ) 

Where is the problem i should know : )

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...