-
Posts
6,058 -
Joined
-
Last visited
-
Days Won
208
Everything posted by IIYAMA
-
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.
-
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)
-
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
-
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 ]])
-
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
-
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 ]])
-
You can also remove the ped from the vehicle even if he is not in a vehicle. The function will simply return false in that case. Not sure if that solves the whole issue. You could also re- set the player position with setElementPosition. But remember to disable the warp argument, else they become zombies ?. https://wiki.multitheftauto.com/wiki/SetElementPosition
-
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
-
GJ! Some suggestions: You could move not supported elements to custom elements, so that spawn points ect, are maintained. https://wiki.multitheftauto.com/wiki/CreateElement ------ <sync_map_element_data> In some cases you want elementdata to be applied to the elements. (Especially the custom ones).
-
Locked for misusing this section to produce scripts. This topic is also very old. @komal
-
[HELP] Passing an Element using a Global Variable
IIYAMA replied to ReZurrecti0n's topic in Scripting
No problem, enjoy Once you have mastered the table completely, serverside scripting will become less of a challenge. One last tip: be more consistent with locals. (Line 4) Those keep things clean and tidy. -
[HELP] Passing an Element using a Global Variable
IIYAMA replied to ReZurrecti0n's topic in Scripting
So there is just one state ON and OFF? Or are the more states in visibility? Like: On map showing Tag showing In order to make it easier. Set a default state: visibility = false Do your checks, if YES do: visibility = true add the ped to the table If visibility == false, remove the ped from the table. function Seconds() local f1, f2, f3= getCameraMatrix() for l,t in ipairs(getElementsByType("ped"))do local f4,f5,f6=getElementPosition(t) local visible = false -- by default the ped is not visible -- Do your checks. if(getDistanceBetweenPoints3D(f1,f2,f3,f4,f5,f6)<=25.0)then if(isLineOfSightClear(f4,f5,f6,f1,f2,f3+2))then local f7,f8=getScreenFromWorldPosition(f4,f5,f6+1) if(f7)and(f8)then -- Ped is visible visible = true -- set the state -- Add the ped to the table if not added yet. if not PlayerVisible[t] then outputChatBox("TM: #FFFFFFPoint D!",255,150,50,true)-- This point IS reached... PlayerVisible[t] = true-- Still working this... !!! end --PlayerVisible[t][id]="NPC" -- Once point Z is reached, then I'll worry about this stuff --PlayerVisible[t][name]="Bill" -- Once point Z is reached, then I'll worry about this stuff end elseif(PlayerVisible[t])then-- Ped no longer in L.O.S. outputChatBox("TM: #FFFFFFPoint 1!",255,0,0,true) end elseif(PlayerVisible[t])then-- Ped no longer in Range outputChatBox("TM: #FFFFFFPoint 2!",255,0,0,true) end -- Clear the ped from the table if not visible and in the table if not visible and PlayerVisible[t] then PlayerVisible[t] = nil end end -- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --collectgarbage() -- < REMOVE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! end And remove destroyed elements from the table. Lua does not know if an element exist or is destroyed. function ClientRender()-- This event is constantly called, it's not wise to add anything here unless you have NO other choice... You were warned! for l,t in pairs(PlayerVisible)do if isElement(t) then outputChatBox("TM: #FFFFFFPoint Z!",255,150,50,true)-- Not reaching this point... ((( With the noted changes, I now reach Point Z ))) else PlayerVisible[t] = nil -- if the element is destroyed, clear the data end end end -
Also don't forget to convert strings to numbers, when typing the command. (+ fallback) R, G, B = tonumber(r) or 255, tonumber(g) or 255, tonumber(b) or 255
-
Locked for using a leaked resource without permission.
-
[HELP] Passing an Element using a Global Variable
IIYAMA replied to ReZurrecti0n's topic in Scripting
Currently you are looping through the selecting of players that only have the statement. Are the once that are removed also players that didn't even have the statement in the first place? Depending on that answer I can give you the right solutions. -
Also the moment for adding and removing the event can be better. + check if the event is triggered. local displayDevTimer addEventHandler("onClientMapStarting",root,function () iprint("onClientMapStarting is triggered") if isTimer(displayDevTimer) then resetTimer(displayDevTimer) iprint("resetTimer") else addEventHandler("onClientRender",root,render) iprint("addEvent") displayDevTimer = setTimer(function () removeEventHandler("onClientRender",root,render) displayDevTimer = nil iprint("removeEvent") end,5000,1) end end)
-
Probably out of the screen. dxDrawText doesn't require width and height. It needs a start-point(x1,y1) and end-point(x2,y2). Between those points is the box where your text is placed. local startX, startY = 0, sY - (sY*0.5) local endX, endY = sX, sY dxDrawText("Alpha 1.0.2 still work on Developer",startX, startY, endX, endY, tocolor(255,255,255,230),tables.fontSize,tables.font,"center","center",false) (I can't figure out the text position based on your code)
-
[HELP] Passing an Element using a Global Variable
IIYAMA replied to ReZurrecti0n's topic in Scripting
This for l,t in ipairs(PlayerVisible)do will only loop through items, BUT only items that are stored as an array. {[1] = player, [2] = player, [3] = player} -- array structure -- OR {player, player, player} To solve that issue we can use pairs, instead of ipairs. This function doesn't care if items are stored as an array. {[player] = true, [player] = true, [player] = true} -- your structure So do this instead: for l,t in pairs(PlayerVisible)do -
+ do that per rectangle. Because you do not know which one is in which one.
-
You can use this enchantment, if you really NEED that:
-
It is to me unclear what format the algorithm could be beside tea. So I personally probably wouldn't use it yet, unless I know all the options. But to really answer your question, I don't think there is a big difference at the very end. You are still having 1 key and both functions are provided by MTA. More layers of protection will not help you unless you can make sure that the steps are harder to trace back. One way is to combine client storage with a network message. 1 extra step to make it harder The client has a RAW key. The server has a key. The server sends his key. The client just before decrypting uses the server key to change the RAW key in to the real key. This way the client can't decrypt the files without being connected to your game server. (at least if the key isn't network sniffed before) Why should the client have a key in the first place? If the server sends the only key every time over, there is more risk in it being network sniffed. And don't forget you can use the player serial as salt. This information can't be network sniffed when it is only implemented clientside. 3 risks you have to counter Wiki Packet analyzer Wiki Cheat engine (or something similar) Wrapper functions. Make sure that the script can only be functional with your serverside.
-
It is complex, make sure that your scripting level as well as you arithmetic level is ready for hel(p!)l, I think? If you need some inspiration/options: https://web.archive.org/web/20161128104638/http://crystalmv.net84.net/pages/scripts/npchlc_traffic_editor.php https://web.archive.org/web/20160716203517/http://crystalmv.net84.net/pages/scripts/npchlc_traffic.php https://web.archive.org/web/20170123100149/http://crystalmv.net84.net/pages/scripts/npc_tseq.php
-
It is not possible based on health loss as you noticed. If you want this, you need to apply an overwrite. For explosion you can cancel the explosion event. Replace the explosion with create createexplosion + damage disabled. After that calculate the damage based on the distance. Do this for players, peds and vehicles. Weapon damage is a bit easier, just maintain a static damage value per weapon. (With custom conditions if you desire that). Fire and fall damage are the only damage types that can't be managed very well.
-
It makes the data portable across different applications and storing solutions. In some cases your raw data can break the application, while it will not in the base64 format. For example you can embed with this format images(png/jpg/svg) within your HTML and CSS files. Also it is widely supported by W3C across the web.