Jump to content

مشكلة في كود


Recommended Posts

function cam (  ) 
    guiSetVisible(wnd, not guiGetVisible(wnd))
    showCursor(guiGetVisible(wnd))
	       guiGridListClear(GridList)
    for id, marker in ipairs(getElementsByType("marker")) do
  local row = guiGridListAddRow ( GridList )
guiGridListSetItemText ( GridList, row, 1, "Marker " .. id, false, false )
  end
  end
addCommandHandler ( "camera",cam )


addEventHandler("onClientGUIClick",root,
function ()
if source == Cm then
                local x, y, z = getElementPosition(localPlayer)
      marker = createMarker ( x , y , z, "cylinder", 1.5, 255, 255, 0, 170 )
	  elseif source == Rm then
           if guiGridListGetSelectedItem ( GridList ) ~= -1 then
     guiGridListGetItemText (GridList,guiGridListGetSelectedItem (GridList),1)
	 guiGridListRemoveRow ( GridList,camera )  
    destroyElement(marker)	
end
end
end)

السلام عليكم

اذا سويت اكثر من ماركر ماقدر احذف الماركرات اللي قبل

 WARNING: camera\client.lua:41: Bad argument @ 'destroyElement' [Expected element at argument 1]
 WARNING: camera\client.lua:41: Bad argument @ 'destroyElement' [Expected element at argument 1]

 

Link to comment
addCommandHandler ( 'camera' , function ( ) 
guiSetVisible ( wnd , not guiGetVisible ( wnd ) ) ; 
showCursor ( guiGetVisible ( wnd ) ) ;
for index , values in ipairs ( getElementsByType ( 'marker' ) ) do 
local newRow = guiGridListAddRow ( GridList ) ;
guiGridListSetItemText ( GridList , newRow , 1 , 'Marker #'..tostring(index) , false , false )
guiGridListSetItemData ( GridList , newRow , 1 , { Element = values } );
end
end );


addEventHandler ( 'onClientGUIClick' , resourceRoot , function ( ) 
if ( source == Cm ) then 
local aSelected = guiGridListGetSelectedItem ( GridList ) ; 
if ( aSelected ~= -1 ) then 
local aElement = guiGridListGetItemData ( GridList , aSelected , 1 ) [ 'Element' ] ;
if ( isElement ( aElement ) ) then 
destroyElement ( aElement ) ;
end
end
end
end );

 

  • Like 1
Link to comment
addCommandHandler ( 'camera' , function ( ) 
guiSetVisible ( wnd , not guiGetVisible ( wnd ) ) ; 
showCursor ( guiGetVisible ( wnd ) ) ;
guiGridListClear ( GridList ) ;
for index , values in ipairs ( getElementsByType ( 'marker' ) ) do 
local newRow = guiGridListAddRow ( GridList ) ;
guiGridListSetItemText ( GridList , newRow , 1 , 'Marker #'..tostring(index) , false , false )
guiGridListSetItemData ( GridList , newRow , 1 , { Element = values } );
end
end );


addEventHandler ( 'onClientGUIClick' , resourceRoot , function ( ) 
if ( source == Cm ) then 
local aSelected = guiGridListGetSelectedItem ( GridList ) ; 
if ( aSelected ~= -1 ) then 
local aElement = guiGridListGetItemData ( GridList , aSelected , 1 ) [ 'Element' ] ;
if ( isElement ( aElement ) ) then 
destroyElement ( aElement ) ;
end
end
end
end );

ماعليش نسيت اكمل الكود 

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