Jump to content

please help me with setElementVisibleTo please


Recommended Posts

Posted

what did i wrong i would make a marker and blip visible for the player that starts the busjob.

every one can see the blips and markers

local marker = createMarker(2121, 1402,10,"cylinder",2,0,255,0) 
  
addEventHandler("onMarkerHit",marker, 
    function ( player ) 
        if getElementType ( player ) == "player" then 
          bus = createVehicle ( 431, 2107, 1395, 10 ) 
            warpPedIntoVehicle ( player, bus )   
            outputChatBox ( "you can earn money by driving to the markers" ) 
            myMarker = createMarker ( 2038.26, 1514.01, 9, "cylinder", 1.5, 255, 255, 0, 170 ) 
            blip1 = createBlip ( 2038.26, 1514.01, 13, 41, 0, 0, 0, 255 ) 
            name = getPlayerName ( source ) 
            setElementVisibleTo ( myMarker, getRootElement ( ), false ) 
            setElementVisibleTo ( myMarker, source, true ) 
             
    end 
end,false) 

  • Moderators
Posted
addEventHandler("onMarkerHit",createMarker(2121, 1402,10,"cylinder",2,0,255,0), 
    function ( player ) 
        if getElementType ( player ) == "player" then 
            local bus = createVehicle ( 431, 2107, 1395, 10 ) 
            warpPedIntoVehicle ( player, bus )  
            outputChatBox ( "you can earn money by driving to the markers" ) 
            local myMarker = createMarker ( 2038.26, 1514.01, 9, "cylinder", 1.5, 255, 255, 0, 170 ) 
            createBlip (  2038.26, 1514.01, 13, 41, 0, 0, 0, 255,  
            0, 99999, player) 
            --name = getPlayerName ( source ) 
            setElementVisibleTo ( myMarker, root, false ) 
            setElementVisibleTo ( myMarker, player, true ) 
    end 
end,false) 

Posted

@IIYAMA

visibleDistance: The maximum distance from the camera at which the blip is still visible (0 - 65535).

if you set the visible distance to more than 65535, you will have some trouble with the blip visible.

Posted

hi, its a very good script but every player can see the marker, is the login system not good ? is this for client ? THANX

addEventHandler("onMarkerHit",createMarker(2121, 1402,10,"cylinder",2,0,255,0), 
    function ( player ) 
        if getElementType ( player ) == "player" then 
            local bus = createVehicle ( 431, 2107, 1395, 10 ) 
            warpPedIntoVehicle ( player, bus )  
            outputChatBox ( "you can earn money by driving to the markers" ) 
            local myMarker = createMarker ( 2038.26, 1514.01, 9, "cylinder", 1.5, 255, 255, 0, 170 ) 
            createBlip (  2038.26, 1514.01, 13, 41, 0, 0, 0, 255,  
            0, 99999, player) 
            --name = getPlayerName ( source ) 
            setElementVisibleTo ( myMarker, root, false ) 
            setElementVisibleTo ( myMarker, player, true ) 
    end 
end,false) 

Posted
Use visibleTo argument for the marker.

https://wiki.multitheftauto.com/wiki/CreateMarker

do you mean this ?

addEventHandler("onMarkerHit",createMarker(2121, 1402,10,"cylinder",2,0,255,0), 
    function ( player ) 
        if getElementType ( player ) == "player" then 
            local bus = createVehicle ( 431, 2107, 1395, 10 ) 
            warpPedIntoVehicle ( player, bus ) 
            outputChatBox ( "you can earn money by driving to the markers" ) 
            local myMarker = createMarker ( 2038.26, 1514.01, 9, "cylinder", 1.5, 255, 255, 0, 170 ) 
            createBlip (  2038.26, 1514.01, 13, 41, 0, 0, 0, 255, 
            0, 99999, player) 
            --name = getPlayerName ( source ) 
            visibleTo ( myMarker, root, false ) 
            visibleTo ( myMarker, player, true ) 
    end 
end,false) 
  

Posted
addEventHandler("onMarkerHit",createMarker(2121, 1402,10,"cylinder",2,0,255,0), 
    function ( player ) 
        if getElementType ( player ) == "player" then 
            local bus = createVehicle ( 431, 2107, 1395, 10 ) 
            warpPedIntoVehicle ( player, bus ) 
            outputChatBox ( "you can earn money by driving to the markers" ) 
            local myMarker = createMarker ( 2038.26, 1514.01, 9, "cylinder", 1.5, 255, 255, 0, 170, player ) 
            createBlip (  2038.26, 1514.01, 13, 41, 0, 0, 0, 255, 
            0, 99999, player) 
            --name = getPlayerName ( source ) 
    end 
end,false) 

Posted

do i change things in this script, "no" then it's not working maybe we have to change the hole script ps i want that nobody can see the marker of another player THANX

addEventHandler("onMarkerHit",createMarker(2121, 1402,10,"cylinder",2,0,255,0), 
    function ( player ) 
        if getElementType ( player ) == "player" then 
            local bus = createVehicle ( 431, 2107, 1395, 10 ) 
            warpPedIntoVehicle ( player, bus ) 
            outputChatBox ( "you can earn money by driving to the markers" ) 
            local myMarker = createMarker ( 2038.26, 1514.01, 9, "cylinder", 1.5, 255, 255, 0, 170, player ) 
            createBlip (  2038.26, 1514.01, 13, 41, 0, 0, 0, 255, 
            0, 99999, player) 
            --name = getPlayerName ( source ) 
    end 
end,false) 

Posted
addEventHandler("onMarkerHit",createMarker(2121, 1402,10,"cylinder",2,0,255,0), 
    function ( player ) 
        if getElementType ( player ) == "player" then 
            local bus = createVehicle ( 431, 2107, 1395, 10 ) 
            warpPedIntoVehicle ( player, bus ) 
            outputChatBox ( "you can earn money by driving to the markers" ) 
for k,v in ipairs (getElementsByType("player")) do 
if v == player then 
            local myMarker = createMarker ( 2038.26, 1514.01, 9, "cylinder", 1.5, 255, 255, 0, 170, ) 
            createBlip (  2038.26, 1514.01, 13, 41, 0, 0, 0, 255, 
            0, 99999) 
end 
end 
            --name = getPlayerName ( source ) 
    end 
end,false) 

Posted (edited)
  
            local myMarker = createMarker ( 2038.26, 1514.01, 9, "cylinder", 1.5, 255, 255, 0, 170,) 
  

unexpected symbol near ')'

try this Body ::

  
  
 _M = createMarker(2121, 1402,10,"cylinder",2,255,0,255,255) 
mybus = {} 
myMarker = {} 
myBlip = {} 
addEventHandler("onPlayerMarkerHit",root, 
    function ( _m ) 
        if  _M == _m then 
if isPedInVehicle(source) then removePedFromVehicle (source) end 
            local mybus[source] = createVehicle ( 431, 2107, 1395, 10 ) 
            warpPedIntoVehicle ( source, mybus[source] ) 
            outputChatBox ( "you can earn money by driving to the markers",source) 
           myMarker[source] = createMarker ( 2038.26, 1514.01, 9, "cylinder",2, 255, 255, 0, 170,source ) 
            myBlip[source]  = createBlip (  2038, 1514, 13, 41, 0, 0, 0, 255,  0, 99999, source) 
          setElementVisibleTo ( _m, source, false ) 
addEventHandler("onPlayerMarkerHit",root, 
    function ( _m2 ) 
    if _m2 == myMarker[source] then 
           givePlayerMoney(source,1000000) 
           destroyElement(_m2) 
           destroyElement(myBlip[source]) 
           destroyElement(mybus[source]) 
           setElementVisibleTo ( _m, source, true ) 
     end 
end)  
end 
end) 
  
  
Edited by Guest
  • Moderators
Posted

It was server side.... and you didn't tell us what went wrong.

"on my server it's not working"

We can't do anything with this information.

Posted

ok yes when is use the script and i load and a random player starts busjob then every body can see the marker. THANKS is there a bug in the account system ?

It was server side.... and you didn't tell us what went wrong.
"on my server it's not working"

We can't do anything with this information.

  • Moderators
Posted (edited)
addEventHandler("onMarkerHit",createMarker(2121, 1402,10,"cylinder",2,0,255,0), 
function ( player ) 
    if getElementType ( player ) == "player" then 
        local bus = createVehicle ( 431, 2107, 1395, 10 ) 
        warpPedIntoVehicle ( player, bus ) 
        outputChatBox ( "you can earn money by driving to the markers",player )--< thx  #Mr.Pres[T]ege (player) 
        local myMarker = createMarker ( 2038.26, 1514.01, 9, "cylinder", 1.5, 255, 255, 0, 170,player ) 
        local Blip = createBlip (  2038.26, 1514.01, 13, 41, 0, 0, 0, 255, 
        0, 99999, player) 
    end 
end,false) 
  

It must be working....

@IIYAMA

visibleDistance: The maximum distance from the camera at which the blip is still visible (0 - 65535).

if you set the visible distance to more than 65535, you will have some trouble with the blip visible.

Never had trouble with that, I only don't know what number it chooses, but I think the server will go for default.

Edited by Guest
Posted

Try this :

Server Side

local jobMarker = createMarker( 2121, 1402, 10, "cylinder", 2, 0, 255, 0 ); 
local gVeh = {}; 
  
addEventHandler( "onMarkerHit", resourceRoot, 
    function( element ) 
        if source == jobMarker and getElementType ( element ) == "player" then 
            if isElement( gVeh[ element ] ) then 
                destroyElement( gVeh[ element ] ); 
            end 
            if isPedInVehicle( element ) then  
                removePedFromVehicle( element );  
            end 
            local gVeh[ element ]  = createVehicle ( 431, 2107, 1395, 10 ); 
            warpPedIntoVehicle ( element, gVeh[ element ] ); 
            outputChatBox ( 'you can earn money by driving to the markers', element ); 
            local arriveMarker = createMarker ( 2038.26, 1514.01, 9, "cylinder", 1.5, 255, 255, 0, 170, element ); 
            local Blip = createBlip ( 2038.26, 1514.01, 13, 41, 0, 0, 0, 255, 0, 99999, element ); 
        elseif source == arriveMarker then 
            outputChatBox ( 'you arrived to the marker and you won $1000000', element ); 
            givePlayerMoney( element, 1000000 ); 
            destroyElement( source ); 
            destroyElement( Blip ); 
            if isElement( gVeh[ element ] ) then 
                destroyElement( gVeh[ element ] ); 
            end 
        end 
    end 
); 

Posted
now there spawn two busses and there is an error "attempt to call a boolean value"

and every player can also see the markers :( THANX

Copy my code again.

Posted

unexepted symbol near ' [ '

now there spawn two busses and there is an error "attempt to call a boolean value"

and every player can also see the markers :( THANX

Copy my code again.

  • Moderators
Posted

Did you ever tried to fix it by your self? Do even know how your own code works?

Did you ever wrote a line by your self? and so "no" from who are those lines?

Je probeert het niet eens, -__-" dan los je het zelf maar op.

Posted
unexepted symbol near ' [ '
now there spawn two busses and there is an error "attempt to call a boolean value"

and every player can also see the markers :( THANX

Copy my code again.

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