Resolved Teleport stone Lua

Alppha

Member
Alppha Rep
0
0
0
Rep
0
Alppha Vouches
0
0
0
Vouches
0
Posts
19
Likes
0
Bits
2 YEARS
2 YEARS OF SERVICE
LEVEL 1 105 XP
Anybody know any good lua script in which u will able to add so some item open gossip menu window on use , which has teleport option on which player can teleport themself?
 

Tommy

Staff
Staff
Tommy Rep
1
0
0
Rep
1
Tommy Vouches
0
0
0
Vouches
0
Posts
185
Likes
101
2 YEARS
2 YEARS OF SERVICE
LEVEL 6 310 XP
Basic script from Official Eluna scripts. Not sure how outdated but it's a good step in the direction.

Code:
local ItemId = 123 -- Item needs to have spell on use
local MenuId = 123 -- Unique ID to recognice player gossip menu among others

local function OnGossipHello(event, player, object)
    player:GossipClearMenu() -- required for player gossip
    player:GossipMenuAddItem(0, "Open submenu", 1, 1)
    player:GossipMenuAddItem(0, "Test popup box", 1, 2, false, "Test popup")
    player:GossipMenuAddItem(0, "Test codebox", 1, 3, true, nil)
    player:GossipMenuAddItem(0, "Test money requirement", 1, 4, nil, nil, 50000)
    player:GossipSendMenu(1, object, MenuId) -- MenuId required for player gossip
end

local function OnGossipSelect(event, player, object, sender, intid, code, menuid)
    if (intid == 1) then
        player:GossipMenuAddItem(0, "Close gossip", 1, 5)
        player:GossipMenuAddItem(0, "Back ..", 1, 6)
        player:GossipSendMenu(1, object, MenuId) -- MenuId required for player gossip
    elseif (intid == 2) then
        OnGossipHello(event, player, object)
    elseif (intid == 3) then
        player:SendBroadcastMessage(code)
        OnGossipHello(event, player, object)
    elseif (intid == 4) then
        if (player:GetCoinage() >= 50000) then
            player:ModifyMoney(-50000)
        end
        OnGossipHello(event, player, object)
    elseif (intid == 5) then
        player:GossipComplete()
    elseif (intid == 6) then
        OnGossipHello(event, player, object)
    end
end

local function OnPlayerCommand(event, player, command)
    if (command == "test gossip") then
        OnGossipHello(event, player, player)
        return false
    end
end

RegisterItemGossipEvent(ItemId, 1, OnGossipHello)
RegisterItemGossipEvent(ItemId, 2, OnGossipSelect)
 

Alppha

Member
Alppha Rep
0
0
0
Rep
0
Alppha Vouches
0
0
0
Vouches
0
Posts
19
Likes
0
Bits
2 YEARS
2 YEARS OF SERVICE
LEVEL 1 105 XP
ok i manage to open gossip menu up but how can i add some kinda of teleporting option to it?1678547835590.png
 

Tommy

Staff
Staff
Tommy Rep
1
0
0
Rep
1
Tommy Vouches
0
0
0
Vouches
0
Posts
185
Likes
101
2 YEARS
2 YEARS OF SERVICE
LEVEL 6 310 XP
You can do that by utilizing the teleport method within player class.

E.g.

Code:
player:Teleport( 0, x, y, z, o)

It goes: Teleport( mappId, xCoord, yCoord, zCoord, orientation )

Updated the script:
Code:
local ItemId = 123 -- Item needs to have spell on use
local MenuId = 123 -- Unique ID to recognice player gossip menu among others

local function OnGossipHello(event, player, object)
    player:GossipClearMenu() -- required for player gossip
    player:GossipMenuAddItem(0, "Teleporter", 1, 1)
    player:GossipSendMenu(1, object, MenuId) -- MenuId required for player gossip
end

local function OnGossipSelect(event, player, object, sender, intid, code, menuid)
    if (intid == 1) then
        player:GossipMenuAddItem(0, "Location 1", 1, 2)
        player:GossipMenuAddItem(0, "Location 2", 1, 3)
        player:GossipSendMenu(1, object, MenuId) -- MenuId required for player gossip
    elseif (intid == 2) then
        player:Teleport( 0, x, y, z, o)
        player:GossipComplete()
    elseif (intid == 3) then
        player:Teleport( 0, x, y, z, o)
        player:GossipComplete()
    end
end

local function OnPlayerCommand(event, player, command)
    if (command == "test gossip") then
        OnGossipHello(event, player, player)
        return false
    end
end
 
Liked By 2 members :

3,389

1,271

9,555

428

Top