Jump to content

IIYAMA

Moderators
  • Posts

    6,062
  • Joined

  • Last visited

  • Days Won

    208

Everything posted by IIYAMA

  1. You could try: setElementParent(object, player) Not sure if it works, because I haven't tested it with dimension change before.
  2. IIYAMA

    Vehicle shot

    https://wiki.multitheftauto.com/wiki/OnClientPlayerWeaponFire with https://wiki.multitheftauto.com/wiki/ProcessLineOfSight would do the job.
  3. function bindKeysForPlayer (player) bindKey (player, "f2", fixcar) -- put here the bind keys end addEventHandler("onPlayerJoin", root, function () bindKeysForPlayer (source) end) addEventHandler("onResourceStart", resourceRoot, function () local players = getElementsByType("player") for i=1, #players do bindKeysForPlayer (players[i]) end end) Here you have an example to fix your car with f2. You can expand it as far as you want.
  4. IIYAMA

    Help me

    You can't find them, because you have to make them. setElementData Would help you doing that.
  5. IIYAMA

    Help SetTimer

    function bossEffect1 (ID) ---Off Element Data if isElement(bossDeady[ID][12]) then setElementData(bossDeady[ID][12],"boss",false) removeElementData(bossDeady[ID][12],"boss.name") removeElementData(bossDeady[ID][12],"health") setElementAlpha(bossDeady[ID][12],4) setPedOnFire(bossDeady[ID][12], true) setTimer (bossEffect2, 4000, 1, ID) end end function bossEffect2 (ID) --- On Element Data if isElement(bossDeady[ID][12]) then setElementData(bossDeady[ID][12],"boss",true) setElementAlpha(bossDeady[ID][12],255) setElementData(bossDeady[ID][12],"boss.name",name) setElementData(bossDeady[ID][12],"health",health) setPedOnFire(bossDeady[ID][12], false) end end function executeBoss (ID) setTimer (bossEffect1, 5000, 1, ID) end executeBoss (ID) -- start the boss setTimer(executeBoss, 60000, 0, ID) -- start the boss over 60 seconds and infinity times = 0. Please mind the performance man, too much timers can cause a lot of lagg if not used correctly.
  6. It can not change them, but it can fake them: triggerEvent triggerServerEvent https://wiki.multitheftauto.com/wiki/TriggerEvent https://wiki.multitheftauto.com/wiki/TriggerServerEvent
  7. That doesn't sounds right, unless there is another script interfering.
  8. Please start active debugging your code if viewing errors/warnings isn't enough.
  9. This code is far from ready for multiplayer. Lots of bugs. One of your main problems is the addCommandHandler function, please do some research about it. It will bug your whole system if you do not understand correctly how it works. https://wiki.multitheftauto.com/wiki/AddCommandHandler Is this what you mean with gate? (it is recommended to write English code for situations like this) local reja1 = createObject(971, 2440.8, 2448, 72, 0, 0, 42) local reja2 = createObject(971, 2394.5, 2493.8999, 72, 0, 0, 42) setTimer(quitarrejas, 4000, 1, reja1, reja2) function quitarrejas(reja1, reja2) if isElement(reja1) then destroyElement(reja1) end if isElement(reja2) then destroyElement(reja2) end end
  10. Make sure the server is OFF if you edit it manually.
  11. It looks like it can't find the maps. Please read the description: https://community.multitheftauto.com/index.php?p=resources&s=details&id=13118
  12. It really depends who you hire. If I did paid scripting(which I do not), I would charge you around 10 euro per hour. The length of the project depends on your criteria. But there are people who do it for 3 euro per hour... or 5 cent per code line.
  13. if getElementData(player, "content-downloaded") then -- spawn in freeroam end if not getElementData(player, "content-downloaded") then -- spawn in katana land end -- finish downloading setElementData(player, "content-downloaded", true, false)
  14. Create less markers I think. If you have a texture file, make it a power of two and optimise it with dxt1or dxt5.(which will reduce the texture ram usage with dxt5 = 75% / dxt1 = 87,5%)
  15. function sqlQuery(query, ...) iprint(connection, query, ...) -- < iprint here return dbQuery(connection, query, ...) end -- do the original query function, if something goes wrong then it is not a problem with your utility function. local qh = dbQuery(connection, "INSERT INTO test (asd1, asd2) VALUES (?, ?)", "asd1 original", "asd2 original") dbFree ( qh ) -- do yours. local Query = sqlQuery ("INSERT INTO test (asd1, asd2) VALUES (?, ?)", "asd1", "asd2") dbFree ( Query ) if Query then outputServerLog ("true") else outputServerLog ("false") end
  16. Yes there, that is correct. Values are looking correct. Did you test it with the default function? And did that work? And please post more of the updated code.
  17. test it first with the default function. If that is OK. Then debug the arguments. iprint(connection, query, ...)
  18. _dbQuery = dbQuery function dbQuery(query, ...) return _dbQuery(connection, query, ...) end Basis from quindo. If you want to fill in multiple values.
  19. Lets start with the basics example -- < this is a variable thisPlayer -- < this too hi -- < and this, etc. First of all, variables CAN CONTAIN any value. The name does not define what value it contains, unless it is predefined. So the variable thePlayer does not have to contain a player value. It can be anything, it is just a name where you can assign a value to. example = "nice" -- it can contain a string example = false -- or a boolean example = 12345 -- or a number example = {} -- a table -- and more! Here you have a list with predefined variables: This is the list of the predefined variables from MTA(written down by Kenix) Those variables contain the values that are declared before your script is loaded. Yet some of them do only contain values under special conditions. You can find those conditions in the comments behind the variables. SO PLEASE, there is NO thePlayer. It does not exist by itself. Now to get back to your issue. There is a predefined variable localPlayer, please check the list again. It is YOU and your adorable ped element. (clientside only) If we visit this page: https://wiki.multitheftauto.com/wiki/TriggerServerEvent You can see the required arguments: Required Arguments event: The name of the event to trigger server-side. You should register this event with addEvent and add at least one event handler using addEventHandler. theElement: The element that is the source of the event. The event: "takeCash" And the source element: resourceRoot The source element is a predefined variable, which will be come active after triggering an addEventHandler. function takeCashHandler ( thePlayer, amount ) iprint(source) -- resourceRoot end `source` is NOT a parameter. Parameters are the variables that be found here: takeCashHandler (<parameter>, <AND parameter>, <ETC.>) The special thing about parameters is that they contain the values that are given from the place where the function is called from. (see example below) For the ones that are using the `source` as parameter, they are not consistent and will confuse other people if they share their code. Using source as parameter will overwrite it's value if already set. If I call your function with a normal call, it would looks like this: function takeCashHandler ( thePlayer, amount ) takePlayerMoney ( thePlayer, tonumber(amount) ) end local randomPlayer = getRandomPlayer() takeCashHandler (randomPlayer , 2 ) -- calling the function takeCashHandler The first parameter receives the first value <just a random player in the server>. The second parameter receives the second number value 2. Order matters, name does NOT! In this code we give two parameters a value. The value of the predefined variable `localPlayer` and a number value 2. -- Client side triggerServerEvent ( "takeCash", resourceRoot, localPlayer, 2 ) -- takes $2 of the player -- Server side function takeCashHandler ( thePlayer, amount ) takePlayerMoney ( thePlayer, tonumber(amount) ) end addEvent( "takeCash", true ) addEventHandler( "takeCash", resourceRoot, takeCashHandler ) There is also the predefined variable `client` which you could use. Which represents the player (element) that has called the server. But only is defined when an addEventHandler exist and has been used.
  20. Serverside is running on the 'server' computer and clientside is running on the pc you use to play mta. If you use a local server. They both run on the same computer but in a different environment. Summary Serverside = server computer (or on your game pc in a different environment) Clientside = game pc They play their own roll and have to communicate between each other, in order to move information from one computer to another. The rest speaks for itself.
  21. executeSQLQuery("CREATE TABLE IF NOT EXISTS `users` (username TEXT, password TEXT)") https://wiki.multitheftauto.com/wiki/ExecuteSQLQuery This will create a table `users` if it doesn't exist already.
  22. The texture(image) has failed to load. Please post parts of the script and check if: screenshot (upload) / screen capture is enabled. (the script might be using that feature) You can find that option in your MTA settings menu.
  23. He puts everything through Google translate, to hell Google translate does that for him. Or the word 'guy' is his country must mean the same as 'gay', which I seriously doubt. @santinet12 There are a lot of examples of how to use the bindkey functions in here: https://wiki.multitheftauto.com/wiki/BindKey Why don't you start with applying and modifying example 1 in to your code?
  24. You should have asked that question in your main post lol. Please take a look at the example of this function, it just what you need: https://wiki.multitheftauto.com/wiki/IsTransferBoxActive
×
×
  • Create New...