Jump to content

Overkillz

Members
  • Posts

    545
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Overkillz

  1. @IIYAMA I mean protection from the loaded string. Which one should be the way/ways that people can try to steal something (I don't care about dff, txd ...etc | Only scripts) @Ayush Rathore Im already aware about Bonsai's MGM but Im not interested on using his code. I want to learn how does the things work and @IIYAMA is one of the guys who explains such things very detailed. Regards.
  2. Well, I have done some test and looks that it is getting a better look. Btw, which one should be the way to test if my code is vulnerable to be read by those codes ? Tried with fileOpen, fileread ...etc but not success. (Obyously, the enviroment is removed during this test.)
  3. but what about if I want to block some variables/arrays ?
  4. Check out this. Might it helps you setElementSyncer
  5. Overkillz

    anti afk

    Im not partidary of doing the code for other people who don't even try to do it, but you are a lucky day. BTW: Not tested I bassed anti-afk keys assuming that the player is in vehicle due to I have never worked about the movement of player out the vehicle. local afkTime = 30 --In Minutes local antiAFKkeys = {"accelerate", "vehicle_left", "vehicle_right", "brake_reverse"} --Check out more keys at https://wiki.multitheftauto.com/wiki/Key_names kickerTimer = setTimer(function() triggerServerEvent("onkickPlayerFromServer",localPlayer) end,afkTime*1000*60,1) function afkReset() resetTimer(kickerTimer) end do for i,key in ipairs(antiAFKkeys) do bindKey ( key, "down", afkReset ) end end --##Server Side function kickPlayerFromServer() kickPlayer (source) outputChatBox(getPlayerName(source).." #ffffffhas been kicked by ANTI-AFK BOT",root,255,255,255,true) end addEvent("onkickPlayerFromServer",true) addEventHandler("onkickPlayerFromServer",getRootElement(),kickPlayerFromServer) Regards.
  6. @IIYAMA Well, as far as I read pcall executes the string and if it detecs an error it just ignores it. So, the code should be like this local resourceRoot = createElement("resourceRootFaked") local enviroment = {} local blockedFunctions = { ["enviroment"] = true, ["newEnviroment"] = true, } function newEnviroment() enviroment = {} for name, valor in pairs(_G) do if not blockedFunctions[name] then enviroment[name] = valor end end end function runScript(scriptData, executeIt) newEnviroment() local loaded = loadstring(script) local ex = pcall(loaded) setfenv(ex, enviroment) if ex then if executeIt then triggerEvent("onClientResourceStart", resourceRoot, getResourceFromName("scriptLoaderResource")) end end end
  7. Well, I have just came at home to try it and Im still having the same issue with for example, playSound. The sound is executed more than one time, even if the scripts data are merged and I cant figure out why does it happen. local cachePath = "tempCache" local scriptList = {"client.lua","water.lua","shaders.lua"} function scriptRead() local scriptData = "" for i,mapScripts in ipairs(scriptList) do local file = fileOpen(cachePath.."/"..mapScripts) if not file then error("Not file found") return end while not fileIsEOF(file) do scriptData = scriptData .. "\n do \n" .. fileRead(file, fileGetSize(file)) .. "\n end \n" end fileClose(file) if i == #scriptList then exports.scriptLoaderResource:runScript(scriptData, true) end end end function runScript(scriptData, executeIt) local loaded = loadstring(script) local ex = pcall(loaded) if ex then if executeIt then loaded() triggerEvent("onClientResourceStart", resourceRoot, getResourceFromName("scriptLoaderResource")) end end end Probably the issue is on the triggerEvent, but I don't use it, the scripts are not executed. Weird no ? Regards.
  8. @IIYAMA How can I merge all of them with do ... end The only way I have learned currently is to add the new data to a string local scriptDataString for i,loopData in ipairs(whatever) do scriptDataString = scriptDataString.."\n"..loopData end
  9. @DizzasTeR Alright, got it. Thats why I was asking you several questions about it. Thanks ^^, & regards.
  10. Hello dear community. Some time ago I started to work with loadstring and load functions. Nowadays I've realized that I got some issue with load so I decided to chose loadstring to reach my purpose. I have read some @IIYAMA topics and other people which had a similar problem some months/years ago, but sadly. I couldn't get the solution. I have currently 2 resource. One is to create the maps, gets the map files, scripts, store them in the cache ...etc, lets call it (MapCreator) and the other one is to execute the map scripts, lets call it (scriptRunner). Well, I have done a little version of them to make it more understable. I have found some problems with the mapCreator. to be clear, the whileIsEOF part. If I comment this part, the script runs correctly, but If I leave them uncommented, it doesn't read the script file. --##MapCreator local cachePath = "tempCache" local scriptList = {"client.lua","water.lua","shaders.lua"} function scriptRead() for i,mapScripts in ipairs(scriptList) do local scriptData local file = fileOpen(cachePath.."/"..mapScripts) if not file then error("Not file found") return end while not fileIsEOF(file) do scriptData = fileRead(file, fileGetSize(file)) end fileClose(file) if i == #scriptList then exports.scriptLoaderResource:runScript(scriptData, true) return end exports.scriptLoaderResource:runScript(scriptData, false) end end Well, on the other hand, at (scriptRunner). I have read that enviroments bring you more security to prevent that other people stole or execute your scripts. Im not sure if Im following the right way to run map scripts (Obyously no. Because sometimes in a X map. the song is executed like 3 times at the sime time) and Im not sure if the enviroments must be created like in my code. local enviroment = {} local blockedFunctions = { ["enviroment"] = true, ["newEnviroment"] = true, } function newEnviroment() enviroment = {} for name, valor in pairs(_G) do if not blockedFunctions[name] then enviroment[name] = valor end end end function runScript(scriptData, executeIt) newEnviroment() local loaded = loadstring(script) local ex = pcall(loaded) if ex then if executeIt then loaded() triggerEvent("onClientResourceStart", resourceRoot, getResourceFromName("scriptLoaderResource")) outputDebugString("Scripts Executed") end else outputDebugString("Not Executed") end end I hope you can help me to fix the issue that if the map has a script that play a song, it doesn't get execute more than 3 times (And not, on the script is only executed one time. It is a problem of my code.).And, can you tell me if the enviroments must be created like this ? I have to clean them or something when I change the map. And, how can I stop the runned scripts? I know that just setting the loaded variable as nil it should work but. How to deal properly with it. PS: the scripts that are inside the array scriptList are correctly coded. Thanks for reading. Best regards.
  11. Thats what Im doing from the beginning, the tick starts when the trigger has arrived at clientside, but anyways some miliseconds are missing. I know that the difference is practically inapreciable, but, I want a perfect time.
  12. @DizzasTeR Well, but here are few questions respecting that. If I create a vehicle at serverside and I want to freeze it at client side, I must use a trigger. During that short time, the car could be moved by the player. Possible Solutions: Use toggleAllControls or play with more thatn a single trigger If I create the vehicle clientside. The vehicle won't be visible for the rest of players. Possible solutions: Deal with more than a single trigger or use setElementSyncer(But this has some limitations as far as I could read at the wiki) The best way I can use to avoid several triggers is toggleAllControls right ? Regards.
  13. @DizzasTeR Yes, I've already tried this, but If I freeze the vehicle serverside (When the player spawns ...etc) and later I unfreze the vehicle at client side, It causes the following issue. I already know that I can use a setTimer to do a triggerServerEvent and unfreze the vehicle server side after it has been unfreze at clientside, but my question is, there is a better way to reach it ? (I know it sounds weird.) Will I get a problem If i unfreze a vehicle that is not frozen ? (Not at home to test it)
  14. @pa3ck & @Ab-47 How to suppose to I do that ? In my mind I can only get that I must be aware about the exactly milisecond of server side and client side, but I bet that bot or them aren't running exactly the same one. What I mean ? Imagine, server time is: 13 hours, 42 minutes, 31 seconds and 931 miliseconds client time is: 12 hours, 42 minutes, 17 seconds and 351 miliseconds. There is not way to reach it by using getRealTime as far I can understand.
  15. Overkillz

    anti afk

    There are already a lot of anti-afk resources around the community. Just take some time to search one of them. Otherwise, you can build your own one using bindKey setTimer
  16. Overkillz

    Question

    Probabilly you need to record te whole movement track. and use the following functions setElementPosition setElementVelocity setVehicleTurnVelocity Might some thing is missing.
  17. Im just spawning the players and their vehicles (Frozen) at server side to later, in a determinated (when the race round starts) unfreze them. immediately I do a triggerClientEvent to start the timepassed of the race to calculate their toptimes. Obyously this must be at client side to do some draws ...etc I know that I can unfreze the vehicles at clientside, but, this is what happen if I do it Regards. PS: I already tried to use setElementSyncer(theVehicle,false) but it doesn't work
  18. I recommend you to read the following topic too due to I've got some issues while trying to set a cameraMatrix to a deathPlayer Regards.
  19. @IIYAMA I know I've left the topic moved off but, what about this. i've been doing some research about an efficent way and might I found it and I would like to hear your suggestion. What about if before I do the trigger I set to the player an elementData as getTickCount() and later check it on the client side and calculate the delayed time. Lets check a draft code. --##SERVER function whateverItIsServerSide() local startTick = getTickCount() setElementData(thePlayer,"startTick",startTick,true) -- Obyously the player must be defined previously ... triggerClientEvent(thePlayer,"whateverFunctionClientName",thePlayer) end --##CLIENT function clientSideWhateverName() local serverTick = getElementData(localPlayer,"startTick") if serverTick then local delayedTime = getTickCount() - serverTick outputDebugString("The Delayed Time should be: "..delayedTime) end end addEvent("whateverFunctionClientName",true) addEventHandler("whateverFunctionClientName",getRootElement(),clientSideWhateverName) I would like to hear your opinion. Thanks for reading and regards.
  20. Hello dear community. Some weeks ago Im started to work with renderTarget more than the usual I used to do it and I've got 2 questions about it. Well, the first question is that. If I created a renderTarget with x/y size.While the size is bigger, is the Performance will be affected or it is going to be the same everytime ? And the second one, whats the goal to not to use a created renderTarget with the maximum size of the screen and later use dxDrawImageSection ?¿ It is even easier to work with dxButtons or things like that instead recode your typical "cursor hover button code" Here I post 2 examples that practically do the same thing In the case I wanted to work on the 20% of the screen. local sX,sY = guiGetScreenSize() -- ##OPTION 1 local sizeX,sizeY = sX*0.2,sY*0.2 local sizedRenderTarget = dxCreateRenderTarget(sizeX,sizeY,true) function drawSizedRenderTarget() dxSetRenderTarget( sizedRenderTarget ) --DRAW STUFFs dxSetRenderTarget() dxDrawImage.. -- Draw the renderTarget end addEventHandler("onClientRender",root,drawSizedRenderTarget) --##OPTION 2 local fullScreenRenderTarget = dxCreateRenderTarget(sX,sY,true) function drawFullScreenRenderTarget() dxSetRenderTarget( fullScreenRenderTarget ) --DRAW STUFFs dxSetRenderTarget() dxDrawImage.. -- Draw the renderTarget end addEventHandler("onClientRender",root,drawFullScreenRenderTarget) Thanks for reading. Regards.
  21. You can start a local variable adding a number. Practically you can use any number to start a line Remplace it for local
  22. function check ( player, seat, jacked ) if getElementData(source, "privado") then if getElementData(source, "owner") ~= getAccountName(getPlayerAccount(player)) then cancelEvent() outputChatBox("Este vehículo no es tuyo.", player) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), check ) function aduenar(thePlayer, seat, jacket) local playerName = getPlayerName(thePlayer) local playerAccount = getAccountName(getPlayerAccount(thePlayer)) or false if playerAccount then setElementData(source,"privado",true) setElementData(source,"owner",playerAccount) outputChatBox("Este auto ahora es de: "..playerName, thePlayer) end end addEventHandler ( "onVehicleEnter", getRootElement(), aduenar ) Not tested. Anyways you should avoid using Ñ. Might it drops you an error while players are not logged (Guest) No lo he testeado, tal vez te salte un error en el check con un jugador q no este logeado.
  23. @IIYAMA I've just tried it and practically I can't apreciate the difference. There isn't a big different between the common method and the previous ones mentioned. Anyways, looks like I will be forced to use setTimer due to load player datas, create shaders, textures ...etc Thanks for it. Might I can implement it on my map Loader. Regards.
  24. In fact there is not any different between your code and mine one. Adding the objects into another table doesn't guarantee you that the objects is loaded.
  25. Hello dear community, today I would like to ask you if there is a way to check when the objects are totally loaded. For example, the first things that I do is to remove world objects. Later, I created an amount of objects and set a cameraMatrix and at the end of it fade the camera to see it but while the camera is loading or is loaded, some objects are being loaded. What do I mean with loaded ? Objects goes from invisible to visible. I wont use setTimer to delay the fadeCamera. Im just asking if there is a way to do it for i=550,20000 do removeWorldModel(i,10000,0,0,0) end setOcclusionsEnabled(false) setWaterLevel(-5000) for k,objects in ipairs(garageObjects) do -- garageObjects table is already defined and with values local a,b,c,d,e,f,g,h,i = unpack(objects) local object = createObject ( a,b,c,d,e,f,g ) setObjectScale(object,h or 1) setElementDoubleSided(object, i or false ) setElementDimension(object,arenaCDimension) end fadeCamera(true) I hope you can bring me a hand with it. EXTRA QUESTION: setGarageOpen function has already built some objects by default ? I mean objects like some wheels, vehicle parts ... or whatever Thanks for reading, regards.
×
×
  • Create New...