Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. 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.
  2. 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
  3. 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
  4. Locked for using a leaked resource without permission.
  5. 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.
  6. 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)
  7. 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)
  8. 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
  9. + do that per rectangle. Because you do not know which one is in which one.
  10. You can use this enchantment, if you really NEED that:
  11. 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.
  12. 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
  13. 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.
  14. 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.
  15. In that case you should also respect other people their time.
  16. What you can change is learning the basics of Lua, so that you read code and understand that copying and pasting more advance code is not clever...
  17. What is this entire topic all about if you haven't even wrote a single line of code? Also not even debug and validate the code in a single way? If you did not come here to script, please go discus this in a personal message with the one that did donate the code. This section is not for requesting free code, it is for learning how to code.
  18. IIYAMA

    help

    You could disable the element. https://wiki.multitheftauto.com/wiki/GuiSetEnabled
  19. IIYAMA

    help

    Triggers can't be deleted, only prevented by not trigger them.
  20. No, but you might need to apply a delay between line 5 and 6, if you think it is necessary.
  21. I see line 6 cancelling line 5? There is absolutely no logic in that. Did you call this function before you did that? (to put a stop to the rendering process) setCustomCameraTarget()
  22. So you did this clientside: setCustomCameraTarget() On serverside you did this: setCameraTarget(player, player) What is the delay between those two actions? Did you try to apply them after each other with a delay of 2 seconds?
  23. Which methods/implementations are use for that?
  24. The issue is caused by not keeping an eye on state changing. The camera status can be changed by resources, but also by MTA conditions (for example dying). If you want to force setCameraMatrix you will need to repeat that process every frame to prevent any interruption. So you could create a resource which will manage all camera statuses and prevent any interruption. And even add extra custom ones. Like moving a camera from position to position.(cinematic effect)
  25. You are 'thinking' that the variables are being send over, which is not the case. You can only send the data, which can gets stored in to new variables. Data goes in here: triggerClientEvent(source, 'ResultsDataB', resourceRoot, IN1, IN2, IN3); and come out here: addEventHandler('ResultsDataB', resourceRoot, function(OUT1, OUT2, OUT3) By using the same variable names, you can indeed pretend that you did send them over.
×
×
  • Create New...