Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. I tested it now and it working. You should use this script in server side.
  2. Kenix

    limit

    I think he guessed.
  3. removeWorldModel ( 6867,400,2586.8000488281,2820.6999511719,14.10000038147 ) removeWorldModel ( 6939,400,2586.8000488281,2820.6999511719,14.10000038147 ) -- this is the LOD
  4. Kenix

    limit

    I mean check edit with guiGetText.
  5. Kenix

    limit

    https://wiki.multitheftauto.com/wiki/GuiEditSetMaxLength https://wiki.multitheftauto.com/wiki/GuiGetText ?
  6. Kenix

    Loadstring

    Believe me, you need to use loadstring only in extreme necessity. Why you use loadstring can you say?
  7. MissileSite1 = createObject( 3884, 233.60000610352, 1934.5999755859, 32.500001525879 ) MissileSite2 = createObject( 3884, 267.20001220703, 1895.0999755859, 32.500001525879 ) MissileSite3 = createObject( 3884, 262, 1807.8000488281, 32.500001525879 ) MissileSite4 = createObject( 3884, 166.10000610352, 1849.9000244141, 32.500001525879 ) MissileSite5 = createObject( 3884, 113.40000152588, 1814, 32.500001525879 ) MissileSite6 = createObject( 3884, 103.80000305176, 1901, 32.500001525879 ) MissileSite7 = createObject( 3884, 162, 1932.9000244141, 32.500001525879 ) ------------------------------------------------------------------------------ local tPos = { [ MissileSite1 ] = { 235.6, 1939.5 }; [ MissileSite2 ] = { 268.0, 1899.0 }; [ MissileSite3 ] = { 263.0, 1812.0 }; [ MissileSite4 ] = { 167.0, 1854.0 }; [ MissileSite5 ] = { 115.0, 1818.0 }; [ MissileSite6 ] = { 105.0, 1905.0 }; [ MissileSite7 ] = { 163.0, 1937.0 }; } local tStreamed = { [ MissileSite1 ] = true; [ MissileSite2 ] = true; [ MissileSite3 ] = true; [ MissileSite4 ] = true; [ MissileSite5 ] = true; [ MissileSite6 ] = true; [ MissileSite7 ] = true; } local uTimers = { [ localPlayer ] = { [ MissileSite1 ] = false; [ MissileSite2 ] = false; [ MissileSite3 ] = false; [ MissileSite4 ] = false; [ MissileSite5 ] = false; [ MissileSite6 ] = false; [ MissileSite7 ] = false; }; } local function onStreamIn( ) local target = getPedOccupiedVehicle( localPlayer ) if isPedInVehicle( localPlayer ) then if getVehicleType( target ) == 'Plane' or 'Helicopter' then if getElementType( source ) == 'object' and tStreamed[ source ] then if isTimer( uTimers[ localPlayer ][ source ] ) then killTimer( uTimers[ localPlayer ][ source ] ) uTimers[ localPlayer ][ source ] = false end uTimers[ localPlayer ][ source ] = setTimer( function( target,element ) createProjectile ( localPlayer, 20 , tPos[ element ][1], tPos[ element ][2], 34.90000152587, 1.0, target, 0, 60, 0, 0, 0, 0 ) end, 2000, 0,target,source ) end end end end addEventHandler( 'onClientElementStreamIn', root, onStreamIn ) local function onStreamOut( ) if getElementType( source ) == 'object' and tStreamed[ source ] then if uTimers[ localPlayer ][ source ] then if isTimer( uTimers[ localPlayer ][ source ] ) then killTimer( uTimers[ localPlayer ][ source ] ) uTimers[ localPlayer ][ source ] = false end end end end addEventHandler( 'onClientElementStreamOut', root, onStreamOut ) addEventHandler( 'onClientPlayerQuit',root, function( ) uTimers[ source ] = nil end ) addEventHandler( 'onClientVehicleExplode',root, function( ) if getVehicleType( source ) == 'Plane' or 'Helicopter' then for _,v in pairs( uTimers[ localPlayer ] ) do if isTimer( v ) then killTimer( v ) v = false end end end end ) addEventHandler( 'onClientVehicleExit',root, function( uPlayer ) if getVehicleType( source ) == 'Plane' or 'Helicopter' then for _,v in pairs( uTimers[ uPlayer ] ) do if isTimer( v ) then killTimer( v ) v = false end end end end ) Updated again.( forgot syntax highlighting bug ) It kills timers only ( not destroy projectile )
  8. Client addEvent( 'onClientElementClicked',true ) local sx,sy = guiGetScreenSize( ) local element local gui = guiCreateWindow( 0.7672,0.2617,0.2148,0.3248,"Vehicle options", true ) local destroy = guiCreateButton( 0.2945,0.6817,0.4618,0.2462,"Destroy", true, gui ) local close = guiCreateButton( 0.2800,0.1892,0.4727,0.2312,"Close", true, gui ) guiSetVisible( gui, false ) bindKey( 'F3','down', function( ) guiSetVisible( gui, not guiGetVisible( gui ) ) showCursor( not isCursorShowing( ) ) end ) addEventHandler( 'onClientElementClicked',root, function( x,y,z ) element = source fxAddSparks ( x,y,z,1, 1, 1, 1, 10, 0, 0, 0, true, 3, 1 ) end ) function click ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if clickedElement and isElement( clickedElement ) and getElementType( clickedElement ) == "vehicle" then element = clickedElement end end addEventHandler ( "onClientClick", root, click ) function destroyCar( ) if element and isElement( element ) then triggerServerEvent( 'onDestroyElement',element ) end end addEventHandler( "onClientGUIClick",destroy, destroyCar ) Server addEvent( 'onDestroyElement',true ) addEventHandler( 'onDestroyElement',root, function( ) destroyElement( source ) end ) addEventHandler( 'onElementClicked',root, function( _,_,uPlayer,x,y,z ) if source and isElement( source ) and getElementType( source ) == "vehicle" then triggerClientEvent( uPlayer,'onClientElementClicked',source,x,y,z ) end end ) Have fun!
  9. Or give me full code i test.
  10. Смысл хуже сделал Подправил.
  11. local element function click ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if clickedElement and isElement( clickedElement ) and getElementType( clickedElement ) == "vehicle" then element = clickedElement end end addEventHandler ( "onClientClick", root, click) function destroyCar( ) if element and isElement( element ) then destroyElement( element ) end end addEventHandler( "onClientGUIClick",destroy, destroyCar ) Updated. Forgot it condition Because if you not click at element then it not return element in last argument function.
  12. So use this, but you need modified
  13. local state function click ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if getElementType( clickedElement ) == "vehicle" and state then destroyElement( clickedElement ) state = false end end addEventHandler ( "onClientClick", root, click) function destroyCar( ) state = true end addEventHandler( "onClientGUIClick",destroy, destroyCar ) Steps: 1.click on button. 2.click on element. 3.clicked element destroyed. Or you want click on car and then delete with button? local element function click ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if getElementType( clickedElement ) == "vehicle" then element = clickedElement end end addEventHandler ( "onClientClick", root, click) function destroyCar( ) if element and isElement( element ) then destroyElement( element ) end end addEventHandler( "onClientGUIClick",destroy, destroyCar ) 1.click on element. 2.click on button. 3.clicked element destroyed.
  14. function click ( button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) if getElementType( clickedElement ) == "vehicle" then destroyElement( clickedElement ) end end addEventHandler ( "onClientClick", root, click) You mean this?
  15. No problem. I not understand, you need destroy 3d element or what?
  16. Are you sure that you have found all LOD's in med?
  17. function destroyCar( ) destroyElement( source ) end addEventHandler( "onClientGUIClick",destroy, destroyCar ) Because argument clickedElement is button ( string ). You are trying to delete string ? function destroyElement destroy only elements.( not string,tables,.. only userdata ( element ) ) Source in this event is clicked gui element.
  18. No problem. I can't. I not have rights for close this topic.
  19. Server local maaskantje = createTeam ( "Maaskantje", 250, 0, 0 ) local schijndel = createTeam ( "Schijndel", 0, 0, 255 ) function maaskantje ( ) setPlayerTeam ( source,getTeamFromName( 'Maaskantje' ) ) setElementModel ( source, 280 ) end addEvent ( "maaskantjeteam", true ) addEventHandler ( "maaskantjeteam", root, maaskantje ) function schijndel ( ) setPlayerTeam ( source,getTeamFromName( 'Schijndel' ) ) setElementModel ( source, 280 ) end addEvent ( "schijndelteam", true ) addEventHandler ( "schijndelteam", root, schijndel ) You not need add source to arguments event handler function, because source already have in event and you replace with nil. Client function maaskantje ( ) outputChatBox ( "Maaskantje" ) showCursor ( false ) triggerServerEvent( 'maaskantjeteam',localPlayer ) end addEventHandler ( "onClientGUIDoubleClick", GUIEditor_Image[2], maaskantje ) function schijndel ( ) outputChatBox ( "Schijndel" ) showCursor ( false ) triggerServerEvent( 'schijndelteam',localPlayer ) end addEventHandler ( "onClientGUIDoubleClick", GUIEditor_Image[3], schijndel ) Variables GUIEditor_Image[2],GUIEditor_Image[3] defined?
×
×
  • Create New...