Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. local bState = { } function fHide( player ) bState[ player ] = not bState[ player ] if bState[ player ] then setPlayerNametagShowing( root, false ) setElementAlpha( root, 0 ) else setPlayerNametagShowing( root, true ) setElementAlpha( root, 255 ) end return true end addEventHandler( 'onPlayerJoin', root, function( ) bindKey( source, 'F1', 'down', fHide ) end ) addEventHandler( 'onResourceStart', resourceRoot, function( ) for _,v in pairs( getElementsByType 'player' ) do bindKey( v, 'F1', 'down', fHide ) end end ) Solidsnake14, He want sync it for all.
  2. Kenix

    play3d

    Client addEvent( 'returnSound',true ) addEventHandler( 'returnSound', root, function ( sound ) local px, py, pz = getElementPosition ( source ) radio = playSound3D( 'files/'.. tostring( sound ), px, py, pz, false ) setSoundMaxDistance( radio,20 ) end ) Server addEvent( 'sendSound',true ) addEventHandler( 'sendSound', root, function ( sound ) triggerClientEvent( "returnSound", source, sound ) end ) Because you trigger root with source.Source is root ( all elements in your situation ), but function getElementPosition return only for one element position. Also you not say, what is source in event sendSound.( player, ped, or something ) Tabulate your code in next time. viewtopic.php?f=91&t=40807 P.S Also show, how you trigger event sendSound.
  3. Kenix

    play3d

    How you trigger?
  4. Solution is create table. And check sub string like 1,65535. And send with parts to client. Like this: function fPack ( str ) local t = { } local new = str while #new >= 65535 do t[ #t + 1 ] = string.sub( new, 1, 65535 ) triggerClientEvent( root, 'onSomeEvent', root, t[ #t ] ) new = string.gsub( new, string.sub( new, 1, 65535 ), '' ) end t[ #t + 1 ] = string.sub( new, 1, #new ) triggerClientEvent( root, 'onSomeEvent', root, t[ #t ] ) if #t == 0 then t[1] = new end return t end
  5. No problem. If you want, ok.
  6. Kenix

    Problems

    Your variable label7 not defined. Also or NA What is it? It's define variable or no? Also i find almost not defined variables https://wiki.multitheftauto.com/wiki/Scr ... troduction viewtopic.php?f=91&t=40809 Learn!
  7. exports.scoreboard:addScoreboardColumn('Money') function fMoneyShow ( ) setElementData( source,"Money",getPlayerMoney( source ) ) end addEventHandler( 'onPlayerJoin', root, fMoneyShow ) But idk why you need check money if player join. He always have 0.
  8. Непонял тебя. Я тебе указал ошибку. И ещё при старте любого ресурса у тебя будет появляться окно.
  9. No problem. In old version mta server/client outputChatBox/outputDebugString not convert all variables to string. You need use tostring in function outputChatBox/outputDebugString for convert variables to string. If you not convert, it return false and bad argument and not output.
  10. https://wiki.multitheftauto.com/wiki/Scr ... troduction
  11. function trailerGone ( uTruck ) local trailerx, trailery, _ = getElementPosition( source ) local vehiclex, vehicley, _ = getElementPosition ( uTruck ) outputChatBox ( "X coordinate of trailer is " .. tostring( trailerx ) ) outputChatBox ( "X coordinate of vehicle is " .. tostring( vehiclex ) ) local dist = getDistanceBetweenPoints2D ( vehiclex, vehicley, trailerx, trailery ) if dist <= 20 then blowVehicle ( uTruck ) blowVehicle ( source ) end end addEventHandler( "onTrailerDetach", root, trailerGone ) Because you use not defined variable trialerx in 9 line.
  12. LogRegGetNN = guiCreateButton(0.8513,0.1615,0.1152,0.1458,"get",true,LogRegWin) Возвращает элемент гуи-лейбл. if LogRegGetNN == "left" then Это условие не будет выполняться.( Строка 24 ) Зачем делать всё в 2 событиях? В чём смысл?
  13. tim260, Can you in next time use syntax checker? Read where: Completely non-working code viewtopic.php?f=91&t=40807
  14. Kenix

    Need help.

    No problem. Edit: for i,v in pairs { [ 1 ] = '1' } do -- It's not syntax error for i,v in pairs { [ 1 ] = '1' } do ,it's same for i,v in pairs ( { [ 1 ] = '1' } ) do print( i,v ) --> 1 1 end
  15. Kenix

    Need help.

    addCommandHandler ( 'sound', function ( thePlayer, command, id ) -- thePlayer only in server side addCommandHandler. if ( type ( id ) ~= 'number' ) then return end -- all arguments in addCommandHandler ( in client side ) is string not NUMBER.So it's condition fail. if isElement ( current ) then destroyElement ( current ) end for i, music in ipairs ( songID ) do playSound ( i[id], false ) -- i variable in loop is index's in table songID. I not understand what you want create here. end end ) Draken,Read comments. For all. local songID = { 'Your sound url / directory'; 'Your sound url / directory'; 'Your sound url / directory'; } And local songID = { [ 1 ] = 'Your sound url / directory'; [ 2 ] = 'Your sound url / directory'; [ 3 ] = 'Your sound url / directory'; } It's same codes, because indexes defined by default. for i,v in pairs { '1' } do print( i,v ) --> 1 1 end for i,v in pairs { [ 1 ] = '1' } do print( i,v ) --> 1 1 end Example
  16. Server: https://wiki.multitheftauto.com/wiki/OnElementClicked Client: https://wiki.multitheftauto.com/wiki/OnClientClick Also viewtopic.php?f=91&t=40750&p=413548#p413548 Vehicle deleter.
  17. TEDERIs Молодец, хорошая работа.
  18. Kenix

    extrahealth

    local team = terrorist Your variable terrorist is defined?
  19. Just learn it. viewtopic.php?f=91&t=40809 https://wiki.multitheftauto.com/wiki/Scr ... troduction https://wiki.multitheftauto.com/wiki/Int ... ng_the_GUI
  20. Kenix

    about txd

    local txd, txd2, state bindKey( 'F2', 'down', function( ) state = not state if state then destroyElement( txd ) destroyElement( txd2 ) outputChatBox( '#ffcc00[MSG]: #c0c0c0Road texture disabled!', 255,255,255,true ) else txd = engineLoadTXD( 'vgncarshade1.txd', 3458 ) engineImportTXD( txd, 3458 ) txd2 = engineLoadTXD( 'vgncarshade.txd', 8838 ) engineImportTXD( txd2, 8838 ) outputChatBox( '#ffcc00[MSG]: #c0c0c0Road texture enabled!', 255,255,255,true ) end end ) Because in client side in function outputChatBox 2 argument is number, but you use element. https://wiki.multitheftauto.com/wiki/OutputChatBox And also you i see you replace old variable txd with new. You need define txd2 variable for delete texture in next time.
  21. Kenix

    extrahealth

    Show your full code.
×
×
  • Create New...