Jump to content

IIYAMA

Moderators
  • Posts

    6,084
  • Joined

  • Last visited

  • Days Won

    215

Everything posted by IIYAMA

  1. IIYAMA

    GiveWeapon

    But what is the problem? I don't know what to look for.
  2. You sure? Because isLineOfSignClear does not require a callback. addEventHandler("onClientVehicleDamage",root,function(attacker,wep,loss,x,y,z,tyreid) if (wep == 63 or wep == 51 or wep == 19) then local aX,aY,aZ = getElementPosition(attacker); local tX,tY,tZ = getElementPosition(source); iprint(isLineOfSightClear(tX,tY,tZ,aX,aY,aZ,true,false,false,true),aX,aY,aZ,tX,tY,tZ) if not isLineOfSightClear(tX,tY,tZ,aX,aY,aZ,true,false,false,true) then cancelEvent(); end end end); blowVehicle does not support the second argument clientside, only serverside. And I wouldn't recommend it to do it clientside because of desync.
  3. yea, true Explosions are forced to be sync. Last thing: (clientside only) bool createExplosion ( float x, float y, float z, int theType [, bool makeSound = true, float camShake = -1.0, bool damaging = true ] ) Set damaging to false after recreation. P.s. car explosions might look different.
  4. Possible way to cancel damage and still see the effect. https://wiki.multitheftauto.com/wiki/OnClientExplosion https://wiki.multitheftauto.com/wiki/CreateExplosion Might cause a little temporary desync with other players. (If you cancel the event and other players are near you.) If you saw this at the server from bigbadbutler (chaos.de), then you have to know that he used custom health instead of normal health which is a very different approach.
  5. IIYAMA

    GiveWeapon

    I don't understand your question, please rewrite last part. Not required: setWeaponAmmo (thePlayer, 38, 500) Change: giveWeapon (thePlayer, 38, 1000, true) Adding the script to two sides is not correct, unless you know what you are doing. <meta> <script src="script.lua" type="server" /> <!--<script src="script.lua" type="client" />--> </meta>
  6. @Matevsz Why don't you start with learning how to interact with a table? Your table structure is incorrect created based on the data that is inside it. Either put more data inside each item(sub table) or make each item the value(number) and not a sub-table. If you do not understand about a word of what I just said, start this: Or boring, but useful: http://lua-users.org/wiki/TablesTutorial
  7. Even so you will need to brute force it, because it a one way encryption. passwordVerify can't convert them back to original, it can only check if a hash is the same as the original password. Which means you need the original password first. @quindo oh you were quicker haha I would say: Brute force + this function = ~2030+. (Not sure how long that would take) After all, if you want to make it more harder, you can use teaEncode on top of it. (which I do) https://wiki.multitheftauto.com/wiki/TeaEncode Problem solved.
  8. I updated some content. If you find some typo's/etc Feel free to mention it. It is not my mother language after all. Thank you for the support guys! You are the best!
  9. Line 5. for i = 0, 16 do local upgrade = getVehicleUpgradeOnSlot (source, i) if ( upgrade ) then addVehicleUpgrade (source, i) end end What do you want to do here? Because I doubt this is what you want. Maybe something like this: local upgrades = getElementData (source, "upgrades") if upgrades and type(upgrades) == "table" then iprint("upgrades found") for i=1, #upgrades do if upgrades[i] then addVehicleUpgrade (source, upgrades[i]) end end else iprint("no upgrades found") end (of course you need to set the elementdata first before this is going to work) Untested Line 48. Please check the syntax of setElementData. You have now filled in one argument, but you need to fill in at least 3. https://wiki.multitheftauto.com/wiki/SetElementData Line 57. local car = getElementData(source, "hisCar") and setElementData (getVehicleUpgrades (source, "hisCar"))
  10. IIYAMA

    My Code

    I really do not understand, what you want with this? Afaik you have helped a lot people. Just some people do consider us as slaves... Please don't worry about those garbage idiots. Ignoring is the best solution.
  11. IIYAMA

    Binds

    https://wiki.multitheftauto.com/wiki/GetBoundKeys
  12. With: https://wiki.multitheftauto.com/wiki/AddVehicleUpgrade Here you can find all vehicle functions: https://wiki.multitheftauto.com/wiki/Server_Scripting_Functions#Vehicle_functions
  13. Don't ruin the typography Not sure which typo hater invented this option.
  14. Just keep the usage at a limit and you will be fine.
  15. I appreciate it, if you take me seriously. If you don't show some me motivation(for example by not showing what you tried), then please don't be so surprised. If you think that I get paid to help you, then you are slightly mistaken. I am helping you because I like to help people who want to learn. thePlayer, does not exist in this code. It is fiction. It is not here: And not here: https://wiki.multitheftauto.com/wiki/OnPlayerDamage But there is attacker which you can use over thePlayer. Which is actually a parameter of this event and sample. I recommend you to write it like this: if attacker and getElementType(attacker) == "player" then First it will check if the attacker variable has a value which is not nil/false and then it checks if the attacker is a player.
  16. IIYAMA

    Shader

    Just the most basic technique: (first post of Ren_712)
  17. local testEventHandler = function (...) iprint("eventName:", eventName, "has been executed with arguments:", ...) end local addEventHandler_ = addEventHandler function addEventHandler (...) addEventHandler_(...) local arguments = {...} arguments[3] = testEventHandler -- replace the function addEventHandler_(unpack(arguments)) end (untested) For events, you might be able to figure it out with wrappers.
  18. Don't post such useless reply and show us what you tried. You have already posted 255 posts and you still can't figure out that you have to try in order to walk, even a baby understands that. ! Here you have two tutorials: https://www.tutorialspoint.com/lua/if_else_statement_in_lua.htm
  19. IIYAMA

    Help me

    Everybody(with a delay), because you are streaming your position/rotation to the server. I do recommend you to do that serverside because of the delay. If you do that with an object, it will not be synced.
  20. Oke now look back at the code I posted, do you think you implement line 3 from my copy in your code?
  21. Getting team of nothing = warning What is <nothing>? And how to check that: https://stackoverflow.com/questions/9141217/empty-variable-check
  22. function hill_Enter ( thePlayer, matchingDimension ) if getElementType(thePlayer) == "player" then -- check if the hit element is actually a player local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) As @Blast3r said.
  23. You can't attach an addEventHandler to an element that doesn't exist yet.(it exist after the addCommandHandler has been executed. Feel free to apply this tutorial: (because a parent element can be created and attached before the children are created)
  24. Nice but keep in mind that inspect is actually for debugging. I recommend you to use tostring to convert numbers to strings. Because inspect does a lot more in the background than tostring does. Which is probably using a lot more cpu then needed. local numberToString = tostring(123) -- "123" local x = tostring(closestPoint[1]) local y = tostring(closestPoint[2]) local z = tostring(closestPoint[3]) local r = tostring(closestPoint[4]) local spawn = x..", "..y..", "..z..", "..r Also it is very important to use locals, to improve atleast the hierarchy of the code. In my opinion the most important thing about using locals, is that you as code writer know when data shouldn't be saved for a longer period. It must be GONE, because you don't need it any more. https://wiki.multitheftauto.com/wiki/Local https://www.lua.org/pil/4.2.html Whaaahaha brings back memories, when I started with lua.
×
×
  • Create New...