Jump to content
  • 0

Help.


Batista

Question

Hello all,

Today I create /createmarker script, it's allow me to create checkpoint.

My question is how to add blip when I type /createmarker and how to create cmd "removemarker" that remove the marker.

This is my "createmarker" script:

function consoleCreateMarker ( playerSource ) 
    if ( playerSource ) then 
        local x, y, z = getElementPosition ( playerSource ) 
        createMarker ( x, y, z, "checkpoint", 2, 255, 0, 0, 255 ) 
    end 
end 
addCommandHandler ( "createmarker", consoleCreateMarker ) 

Thanks.

Link to comment

6 answers to this question

Recommended Posts

  • 0
local markers = {} 
local blips = {} 
  
function consoleCreateMarker ( playerSource ) 
    if ( playerSource ) then 
        local x, y, z = getElementPosition ( playerSource ) 
        markers[playerSource] = createMarker ( x, y, z, "checkpoint", 2, 255, 0, 0, 255 ) 
        blips[playerSource] = createBlipAttachedTo(markers[playerSource], 53) 
    end 
end 
addCommandHandler ( "createmarker", consoleCreateMarker ) 
  
function consoleDestroyMarker ( playerSource ) 
    if ( isElement(markers[playerSource]) and isElement(blips[playerSource]) ) then 
          destroyElement(markers[playerSource]) 
          destroyElement(blips[playerSource]) 
          markers[playerSource] = nil 
          blips[playerSource] = nil 
    end 
end 
addCommandHandler ( "destroymarker", consoleDestroyMarker ) 

Should work.

P.S: This should go in the "Scripting" section ;).

Link to comment
  • 0

This should work for admins only:

local markers = {} 
local blips = {} 
  
function consoleCreateMarker ( playerSource ) 
        if ( hasObjectPermissionTo ( playerSource, "function.kickPlayer", false ) ) then 
  
        if ( hasObjectPermissionTo ( getThisResource (), "function.kickPlayer", true ) ) then 
         
    if ( playerSource ) then 
        local x, y, z = getElementPosition ( playerSource ) 
         markers[playerSource] = createMarker ( x, y, z, "checkpoint", 2, 255, 0, 0, 255 ) 
        blips[playerSource] = createBlipAttachedTo(markers[playerSource], 53) 
    end 
end 
end 
end 
addCommandHandler ( "createmarker", consoleCreateMarker ) 
  
function consoleDestroyMarker ( playerSource ) 
    if ( isElement(markers[playerSource]) and isElement(blips[playerSource]) ) then 
          destroyElement(markers[playerSource]) 
          destroyElement(blips[playerSource]) 
          markers[playerSource] = nil 
          blips[playerSource] = nil 
    end 
end 
addCommandHandler ( "destroymarker", consoleDestroyMarker ) 

Edited by Guest
Link to comment
  • 0
local markers = {} 
local blips = {} 
  
function consoleCreateMarker ( playerSource ) 
    if ( playerSource ) then 
        if ( hasObjectPermissionTo ( playerSource , "function.kickPlayer", true ) ) then 
            local x, y, z = getElementPosition ( playerSource ) 
            markers[playerSource] = createMarker ( x, y, z, "checkpoint", 2, 255, 0, 0, 255 ) 
            blips[playerSource] = createBlipAttachedTo(markers[playerSource], 53) 
        end 
    end 
end 
addCommandHandler ( "createmarker", consoleCreateMarker ) 
  
function consoleDestroyMarker ( playerSource ) 
    if ( isElement(markers[playerSource]) and isElement(blips[playerSource]) ) then 
        destroyElement(markers[playerSource]) 
        destroyElement(blips[playerSource]) 
        markers[playerSource] = nil 
        blips[playerSource] = nil 
    end 
end 
addCommandHandler ( "destroymarker", consoleDestroyMarker ) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...