- 183
- 85
- Версия MoonLoader
- .026-beta
О великие луашери! Помогите переделать скрипт чтобы активировался на /test а не на q+e буду благодарен.
aboba:
local MOP = false
local pow = 0.7
local poww = 1.9
function MOP_()
MOP = not MOP
freezeCharPosition(PLAYER_PED, MOP)
if not isCharInAnyCar(PLAYER_PED) then
setCharCollision(PLAYER_PED, not MOP)
end
end
function f(v)
return v+tonumber("0.0000"..math.random(9))
end
function main()
while not isSampAvailable() do wait(0) end
while true do wait(0)
if testCheat("QE") then
MOP_()
end
if MOP then
if isCharInAnyCar(playerPed) then
car()
else
onfoot()
end
end
end
end
function car()
repeat
freezeCarPosition = true
if isKeyDown(1) then
poww = poww + 0.001
printStringNow("~b~ speed +"..poww, 1000)
elseif isKeyDown(2) then
poww = poww - 0.001
if poww < 0 then
poww = 0
end
printStringNow("~b~ speed -"..poww, 1000)
end
local x, y, z = getCharCoordinates(PLAYER_PED)
local x1, y1, z1 = getActiveCameraCoordinates()
local head = math.rad(getHeadingFromVector2d(x-x1, y-y1))
if isKeyDown(87) then
x = x-math.sin(-head+3.14)*poww
y = y-math.cos(-head+3.14)*poww
elseif isKeyDown(83) then
x = x+math.sin(-head+3.14)*poww
y = y+math.cos(-head+3.14)*poww
end
if isKeyDown(16) then
z = z-poww/2.5
elseif isKeyDown(32) then
z = z+poww/1.9
end
local sync = samp_create_sync_data("vehicle")
sync.position = {f(x),f(y),f(z)}
sync.moveSpeed = {f(0),f(0),f(0)}
local x2,y2,z2 = getCharCoordinates(PLAYER_PED)
if x ~= x2 or y ~= y2 or z ~= z2 then
sync.moveSpeed = {f(0.05),f(0.05),f(0.05)}
end
sync.send()
setCharHeading(PLAYER_PED, math.deg(head))
setCharCoordinates(PLAYER_PED, x, y, z - 1.2)
until MOP
end
function onfoot()
repeat
if isKeyDown(1) then
pow = pow + 0.001
printStringNow("~b~ speed +"..pow, 1000)
elseif isKeyDown(2) then
pow = pow - 0.001
if pow < 0 then
pow = 0
end
printStringNow("~b~ speed -"..pow, 1000)
end
local x, y, z = getCharCoordinates(playerPed)
local x1, y1, z1 = getActiveCameraCoordinates()
local head = math.rad(getHeadingFromVector2d(x-x1, y-y1))
if isKeyDown(87) then
x = x-math.sin(-head+3.14)*pow
y = y-math.cos(-head+3.14)*pow
elseif isKeyDown(83) then
x = x+math.sin(-head+3.14)*pow
y = y+math.cos(-head+3.14)*pow
end
if isKeyDown(16) then
z = z-pow/2.2
elseif isKeyDown(32) then
z = z+pow/2.2
end
local sync = samp_create_sync_data("player")
sync.position = {f(x),f(y),f(z-1)}
sync.moveSpeed = {f(0),f(0),f(0)}
local x2,y2,z2 = getCharCoordinates(playerPed)
if x ~= x2 or y ~= y2 or z ~= z2 then
sync.moveSpeed = {f(0.09),f(0.091),f(0.071)}
end
sync.send()
setCharHeading(playerPed, math.deg(head))
setCharCoordinates(playerPed, x, y, z-1)
until MOP
end
function samp_create_sync_data(sync_type, copy_from_player)
local ffi = require 'ffi'
local sampfuncs = require 'sampfuncs'
local raknet = require 'samp.raknet'
require 'samp.synchronization'
copy_from_player = copy_from_player or true
local sync_traits = {
player = {'PlayerSyncData', raknet.PACKET.PLAYER_SYNC, sampStorePlayerOnfootData},
vehicle = {'VehicleSyncData', raknet.PACKET.VEHICLE_SYNC, sampStorePlayerIncarData},
}
local sync_info = sync_traits[sync_type]
local data_type = 'struct ' .. sync_info[1]
local data = ffi.new(data_type, {})
local raw_data_ptr = tonumber(ffi.cast('uintptr_t', ffi.new(data_type .. '*', data)))
if copy_from_player then
local copy_func = sync_info[3]
if copy_func then
local _, player_id
if copy_from_player == true then
_, player_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
else
player_id = tonumber(copy_from_player)
end
copy_func(player_id, raw_data_ptr)
end
end
local func_send = function()
local bs = raknetNewBitStream()
raknetBitStreamWriteInt8(bs, sync_info[2])
raknetBitStreamWriteBuffer(bs, raw_data_ptr, ffi.sizeof(data))
raknetSendBitStreamEx(bs, sampfuncs.HIGH_PRIORITY, sampfuncs.UNRELIABLE_SEQUENCED, 1)
raknetDeleteBitStream(bs)
end
local mt = {
__index = function(t, index)
return data[index]
end,
__newindex = function(t, index, value)
data[index] = value
end
}
return setmetatable({send = func_send}, mt)
end