Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- LeoSight.cz (c) 2021
- local hash
- function onLoad()
- for _,v in ipairs(getElementsByType("player"))do
- setElementModel(v, 1)
- end
- end
- addEventHandler("onResourceStart", resourceRoot, onLoad)
- function restartSkin()
- restartResource(getThisResource())
- end
- addCommandHandler("testskin", restartSkin, false, false)
- addCommandHandler("skintest", restartSkin, false, false)
- function math.round(number, decimals)
- decimals = decimals or 0
- local factor = 10 ^ decimals
- return tonumber(("%."..decimals.."f"):format(number))
- end
- function readFile(path)
- local file = fileOpen(path)
- if not file then
- return false
- end
- local size = fileGetSize(file)
- local data = fileRead(file, size)
- fileClose(file)
- return data, size
- end
- function fileSize(path)
- local file = fileOpen(path)
- if not file then
- return false
- end
- return fileGetSize(file)
- end
- function fileWatcher()
- local content, txdSize = readFile("skin.txd")
- if(content)then
- local newHash = md5(content)
- if(not hash)then hash = newHash end
- if(hash ~= newHash)then
- local dffSize = fileSize("skin.dff")
- local totalSize = math.round((txdSize + dffSize) / 1024 / 1024, 2)
- outputChatBox("Detekována úprava! Momentální velikost skinu: " .. totalSize .. " MB", root, totalSize > 4 and 255 or 0, totalSize <= 4 and 255 or 0, 0)
- restartSkin()
- end
- end
- end
- setTimer(fileWatcher, 2000, 0)
- local testPed
- function spawnSkinPed()
- testPed = createPed(1, -2416.16821, -599.30127, 132.56250, 0, true)
- if testPed then
- setElementFrozen(testPed, true)
- end
- end
- addEventHandler("onResourceStart", resourceRoot, spawnSkinPed)
- function teleportPed(thePlayer, cmd)
- if testPed and getElementType(testPed) == "ped" then
- local x, y, z = getElementPosition(thePlayer)
- local rx,ry,rz = getElementRotation(thePlayer)
- setElementPosition(testPed, x+1, y, z)
- setElementRotation(testPed, rx, ry, rz)
- end
- end
- addCommandHandler("moveped", teleportPed, false, false)
Advertisement
Add Comment
Please, Sign In to add comment