Teleport Samp

Статус
В этой теме нельзя размещать новые ответы.

Forfeit

Участник
Автор темы
69
12
Всем привет, не могли бы вы подсказать как переделать данный скрипт, чтобы при команде /tp телепортировало на одни координаты, указанные мной, а при команде /tp1 телепортировало на другие координаты?
Код:
local sampev = require 'lib.samp.events'


function main()
 
    repeat wait(0) until isSampAvailable();
    sampRegisterChatCommand("tp", function()
    result, x, y, _ = getTargetBlipCoordinates()
    if result then lua_thread.create(teleport)
    else sampAddChatMessage(" {ffc60a}[Teleport] {ff7070}Поставь метку!", -1) end end)
    wait (-1)
end


function teleport()
    activate = true
    requestCollision(x,y)
    loadScene(x,y,z)
    setCharCoordinates(PLAYER_PED, x,y,-999.0)
    sampRequestClass()
    wait (2000)
    activate = false
end


function sampev.onRequestClassResponse()
    if activate then
    return false else return true
end end

function sampev.onRequestSpawnResponse() 
    if activate then
    return false else return true
end end

function sampev.onSetPlayerPos()
    if isCharInAnyCar(PLAYER_PED) and activate then
        return false else return true end
end
Кстати скрипт рабочий, работает может на многих топовых проектах, если не с ног, то с транспорта точно работает. Забирайте кому нужно)
 
  • Нравится
Реакции: trxpboi

trxpboi

Участник
98
5
Чтобы при команде /tp телепортировало на одни координаты, указанные мной, а при команде /tp1 телепортировало на другие координаты?
Как ты хочешь указывать разные координаты, ставить второй раз Блип, или что?
 

trefa

Известный
Всефорумный модератор
2,097
1,231
на адвансе/даймонде кикает
А ты думал тут супер приватный скрипт?
Всем привет, не могли бы вы подсказать как переделать данный скрипт, чтобы при команде /tp телепортировало на одни координаты, указанные мной, а при команде /tp1 телепортировало на другие координаты?
Код:
local sampev = require 'lib.samp.events'


function main()
 
    repeat wait(0) until isSampAvailable();
    sampRegisterChatCommand("tp", function()
    result, x, y, _ = getTargetBlipCoordinates()
    if result then lua_thread.create(teleport)
    else sampAddChatMessage(" {ffc60a}[Teleport] {ff7070}Поставь метку!", -1) end end)
    wait (-1)
end


function teleport()
    activate = true
    requestCollision(x,y)
    loadScene(x,y,z)
    setCharCoordinates(PLAYER_PED, x,y,-999.0)
    sampRequestClass()
    wait (2000)
    activate = false
end


function sampev.onRequestClassResponse()
    if activate then
    return false else return true
end end

function sampev.onRequestSpawnResponse()
    if activate then
    return false else return true
end end

function sampev.onSetPlayerPos()
    if isCharInAnyCar(PLAYER_PED) and activate then
        return false else return true end
end
Кстати скрипт рабочий, работает может на многих топовых проектах, если не с ног, то с транспорта точно работает. Забирайте кому нужно)
Lua:
coord = {
{1--[[x]],1--[[y]],1--[[z]]},
{2--[[x]],2--[[y]],2--[[z]]},
{3--[[x]],3--[[y]],3--[[z]]}
}


local sampev = require 'lib.samp.events'


function main()
    repeat wait(0) until isSampAvailable();
    sampRegisterChatCommand("tp", function(param)
        if tonumber(param) ~= nil then
            if coord[tonumber(param)] ~= nil then
                x, y, z = coord[tonumber(param)][1],coord[tonumber(param)][2],coord[tonumber(param)][3]
                lua_thread.create(teleport)
            else
                sampAddChatMessage(" {ffc60a}[Teleport] {ffffff}Используй: /tp [1-"..#coord.."]", -1)
            end
        else
            result, x, y, z = getTargetBlipCoordinates()
            if result then
            lua_thread.create(teleport)
            else
                sampAddChatMessage(" {ffc60a}[Teleport] {ff7070}Поставь метку!", -1)
            end
        end
    end)
    wait (-1)
end


function teleport()
    activate = true
    requestCollision(x,y)
    loadScene(x,y,z)
    setCharCoordinates(PLAYER_PED, x,y,-999.0)
    sampRequestClass()
    wait (2000)
    activate = false
end


function sampev.onRequestClassResponse()
    if activate then
    return false else return true
end end

function sampev.onRequestSpawnResponse()
    if activate then
    return false else return true
end end

function sampev.onSetPlayerPos()
    if isCharInAnyCar(PLAYER_PED) and activate then
        return false else return true end
end
 
  • Нравится
Реакции: Forfeit и trxpboi

Forfeit

Участник
Автор темы
69
12
А ты думал тут супер приватный скрипт?

Lua:
coord = {
{1--[[x]],1--[[y]],1--[[z]]},
{2--[[x]],2--[[y]],2--[[z]]},
{3--[[x]],3--[[y]],3--[[z]]}
}


local sampev = require 'lib.samp.events'


function main()
    repeat wait(0) until isSampAvailable();
    sampRegisterChatCommand("tp", function(param)
        if tonumber(param) ~= nil then
            if coord[tonumber(param)] ~= nil then
                x, y, z = coord[tonumber(param)][1],coord[tonumber(param)][2],coord[tonumber(param)][3]
                lua_thread.create(teleport)
            else
                sampAddChatMessage(" {ffc60a}[Teleport] {ffffff}Используй: /tp [1-"..#coord.."]", -1)
            end
        else
            result, x, y, z = getTargetBlipCoordinates()
            if result then
            lua_thread.create(teleport)
            else
                sampAddChatMessage(" {ffc60a}[Teleport] {ff7070}Поставь метку!", -1)
            end
        end
    end)
    wait (-1)
end


function teleport()
    activate = true
    requestCollision(x,y)
    loadScene(x,y,z)
    setCharCoordinates(PLAYER_PED, x,y,-999.0)
    sampRequestClass()
    wait (2000)
    activate = false
end


function sampev.onRequestClassResponse()
    if activate then
    return false else return true
end end

function sampev.onRequestSpawnResponse()
    if activate then
    return false else return true
end end

function sampev.onSetPlayerPos()
    if isCharInAnyCar(PLAYER_PED) and activate then
        return false else return true end
end
Спасибо большое, чувак!
 
Статус
В этой теме нельзя размещать новые ответы.