IIYAMA

Scripting Moderators
  • Content Count

    5,023
  • Joined

  • Last visited

  • Days Won

    70

IIYAMA last won the day on November 21

IIYAMA had the most liked content!

Community Reputation

884 MTA Ambassador

About IIYAMA

  • Rank
    Scripting Moderator & User Guide Contributor
  • Birthday 01/01/2016

Details

  • Gang
    [HB]
  • Location
    Netherlands
  • Occupation
    I have never been to the streets of SA... so who knows?
  • Interests
    Design, scripting, UX/UI

Recent Profile Visitors

8,744 profile views
  1. There are many. But if there is no issue, why changing the approach? If you want a different approach, it doesn't start with code, but with a concept and questions. How should the data be saved? And how should the data be accessed? Must it be dynamic? Must it be player specific? What are the conditions? What are the possible outcomes?
  2. Locked, reason: scripting request. You can make requests here: (read the section rules before posting) https://forum.mtasa.com/forum/149-looking-for-staff/
  3. For a scripter, yes. If you are looking for somebody that can create it, this is not the right section for that. See this section instead: https://forum.mtasa.com/forum/149-looking-for-staff/
  4. You can't. It might be fake-able with propagation, but I don't think that is what you want. That is not going to work, the serverside function will not be able to apply the effect on an clientside element. What you need to do: Destroy the marker <--> recreate it.
  5. Clientside created elements are not available on serverside. Those markers are already invisible for other clients/players as well as the server.
  6. IIYAMA

    Timer or coroutine

    It is mainly used to break a big task in separated sub-tasks. Your computer can't finish the big task in one run without blocking everything else (other resources and applications like your browser). For example: You have to do 10 exams and for that you have write a script that would determine which exams you have to learn for. For learning each exam you need 4 hours. You are a human, so you need every day atleast 13 hours resting/sleep, breakfast, dinners etc. ----- No worries, you do not need to program this. But there is one thing that matters, which is that you can only finish 2.75 exams per day. In Lua there is also limit, just run this to find out: while true do end ------ Coroutines are used to pause the code when the duration takes to long. The timer is used to resume the code at a new moment. Now an impossible task can become smaller possible tasks.
  7. IIYAMA

    Timer or coroutine

    I am just wondering, Mrtasty explained what the coroutine does. But do you also understand why they are used for something like bans? Temporarily stopping code isn't something you do without a good reason.
  8. Limit is used to collect a maximal amount of results. This also allows your database to stop searching when you got the result you need. If you do not apply a limit. The database will keep searching (for example an account) even after finding it. Depending of the location of the data, you can reduce search time from 0% to 99%. LIMIT 1 If search based on row numbers: > 99% = target data is on the first row (the rest can be skipped) > 0% = target data is on the last row -------------- But in the example of MrTasty it is used to make sure that the returned table length can either be 0 or 1. Just to keep things simple. if #result == 1 then
  9. IIYAMA

    NPC

    With for example this: https://web.archive.org/web/20130728213352/http://crystalmv.net84.net/pages/scripts/npc_hlc.php
  10. IIYAMA

    please help :(

    Because there is something called "ping" (internet/network speed delay), therefore the code doesn't wait for the message to be returned. Which means that this condition will not work as it was intended for: if triggerServerEvent(--[[...]]) then Also, you forgot to include the player. Which is used in the sys function. Your main problem. triggerServerEvent("amkocworkplz", getRootElement(), localPlayer) I do not see if the fastestman function is called, so I can't validate that part.
  11. can't you be a little bit specific? ... Well, this is what I changed: local screenSize = Vector2(guiGetScreenSize()) -- Do not create textures every frame, but DO before rendering them local textures = {} for i=1, 6 do textures[i] = dxCreateTexture("assets/screen" .. i .. ".png") or "assets/screen" .. i .. ".png" -- apply a fallback in case of failing end local backgroundTexture = textures[1] function random () -- No need for tickCount if you use a timer. (unless tickCount is used for processing data) backgroundTexture = textures[math.random(6)] end setTimer( random, 30000, 0 ) local angle = 0 -- angle is missing?????????????? local function draw( ) dxDrawImage ( 0, 0, screenSize.x, screenSize.y, backgroundTexture, angle, 0, -120 ) end addEventHandler("onClientRender", root, draw)
  12. It starts with the addEventHandler, which is called in JavaScript the addEventListener. (might have been a better name) This attached handler is something that listens to events, as if it is a microphone which listens to everything you say. But there is a catch, the listener/handler does have a filter ability. It does only it's thing (calling the function attached to it, when all conditions are met. This makes sure that not every addEventHandler triggers for every event. The first filter moment is the eventName. "onPlayerJoinRoom" Only eventHandlers do trigger with the exact same event. The second filter moment is the baseElement. local baseElement = root triggerClientEvent(source, "onPlayerJoinRoom", baseElement, arg) local handlerElement = root addEvent("onPlayerJoinRoom", true) addEventHandler("onPlayerJoinRoom", handlerElement, function () end) Trigger "onPlayerJoinRoom" Rules - If the baseElement is the same as the handlerElement. OR - If the baseElement is an (indirect) child of the handlerElement. AND propagation enabled <root> <console/> <player dontRespawn="false"/> <player dontRespawn="false" lastSpawnarea=""/> <resource id="resourcebrowser"/> <resource id="assault"> <map id="dynamic"> <team/> <team/> <blip/> <marker/> <colshape/> <blip/> <blip/> </map> </resource> </root> Root parent > console child Root parent > player child Root parent > resource child Resource parent > map child Map parent > team child Map parent > marker child See element tree: https://wiki.multitheftauto.com/wiki/Element_tree Feedback Call the handler function
  13. triggerEvent("onDestroyCurrentMap",arenaSrv.players,arg) TriggerEvent is not used to be send to players or to the server. It stays on the same side as it is triggered from. so yes, the same adjustment to the code: triggerEvent("onDestroyCurrentMap",resourceRoot,arg) In case of cross resource triggering: (two different resources) addEvent("onDestroyCurrentMap", true) addEventHandler("onDestroyCurrentMap", root, function () end, true --[[ << Enable propagation ]])
  14. hmmm, Create peds and place them in the vehicle? 🤣 Recreate the vehicle Attach and detach the player on to the vehicle setPedWearingJetpack Respawn the vehicle at the same place where it blew up and move the vehicle to the right position Redirect the player, oh oh this is getting bad... https://wiki.multitheftauto.com/wiki/RedirectPlayer
  15. triggerClientEvent(arenaSrv.players,"onDestroyCurrentMap",arenaSrv.players) You filled in a table as base element. Base elements do not decide which players receive the event. They are only used for the addEventHandlers. triggerClientEvent(arenaSrv.players,"onDestroyCurrentMap",resourceRoot) addEvent("onDestroyCurrentMap", true) addEventHandler("onDestroyCurrentMap", resourceRoot, function () end, false --[[ << Disable propagation ]])