-
Posts
10,056 -
Joined
-
Last visited
-
Days Won
27
Everything posted by iPrestege
-
if getElementModel ( object[source] ) == ObjectID then -- Do what you want ! Change the object it to you're object id !
-
Oh,Forget something copy it again it's a server side script.
-
-- # 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 ) setObjectScale ( object[source] , 0.5 ) exports.bone_attach:attachElementToBone(object[source],source,1,0,0,0.1,0,0,0) if getElementModel ( object[source] ) == 3515 then setElementCollisionsEnabled ( object[source],false ) end end ) -- # 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 = { { "Bottle", 1512 }, { "Flag", 2993 }, { "Model car", 2485 }, { "Pro Light", 2701 }, { "Missile", 345 }, { "Magnet", 3056 }, { "AirBomb", 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) 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 ) Try it.
-
addCommandHandler("QuitFromServer", function ( player ) kickPlayer ( player , "The Reason" ) end ) addEvent( "quitButton", true ) addEventHandler( "quitButton", getRootElement(), function ( ) local player = source if not ( isElement ( player ) ) then return end executeCommandHandler ( "QuitFromServer", player ) end )
-
object = { } addEvent("CreateObject",true) adddEventHandler("CreateObject",getRootElement(), function ( id ) if object[source] and isElement ( object[source] ) then destroyElement ( object[source] ) end local x,y,z = getElementPosition ( source ) object[source] = createObject ( id,x,y,z ) -- attach here and do what you want to do ! end )
-
https://forum.multitheftauto.com/viewtopic.php?f=148&t=40809 If I did this for you, you will never learn anything!
-
https://forum.multitheftauto.com/viewtopic.php?f=164&t=50863 + اللغةة الانجليزية و شرح اكثر من كذا ماتوقع تحصل ( = # حياكـ ربي .. #
-
function use ( ) local row, col = guiGridListGetSelectedItem ( hGrid ) if ( row and col and row ~= -1 and col ~= -1 ) then local ID = guiGridListGetItemText( hRow , hGrid , 1 ) if ( ID ) then triggerServerEvent("CreateObject",localPlayer,ID) end end end addEventHandler ( "onClientGUIClick", hButton_use, use, false ) And complete the script on the server side and make the object as a table for each player .
-
You have to create the script server side and there's an optional arguments for the rotation . triggerServerEvent
-
As i said above read my post #1 You have to create function to kick the player and add the command handler then execute the command that's all .
-
-- Server Side # marker = { } object = { } open = { } object[1] = createObject ( 980, 1319.19921875, 746.8994140625, 16 ,0, 0, 267.99499511719 ) object[2] = createObject ( 980, 1319.19921875, 746.8994140625, 16 ,0, 0, 267.99499511719 ) marker[1] = createMarker ( 1318.3000488281, 747.09997558594, 13.39999961853 ,'cylinder', 15, 0, 0, 0, 0 ) marker[2] = createMarker ( 1318.3000488281, 747.09997558594, 13.39999961853 ,'cylinder', 15, 0, 0, 0, 0 ) open[1] = false open[2] = false function OpenObject ( player ) if isElementWithinMarker ( player, marker[1] ) then if ( getElementData( player , "Group" ) == "MO7H" ) then if not open[1] then moveObject ( object[1], 1500, 1319.19921875, 746.8994140625, 10.3 ) else moveObject ( object[1], 1500, 1319.19921875, 746.8994140625, 16 ) end open[1] = not open[1] else outputChatBox ( '* You must be (MO7H) !', player, 200, 0, 0, true ) end elseif isElementWithinMarker ( player , marker[2] ) then if not open[2] then moveObject ( object[2], 1500, 1319.19921875, 746.8994140625, 10.3 ) else moveObject ( object[2], 1500, 1319.19921875, 746.8994140625, 16 ) end open[2] = not open[2] else outputChatBox ( '* You must be (MO7H) !', player, 200, 0, 0, true ) end end addEventHandler ( 'onResourceStart', resourceRoot, function ( ) for _, v in ipairs ( getElementsByType ( 'player' ) ) do bindKey ( v, 'tab', 'down', OpenObject ) end end ) addEventHandler ( 'onPlayerJoin', root, function ( ) bindKey ( source, 'tab', 'down', OpenObject ) end ) local x, y, z = 1263.19921875, 742.3994140625, 13 local size = 1.5 local Xtogo, Ytogo, Ztogo = 1609.6018066406, -1714.0665283203, 6.21875 local r, g, b = 125, 122, 132 local marker = createMarker ( x, y, z - 1, 'cylinder', size, r, g, b, 255 ) addEventHandler("onMarkerHit",marker, function ( element ) if ( getElementType ( element ) == ( "player" ) ) then if not ( getElementData( element , "Group" ) == "MO7H" ) then outputChatBox ( '* You must be (MO7H) !',element, 200, 0, 0, true ) return end setElementPosition ( element , Xtogo, Ytogo, Ztogo ) outputChatBox("* Welcome To The Home : )",element) end end ) علق المنتدى وطلع اني مسوي 50 تعديل ؟ ذذ عدلت ردي واستخدم ذآ الكود ورد لي ! جرب #
-
لا عآدي خلة يستخدم خخخخخ ! وش المشكلة يمكن مايقدر هو يسوية ذذ
-
Nah, 3nad just forgot to loop them with ipairs because no need for pairs unless table contains pairs, 3nad's code will work I've tested the code, but did not work because the table and you can test it.
-
Enad table was wrong the table should be : local IDs = { [411] = true, [429] = true }
-
اي السورس هو المود ذذ ومافية بارتمنت للاعب يعني مستحيل ذذ
-
I just lost faith in humanity. Be relaxed ! @ harry123 I Can't understand you -.- !
-
for _,player in pairs ( getElementsByType ( "player" ) ) do --- etc
-
الغلطان عطيـتـكـ وجهـ سوي اللي تسوية بـ التوفيق !
-
And? You don't have lil_Today admin panel? Or you have it -.-
-
كيفكـ جآي تتعلم آقولكـ كلنت تقولي سيرفر نلعب حنآ / =؟