iPrestege Posted May 12, 2013 Share Posted May 12, 2013 No make it as a table like what i did with the object . Link to comment
supergonkas Posted May 12, 2013 Author Share Posted May 12, 2013 can you show me an example pls so i can try make it Link to comment
iPrestege Posted May 12, 2013 Share Posted May 12, 2013 Will i show you the object example you can make it with the same way there's no more examples . Link to comment
supergonkas Posted May 12, 2013 Author Share Posted May 12, 2013 really i just need an example on how to integrate it,not a full script! Link to comment
iPrestege Posted May 12, 2013 Share Posted May 12, 2013 marker = {} marker[element] = createMarker( ... ) Is it hard to make like this? Link to comment
supergonkas Posted May 12, 2013 Author Share Posted May 12, 2013 and it can be aded to the existing grid? Link to comment
iPrestege Posted May 12, 2013 Share Posted May 12, 2013 Yes but any text for it and make another trigger for it . Link to comment
supergonkas Posted May 12, 2013 Author Share Posted May 12, 2013 (edited) ok,i think i got it , i am gonna try make it Edited May 12, 2013 by Guest Link to comment
iPrestege Posted May 12, 2013 Share Posted May 12, 2013 You have to get the text of the grid if the text == marker text then trigger..etc kk? Link to comment
supergonkas Posted May 12, 2013 Author Share Posted May 12, 2013 i tryed to make this but now it doesnt work can you help me server -- # Server Side object = { } addEvent("CreateTheObject",true) addEventHandler("CreateTheObject",getRootElement(), function ( Model ) if ( object[source] and isElement ( object[source] ) ) then destroyElement ( object[source] ) end local x,y,z = getElementPosition ( source ) object[source] = createObject ( Model , x , y , z ) exports.bone_attach:attachElementToBone(object[source],source,1,0,0,0.1,0,0,0) end) marker = {} addEvent("CreateTheMarker",true) addEventHandler("CreateTheMarker",getRootElement(), function ( Model ) if ( object[source] and isElement ( object[source] ) ) then destroyElement ( marker[source] ) end local x,y,z = getElementPosition ( source ) marker[source] = createMarker ( x, y, z, "cylinder", 1.5, 255, 255, 0, 170 ) exports.bone_attach:attachElementToBone(marker[source],source,1,0,0,0.1,0,0,0) ) end if getElementModel ( object[source] ) == 3515 then setObjectScale ( object[source] , 0.2 ) end if getElementModel ( object[source] ) == 1248 then setObjectScale ( object[source] , 1.3 ) exports.bone_attach:attachElementToBone(object[source],source,1,0,0.03,0.1,0,0,180) end if getElementModel ( object[source] ) == 2045 then setObjectScale ( object[source] , 1 ) exports.bone_attach:attachElementToBone(object[source],source,12,-0.2,0,0.08,0,0,90) end if getElementModel ( object[source] ) == 13562 then setObjectScale ( object[source] , 0.2 ) exports.bone_attach:attachElementToBone(object[source],source,1,0,0.03,0.2,0,0,0) end if getElementModel ( object[source] ) == 1512 then setObjectScale ( object[source] , 0.1 ) setElementAlpha ( object[source] , 0 ) exports.bone_attach:attachElementToBone(object[source],source,1,0,0.03,0.1,0,0,180) end client -- # Client Side local hRow = nil hWnd = guiCreateWindow( 0.1, 0.1, 0.2, 0.65, "Hats", true ); hButton_use = guiCreateButton( 0.1, 0.725, 0.5, 0.1, "Use", true, hWnd ); hButton_close = guiCreateButton( 0.1, 0.85, 0.5, 0.1, "Close", true, hWnd ); guiSetVisible(hWnd,false) showCursor(false) local aObjects = { { "No Hat", 1512 }, { "Flag", 2993 }, { "Ring", }, { "Model car", 2485 }, { "Pro Light", 2701 }, { "Missile", 345 }, { "Magnet", 3056 }, { "GTA3 logo", 1248 }, { "Nail Bat", 2045 }, { "Spruk can", 13562 }, { "Fontain", 3515 }, { "WW1 hat", 2052 }, { "Captain hat", 2054 }, { "WW2 hat", 2053 } -- you can objects, first add name to see it in gridList, then object ID }; hGrid = guiCreateGridList( 0.1, 0.10, 0.8, 0.60, true, hWnd ); guiGridListAddColumn( hGrid, "ZM hats", 0.85 ); for i,m_obj in ipairs( aObjects ) do hRow = guiGridListAddRow( hGrid ); guiGridListSetItemText ( hGrid, hRow, 1, tostring( m_obj [ 1 ] ), false, false ); guiGridListSetItemData ( hGrid, hRow, 1, tostring( m_obj [ 2 ] ) ); end addEventHandler ( "onClientGUIClick",hButton_use, function ( ) local row, col = guiGridListGetSelectedItem ( hGrid ) if ( row and col and row ~= -1 and col ~= -1 ) then local model = tonumber ( guiGridListGetItemData ( hGrid, row, 1 ) ) triggerServerEvent("CreateTheObject",localPlayer,model) triggerServerEvent("CreateTheMarker",localPlayer,model) end end,false ) addEventHandler ( "onClientGUIClick",hButton_close, function ( ) guiSetVisible(hWnd, false) showCursor(false) end,false ) bindKey("F6","down", function ( ) guiSetVisible ( hWnd , not guiGetVisible ( hWnd ) ) showCursor ( guiGetVisible ( hWnd ) ) end ) Link to comment
iPrestege Posted May 12, 2013 Share Posted May 12, 2013 You aren't make a sense check the variables . Link to comment
supergonkas Posted May 12, 2013 Author Share Posted May 12, 2013 oh,i think its the ring that has no id,but how can i define it? its no id just a name Link to comment
iPrestege Posted May 12, 2013 Share Posted May 12, 2013 You are using a object variable with a marker variable ? Link to comment
supergonkas Posted May 12, 2013 Author Share Posted May 12, 2013 oh that is the problem,but how can i integrate it in the same grid? Link to comment
iPrestege Posted May 12, 2013 Share Posted May 12, 2013 Just add the text into the table with out any id . Link to comment
supergonkas Posted May 12, 2013 Author Share Posted May 12, 2013 and then i just put it in the creat marker? Link to comment
iPrestege Posted May 12, 2013 Share Posted May 12, 2013 It's not that hard to add a marker on the table and then add the text to the grid and then use guiGridListGetItemText to get the grid text and check if the text = marker text then trigger to the server side that's all! Link to comment
supergonkas Posted May 12, 2013 Author Share Posted May 12, 2013 can you shom me an example pls? is that the scrpit at this point dont work 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