CLEO Help Map Icon Teleporter

CLEO related

aPELAobr

Active member
Joined
Jan 13, 2015
Messages
185
Reaction score
0
I believe this mod does not exist, but what I am looking for is a mod that makes it possible to teleport to a map icon (burger, shirt, spray, etc). Defining via command the ID of the Map Icon to be teleported. For example, the burger shot is ID 10, so with "/tp 10" I would be teleported to the coordinates of this map icon
 

aPELAobr

Active member
Joined
Jan 13, 2015
Messages
185
Reaction score
0
first of all thanks for this, Tuzas!

i have a newb doubt here..

1655910665527.png

do i need to set at "youriconid" the mapicon i want to teleport (ID 19)? the activation is with "/tp 19"? it's not working for me, that's why i'm with this doubt.. I'm using SAMP R3 but both moonloader and sampfuncs works fine
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
456
Solutions
9
Reaction score
165
Location
Poland
ID 19
Icon_19.gif

 

aPELAobr

Active member
Joined
Jan 13, 2015
Messages
185
Reaction score
0
got it already :) but what's happening is that it's automatically teleporting to the ID 19 and i need at least a key or command to do that, i tried:

C++:
local sampev = require 'lib.samp.events'
local youriconid = 0
function main()
    while not isSampAvailable() do wait(0) end
      
    while true do
        wait(0)
      
    end
end
function sampev.onSetMapIcon(iconId, position, type, color, style)
    if isKeyPressed(46) and type == youriconid then   
        posx = position.x
        posy = position.y
        posz = position.z
        setCharCoordinates(PLAYER_PED, posx, posy, posz)
        end
end

but nothing happens
 

aPELAobr

Active member
Joined
Jan 13, 2015
Messages
185
Reaction score
0
got it already :) but what's happening is that it's automatically teleporting to the ID 19 and i need at least a key or command to do that, i tried:

C++:
local sampev = require 'lib.samp.events'
local youriconid = 0
function main()
    while not isSampAvailable() do wait(0) end
     
    while true do
        wait(0)
     
    end
end
function sampev.onSetMapIcon(iconId, position, type, color, style)
    if isKeyPressed(46) and type == youriconid then  
        posx = position.x
        posy = position.y
        posz = position.z
        setCharCoordinates(PLAYER_PED, posx, posy, posz)
        end
end

but nothing happens
forgot ID in this code but in the game i didn't**
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
456
Solutions
9
Reaction score
165
Location
Poland
PHP:
local sampev = require 'lib.samp.events'
local youriconid = 52 -- Robbery

function main()
    while not isSampAvailable() do wait(0) end
     
    while true do
        wait(0)
        if isKeyDown(88) -- X key
        then
            toggle = not toggle
            if toggle
            then printStringNow('~w~Script ~g~ON', 1337)
            else printStringNow('~w~Script ~r~OFF', 137)
            end
            wait(137)
        end
    end
end

function sampev.onSetMapIcon(iconId, position, type, color, style)
    if toggle and type == youriconid
    then
        posX = position.x
        posY = position.y
        posZ = position.z
        setCharCoordinates(PLAYER_PED, posX, posY, posZ)
        printStringNow('~w~Teleport... ~g~OK!', 1000)
    end
end
 

aPELAobr

Active member
Joined
Jan 13, 2015
Messages
185
Reaction score
0
PHP:
local sampev = require 'lib.samp.events'
local youriconid = 52 -- Robbery

function main()
    while not isSampAvailable() do wait(0) end
    
    while true do
        wait(0)
        if isKeyDown(88) -- X key
        then
            toggle = not toggle
            if toggle
            then printStringNow('~w~Script ~g~ON', 1337)
            else printStringNow('~w~Script ~r~OFF', 137)
            end
            wait(137)
        end
    end
end

function sampev.onSetMapIcon(iconId, position, type, color, style)
    if toggle and type == youriconid
    then
        posX = position.x
        posY = position.y
        posZ = position.z
        setCharCoordinates(PLAYER_PED, posX, posY, posZ)
        printStringNow('~w~Teleport... ~g~OK!', 1000)
    end
end
code is working, the printStringNow are being showing but after press 'x' and active nothing happens.. maybe it's bc i'm using SAMP R3? Idk because i still using a lot of SF and lua mods from R1 and all of those works fine.. anyways i'll try to seek by myself, i don't wanna to disturb you more :) thanks a lot!
 

aPELAobr

Active member
Joined
Jan 13, 2015
Messages
185
Reaction score
0
code is working, the printStringNow are being showing but after press 'x' and active nothing happens.. maybe it's bc i'm using SAMP R3? Idk because i still using a lot of SF and lua mods from R1 and all of those works fine.. anyways i'll try to seek by myself, i don't wanna to disturb you more :) thanks a lot!
nevermind! just forgot to activate it BEFORE the map icon appears :ROFLMAO:
 

aPELAobr

Active member
Joined
Jan 13, 2015
Messages
185
Reaction score
0
everyone (and @dphome)

I was lookin for some implements that is do this teleport via command, like '/tp 17' (map icon ID 17) and consequently teleport for a already existing map icon but for what i looked for, the incoming RPC onSetMapIcon just works with map icons that are set when the code is already running.. i don't know, i just looked all events.lua documentation and didn't find nothing that i could interpret

anyway, for now i just change it to '/tp' command and didn't even know if it's working :ROFLMAO: no errors so i think that it's fine

C++:
local sampev = require 'lib.samp.events'
local youriconid = 11 -- Robbery

function main()
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand('tp', cmd)
enabled = not enabled
end

function cmd(arg)
if #arg == 0 then
print("Command 'tp' syntax: /tp")
else
print("Tp: input = " .. arg)
end
end

function sampev.onSetMapIcon(iconId, position, type, color, style)
if enabled and type == youriconid then
posX = position.x
posY = position.y
posZ = position.z
setCharCoordinates(PLAYER_PED, posX, posY, posZ)
printStringNow('~w~Teleport... ~g~OK!', 1000)
end
end
 
Top