Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. addEvent("onClientPlayerLogin",true) knife = guiCreateStaticImage(0.4678, 0.3242, 0.0977, 0.1315, "images/knife.png", true) sword = guiCreateStaticImage(0.5830, 0.4336, 0.0977, 0.1315, "images/sword.png", true) gun = guiCreateStaticImage(0.3457, 0.4479, 0.0977, 0.1315, "images/gun.png", true) fist = guiCreateStaticImage(0.4688, 0.5898, 0.0977, 0.1315, "images/fist.png", true) logo = guiCreateStaticImage(0.4521, 0.4232, 0.0977, 0.1315, "images/aclogo.png", true) guiSetVisible( knife, false ) guiSetVisible( sword, false ) guiSetVisible( gun, false ) guiSetVisible( fist, false ) guiSetVisible( logo, false ) function fStateGoogle( ) return setCameraGoggleEffect( getCameraGoggleEffect( ) == 'thermalvision' and 'normal' or getCameraGoggleEffect( ) == 'normal' and 'thermalvision' ) end function fStateMenu( ) guiSetVisible( knife, not guiGetVisible( knife ) ) guiSetVisible( sword, not guiGetVisible( sword ) ) guiSetVisible( gun, not guiGetVisible( gun ) ) guiSetVisible( fist, not guiGetVisible( fist ) ) guiSetVisible( logo, not guiGetVisible( logo ) ) showCursor( not isCursorShowing( ) ) end function giveTheWeapons( ) if (source == knife) then triggerServerEvent("giveKnife", localPlayer) elseif (source == sword) then triggerServerEvent("giveSword", localPlayer) elseif (source == gun) then triggerServerEvent("giveGun", localPlayer) elseif (source == fist) then triggerServerEvent("useFist", localPlayer) end end function bindTheKeys() bindKey( "Q", "down", fStateMenu ) bindKey( "E", "down", fStateGoogle ) end addEventHandler("onClientPlayerLogin", getRootElement(), bindTheKeys) addEventHandler("onClientMouseEnter", getRootElement(), giveTheWeapons) Updated again.
  2. addEvent("onClientPlayerLogin",true) function startGoogle() if getCameraGoggleEffect( ) == "normal" then setCameraGoggleEffect( "thermalvision" ) end end function stopGoogle() if getCameraGoggleEffect( ) == "thermalvision" then setCameraGoggleEffect( "normal" ) end end function openMenu() knife = guiCreateStaticImage(0.4678, 0.3242, 0.0977, 0.1315, "images/knife", true) sword = guiCreateStaticImage(0.5830, 0.4336, 0.0977, 0.1315, "images/sword", true) gun = guiCreateStaticImage(0.3457, 0.4479, 0.0977, 0.1315, "images/gun", true) fist = guiCreateStaticImage(0.4688, 0.5898, 0.0977, 0.1315, "images/fist", true) logo = guiCreateStaticImage(0.4521, 0.4232, 0.0977, 0.1315, "images/aclogo", true) guiSetVisible(not guiGetVisible(knife)) guiSetVisible(not guiGetVisible(sword)) guiSetVisible(not guiGetVisible(gun)) guiSetVisible(not guiGetVisible(fist)) guiSetVisible(not guiGetVisible(logo)) showCursor(not isCursorShowing()) end function closeMenu() guiSetVisible(not guiGetVisible(knife)) guiSetVisible(not guiGetVisible(sword)) guiSetVisible(not guiGetVisible(gun)) guiSetVisible(not guiGetVisible(fist)) guiSetVisible(not guiGetVisible(logo)) showCursor(not isCursorShowing()) end function giveTheWeapons(element) if (element == knife) then triggerServerEvent("giveKnife", localPlayer) elseif (element == sword) then triggerServerEvent("giveSword", localPlayer) elseif (element == gun) then triggerServerEvent("giveGun", localPlayer) elseif (element == fist) then triggerServerEvent("useFist", localPlayer) end end function bindTheKeys() bindKey("Q", "down", openMenu) bindKey("Q", "up", closeMenu) bindKey("E", "down", startGoogle) bindKey("E", "up", stopGoogle) end addEventHandler("onClientPlayerLogin", getRootElement(), bindTheKeys) addEventHandler("onClientMouseEnter", getRootElement(), giveTheWeapons) You not call function and getCameraGoogleEffect/setCameraGoogleEffect there is no. viewtopic.php?f=91&t=40807
  3. Do you own point of view on this matter. Read my last post.
  4. Benxamix2,You can write as much as necessary, but comments are need. Why comments have come up with? I use prefix name for variables. n = number, b = boolean, .. It also simplifies reading the code, because you know what this type of variable. P.S I have often seen the names of the variables like ( lol,ga1,rh2,... ) it's not good believe me.
  5. local sRandom = tSome[ math.random( #tSome ) ] -- We obtain a random value from a table of random key. Maybe, someone not understand this. It is best to write comments. Who else wants to can align a comments. Ok we know this function return 3 axis ( x,y,z ). Maybe we not know variable player is not element or something.
  6. race/modes/destructionderby.lua line 69
  7. В мускуле mysql_free_result, вдруг надумаешь вернуться
  8. You forgot 2 'end'. lol? You need learn lua.
  9. Kenix

    Help

    setVehicleColor have 4 optional arguments. You use 5. Syntax in 1.1 and higher. bool setVehicleColor ( vehicle theVehicle, int r1, int g1, int b1, [int r2, int g2, int b2,] [int r3, int g3, int b3,] [int r4, int g4, int b4] ) I add example on wiki.
  10. Learn viewtopic.php?f=91&t=40809
  11. Kenix

    Help

    local uVehicles = { } function fAdminVehicleColor( ) if isObjectInACLGroup( 'user.' .. getAccountName( getPlayerAccount( source ) ), aclGetGroup 'Admin' ) then uVehicles[ source ] = { } for _, uVehicle in ipairs( getElementsByType 'vehicle' ) do uVehicles[ source ][ uVehicle ] = { } uVehicles[ source ][ uVehicle ][ 1 ] = math.random( 0,255 ) uVehicles[ source ][ uVehicle ][ 2 ] = math.random( 0,255 ) uVehicles[ source ][ uVehicle ][ 3 ] = math.random( 0,255 ) setVehicleColor ( uVehicle, uVehicles[ source ][ uVehicle ][ 1 ], uVehicles[ source ][ uVehicle ][ 2 ], uVehicles[ source ][ uVehicle ][ 3 ] ) end end end addEventHandler( 'onPlayerLogin',root ,AdminVehicleColor ) addEventHandler( 'onPlayerQuit',root, function( ) uVehicles[ source ] = nil end ) Updated again. Evil-Cod3r,You code wrong
  12. Kenix

    Login GUI

    Omg I show you code Why you not use?
  13. Kenix

    Login GUI

    Upload resource.
  14. ATTENTION! First thing you must do before starting to script for MTA is to learn Lua. If you don't learn the basics of Lua language, it will be hard for you to script anything. I've compiled this list of tutorials and manuals, which should be useful for scripting beginners. http://www.lua.org/manual/5.1/ ( recommended ) http://www.lua.org/pil/index.html ( recommended ) http://lua-users.org/wiki/TutorialDirectory ( recommended ) http://lua-users.org/wiki/LuaFaq http://nixstaller.sourceforge.net/manua ... ler_9.html http://en.wikipedia.org/wiki/Lua_(programming_language) ( recommended ) http://lua.gts-stolberg.de/en/index.php http://www.luxinia.de/index.php/Tutorials/Lua http://forum.toribash.com/showthread.php?t=74001 http://lua-av.mat.ucsb.edu/blog/?p=39 ( recommended ) http://www.ozone3d.net/tutorials/lua_coding.php http://luatut.com/ ( recommended ) http://nixstaller.sourceforge.net/manua ... ler_9.html ( recommended ) http://wiki.roblox.com/index.php/Beginn ... Coroutines ( recommended ) Lua demo: http://www.lua.org/demo.html codepad.org: http://codepad.org/ ideone.com: http://ideone.com/ MTA scripting IRC channel: #mta.scripting List will be updated. If you have any other useful tutorial/manual links — post it.
  15. Before you put the code, better read this items: Standard design code Presence total style programming facilitate understanding source code. In any control structures, operators be is indented. Binary operators should frame spaces. Comments Strive comment each needed row of the code. It's much easier to read. Definition of variables, events, handlers Order: Events ( addEvent ) Variables ( WARNING:Functions define last! Next define handlers. ) Handlers ( addEventHandler,... ) It's also easier to read code. [*]Logs If your code not working, use /debugscript 3 in chat or debugscript 3 in console. Also all errors will be in the logs. Server log: Server folder\server\mods\deathmatch\logs\server.log Client log: Client folder\MTA\clientscript.log Do not forget to clean the logs. [*]Logically, a non-working code If your code refuses to work, not debug messages, not logs, you need check each row of the code. Namely: Variables Conditions Return values ​​of functions and etc [*]Completely non-working code If your code refuses to work, possibly your code has syntax errors. Better put debugger in your text program. Notepad++ viewtopic.php?f=91&t=30077 If you not know, how to put debugger in text program , better download ready-made program with debugger: LuaEdit http://sourceforge.net/projects/luaedit ... t/download MTA Script editor viewtopic.php?t=24834 [*]Completely non-business resource If your resource refuses to working, check meta.xml. Possibly, meta.xml has syntax errors and so your resource can't be working in any case. More info about meta.xml https://wiki.multitheftauto.com/index.php?title=Meta.xml [*]Example local Some = { 'somevalue', 'somevalue2' } function GetSomeValue( ) local stringRandom = aSome[ math.random( #Some ) ] -- We obtain a random value from a table of random key. outputChatBox( 'Random value is: ' .. stringRandom ) end addCommandHandler( 'somevalue', GetSomeValue ) Original post from me in russian section: viewtopic.php?f=141&t=40703
  16. Kenix

    Help!

    lol? https://wiki.multitheftauto.com/wiki/Scr ... troduction
  17. Kenix

    Help!

    Show full code.
  18. Kenix

    Login GUI

    Check each row.
  19. Kenix

    User Panel

    This bad code believe me. Use my code. I say what need create you.
  20. Kenix

    Parse help.

    https://wiki.multitheftauto.com/wiki/Meta.xml
×
×
  • Create New...