Jump to content

Marker on spawned car


Recommended Posts

Posted

Hi sorry to bumb but i dont get how to get a text showing in the chatbox if u enter the marker

i tried this below but i cant seem to get the marker!

  
    function kickit() 
outputChatBox("Working!") 
end 
    addEventHandler("onMarkerHit", markers[source],kickit) 
  

Posted

Try this

function kickit(hitElement, matchingDimension) 
    if matchingDimension and isElement(hitElement) and getElementType(hitElement) == "player" then  
        outputChatBox("Working!",hitElement) 
    end 
end  
addEventHandler("onMarkerHit", markers[source],kickit) -- it must be inside the function 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

Ok i tried to add the eventhandler in here ;

  
  
function attchMarkerToAllVehicle () 
    for i, vehicle in pairs(getElementsByType("vehicle")) do 
        if not markers[vehicle] then 
        local marker = createMarker( 0,0,0,"arrow",0.5,224,255,255,170) 
        attachElements ( marker, vehicle, -1.5, 0, 1 ) 
            markers[vehicle] = marker 
            addEventHandler("onMarkerHit", markers[source],kickit) -- it must be inside the function 
        end 
    end 
end 
setTimer(attchMarkerToAllVehicle,1000,0) 
  

but it isnt doing something

Posted (edited)

it must be like this

addEventHandler("onMarkerHit", markers[vehicle],kickit) 

or

addEventHandler("onMarkerHit", marker ,kickit)  

Edited by Guest

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
Doesnt seem to work also

what did you try it both working fine i gave you two examples

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

My whole code u mean?

here it is

  
  
local markers = {} 
  
function attchMarkerToAllVehicle () 
    for i, vehicle in pairs(getElementsByType("vehicle")) do 
        if not markers[vehicle] then 
        local marker = createMarker( 0,0,0,"arrow",0.5,224,255,255,170) 
        attachElements ( marker, vehicle, -1.5, 0, 1 ) 
            markers[vehicle] = marker 
            addEventHandler("onMarkerHit", markers[vehicle],kickit) 
        end 
    end 
end 
setTimer(attchMarkerToAllVehicle,1000,0) 
  
function destroyMarker() 
    if getElementType(source) == "vehicle" then 
        if markers[source] and isElement(markers[source]) then 
            destroyElement (markers[source]) 
             
        end 
    end 
end 
addEventHandler("onElementDestroy", getRootElement(),destroyMarker) 
  
  
function onResourceStart ( ) 
    local players = getElementsByType ( "player" ) -- Store all the players in the server into a table 
    for key, player in ipairs ( players ) do       -- for all the players in the table 
        setPlayerNametagShowing ( player, false )  -- turn off their nametag 
    end 
end 
addEventHandler ( "onResourceStart", resourceRoot, onResourceStart ) 
  
function onPlayerJoin ( ) 
      -- Whoever joins the server should also have their nametags deactivated 
    setPlayerNametagShowing ( source, false ) 
end 
addEventHandler ( "onPlayerJoin", root, onPlayerJoin ) 
  
function kickit(hitElement, matchingDimension) 
  --  if matchingDimension and isElement(hitElement) and getElementType(hitElement) == "player" then 
        outputChatBox("Working!",hitElement) 
end         
         
  
  

Posted

man why you edit my code

copy and past

local markers = {} 
  
function attchMarkerToAllVehicle () 
    for i, vehicle in pairs(getElementsByType("vehicle")) do 
        if not markers[vehicle] then 
        local marker = createMarker( 0,0,0,"arrow",0.5,224,255,255,170) 
            attachElements ( marker, vehicle, -1.5, 0, 1 ) 
            markers[vehicle] = marker 
            addEventHandler("onMarkerHit", markers[vehicle],kickit) 
        end 
    end 
end 
setTimer(attchMarkerToAllVehicle,1000,0) 
  
function destroyMarker() 
    if getElementType(source) == "vehicle" then 
        if markers[source] and isElement(markers[source]) then 
            destroyElement (markers[source]) 
            removeEventHandler("onMarkerHit", markers[source],kickit) 
        end 
    end 
end 
addEventHandler("onElementDestroy", getRootElement(),destroyMarker) 
  
  
function onResourceStart ( ) 
    local players = getElementsByType ( "player" ) -- Store all the players in the server into a table 
    for key, player in ipairs ( players ) do       -- for all the players in the table 
        setPlayerNametagShowing ( player, false )  -- turn off their nametag 
    end 
end 
addEventHandler ( "onResourceStart", resourceRoot, onResourceStart ) 
  
function onPlayerJoin ( ) 
    setPlayerNametagShowing ( source, false ) 
end 
addEventHandler ( "onPlayerJoin", root, onPlayerJoin ) 
  
function kickit(hitElement, matchingDimension) 
  if matchingDimension and isElement(hitElement) and getElementType(hitElement) == "player" then 
    outputChatBox("Working!",hitElement) 
end  

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

still not working after copy paste , some of my other scripts poped in too , i only removed the if matchingDimension to check if it was working then but now i tried to copy EXACTLY what you said now but it still didnt work

Posted
still not working after copy paste , some of my other scripts poped in too , i only removed the if matchingDimension to check if it was working then but now i tried to copy EXACTLY what you said now but it still didnt work

debugscript ??

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
Nothing in debugscript

Found out the arrow was glitching. its working with a cylinder marker ,

Thank you for your time!!!

you are welcome

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

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...