Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 20/11/19 in all areas

  1. 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 ]])
    1 point
  2. 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
    1 point
  3. Hmm, I did not even think to just remove the check, that could work... I was also thinking before I went to bed about just teleporting the player Thank you, I will give these both a shot and report back my results
    1 point
  4. 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 ]])
    1 point
  5. I got it, thanks so much. I wasn't aware that trigger allows to use tables as argument instead players. I will take care about using root. Looks like is not a good choice if im dealing with different rooms which practical need to send few datas. Thanks newly
    1 point
  6. Faltou a primeira variável retornada pelo processLineOfSight. O primeiro valor retornado é um booleano que indica se a linha colidiu em algo, o segundo valor dai sim é o X onde a linha colidiu. Outra coisa: Você definiu pra ele não detectar construções, ou seja, atravessar por elas até encontrar um jogador. Isso significa que se um jogador mirar na cabeça de outro jogador e atirar através de uma parede, vai considerar como HeadShot. local hit, x, y, z, hitElement, xx, yy, zz, _, _, piece = processLineOfSight (startX, startY, startZ, hitX, hitY, hitZ, true, false) -- Não precisa declarar a detecção de players como true, pois ela já é true por padrão. Só declare se for usar como false ou então se for usar algum parâmetro seguinte. if (hit) then -- Se a linha colidiu em algo, então: (caso contrário, todas as demais variáveis serão nil) if (getElementType (hitElement) == "player") then -- Se o elemento em que a linha colidiu for um jogador, então: if (piece == 9) then -- Se a linha colidiu na cabeça desse jogador, então: -- Com HS. else -- Sem HS. end end end
    1 point
  7. You do not need to use a loop, you can also provide a table with players as the first argument. When streaming data, root is perfect. But for bring data from one side to the otherside, with the purpose to help with initial loading (prepare the client before using the resource), making use of the root might be a bad idea. You have no guarantee that the client has loaded his resource, which means you do not know if he can receive it. In that case you only want to send a message to the players that have downloaded and loaded the resource. client > onClientResourceStart > triggerServerEvent > server > add the player to the the table 'loadedPlayers = {}' + send all the server-to-client initial data > triggerClientEvent > client
    1 point
  8. I made something simple for you, play around with it and it should help you to understand Server: local bag = { locations = { --Store your bag locations here {x = 1547.68, y = -1348.78, z = 329.46}, --Tallest building {x = 2495.12, y = -1689.36, z = 14.38} --CJs house } } function bag.spawn(x,y,z) x,y,z = x or 0, y or 0, z or 0 bag.pickup = createPickup( x, y, z, 3, 1550 ) setElementCollisionsEnabled( bag.pickup, false ) end function bag.init(minutes) --bag.create(int minutes) if not minutes or isTimer(bag.timer) or isElement(bag.pickup) then return false end --If there is currently a timer, or a bag spawned on the map, then we can't create a new timer/bag bag.timer = setTimer (function() local loc = bag.locations local i = math.random(1,#loc) --Pick a random bag location from bag.locations bag.spawn(loc[i].x,loc[i].y,loc[i].z) --Spawns the bag. Here we're using a random bag location but you can just define your own x,y,z positions. Random location is optional end, (60*1000*minutes), 1) triggerClientEvent(getRootElement(), "createBagTimer", getRootElement(), minutes) --Setup new bag timer for all clients end addEvent("onBotWasted",true) addEventHandler("onBotWasted", root, function (killer) if (source == nemesilv) then destroyElement(BlipNemesislv) bag.init(20) --Makes a bag spawn after 20 minutes and sets everything up. end end) addEventHandler("onPickupHit", root, --A player picked up the bag function(player) destroyElement(bag.pickup) --Destroy bag pickup local name = getPlayerName(player) outputChatBox(name.." picked up the bag!") -- do whatever you want here end) Client: local sX,sY = guiGetScreenSize() local timerW, timerH = 150,100 local timerX, timerY = (sX / 2) - (timerW / 2), (sY*0.9) - (timerH / 2) --Position of the timer on screen local bag = {} function bag.dx() if not isTimer(bag.timer) then removeEventHandler("onClientRender", root, bag.dx); return end local clock = convertToClock(bag.timer) --Get the timer remaining in clock format dxDrawText("Next Bag In: "..clock, timerX, timerY, timerX+timerW, timerY+timerH, tocolor(255,0,0,225), 2, "default-bold", "center", "center") end function convertToClock(theTimer) --Returns timer in a clock format (e.g: "19:57"), returns false if timer doesn't exist if not isTimer(theTimer) then return false end local remaining = getTimerDetails(theTimer) -- Get the timers remaining (ms) local s = remaining/1000 --seconds from ms return string.format("%.2d:%.2d", s/60%60, s%60) --convert to clock format and return end function bag.setupTimer(minutes) bag.timer = setTimer(function() bag.timer = nil end, (60*1000*minutes), 1) addEventHandler("onClientRender", root, bag.dx) --Start drawing the timer on the clients screen end addEvent("createBagTimer", true) addEventHandler("createBagTimer", root, bag.setupTimer) Any questions, shoot!
    1 point
×
×
  • Create New...