Jump to content

Show marker !!


Mark0

Recommended Posts

How to show my marker only for Medics

  
createBlip ( 2035.1999511719, -1406.5, 16.200000762939, 22 ) 
  
function createMedicTeam () 
    MedicTeam = createTeam ("Medic", 6, 183, 248) 
end 
addEventHandler ("onResourceStart", resourceRoot, createMedicTeam) 
  
function joinMedic() 
     setPlayerTeam(source,MedicTeam) 
     setElementModel(source,276) 
      giveWeapon ( source, 41, 999 ) 
     setElementData( source, "Occupation", "Medic", true ) 
     outputChatBox("You are now Medic.",source,0,255,0) 
end 
addEvent("setMedic", true) 
addEventHandler("setMedic",root,joinMedic) 
addEvent("medic:healing", true) 
addEventHandler("medic:healing", root, 
function (medic) 
    if (getElementHealth(source) < 100) then 
        local Heal = getElementHealth(source) + 10  
        setElementHealth(source, Heal)  
        if (Heal > 100) then 
             setElementHealth(source, 100) 
        end 
        givePlayerMoney(medic, 100)  
        takePlayerMoney(source, 100)  
    end 
end) 
  
ambulancee = createMarker(2001, -1407.1999511719, 15.89999961853, "cylinder", 1.5, 0, 255,255, 255) -- Creates a marker in the center of the map 
setElementVisibleTo(ambulancee, Medic, false) 
  
local jobVehicles = {} 
  
addEventHandler("onMarkerHit", ambulancee, 
    function(hitElement)  
        if (getElementType(hitElement) ~= "player") then return end 
        local x, y, z = getElementPosition(hitElement)  
        local team = getPlayerTeam(hitElement)  
        if(isPedInVehicle(hitElement)) then return end 
        if (jobVehicles[hitElement] and isElement(jobVehicles[hitElement])) then destroyElement(jobVehicles[hitElement]) end 
        if (team and getTeamName(team) == "Medic") then 
                                setElementVisibleTo(ambulancee, root, true)    
            jobVehicles[hitElement] = createVehicle (416, x, y, z, 0, 0, -90)  
            setTimer(warpPedIntoVehicle, 250, 1, hitElement, jobVehicles[hitElement])  
        end 
end 
)  

Link to comment

Try

createBlip(2035.1999511719, -1406.5, 16.200000762939, 22) 
MedicTeam = createTeam ("Medic", 6, 183, 248) 
ambulancee = createMarker(2001, -1407.1999511719, 15.89999961853, "cylinder", 1.5, 0, 255,255, 255) -- Creates a marker in the center of the map 
setElementVisibleTo(ambulancee, root, false)   
  
function joinMedic() 
     setPlayerTeam(source,MedicTeam) 
     setElementVisibleTo(ambulancee, source, true)   
     setElementModel(source,276) 
     giveWeapon(source, 41, 999) 
     setElementData(source, "Occupation", "Medic") 
     outputChatBox("You are now Medic.", source, 0,255,0) 
end 
addEvent("setMedic", true) 
addEventHandler("setMedic",root,joinMedic) 
  
addEvent("medic:healing", true) 
addEventHandler("medic:healing", root, 
function (medic) 
    if (getElementHealth(source) < 100) then 
        local Heal = getElementHealth(source) + 10 
        setElementHealth(source, Heal) 
        if (Heal > 100) then 
             setElementHealth(source, 100) 
        end 
        givePlayerMoney(medic, 100) 
        takePlayerMoney(source, 100) 
    end 
end) 
  
local jobVehicles = {} 
  
addEventHandler("onMarkerHit", ambulancee, 
function(hitElement) 
     if (getElementType(hitElement) ~= "player") then return end 
     local x, y, z = getElementPosition(hitElement) 
     local team = getPlayerTeam(hitElement) 
     if(isPedInVehicle(hitElement)) then return end 
     if (isElement(jobVehicles[hitElement])) then destroyElement(jobVehicles[hitElement]) end 
     if (team and getTeamName(team) == "Medic") then 
          jobVehicles[hitElement] = createVehicle(416, x, y, z, 0, 0, -90) 
          setTimer(warpPedIntoVehicle, 250, 1, hitElement, jobVehicles[hitElement]) 
     end 
end) 

Link to comment

i add it like you say but i can't see the marker and i can take the car

createBlip(2035.1999511719, -1406.5, 16.200000762939, 22) 
MedicTeam = createTeam ("Medic", 0, 255, 255) 
ambulancee = createMarker(2001, -1407.1999511719, 15.89999961853, "cylinder", 1.5, 0, 255,255, 255) -- Creates a marker in the center of the map 
setElementVisibleTo(ambulancee, root, false)   
  
function joinMedic() 
     setPlayerTeam(source,MedicTeam) 
     setPlayerNametagColor ( thePlayer, 0, 255, 255 ) 
     setElementVisibleTo(ambulancee, source, true)   
     setElementModel(source,276) 
     giveWeapon(source, 41, 999) 
     setElementData(source, "Occupation", "Medic") 
     outputChatBox("You are now Medic.", source, 0,255,0) 
end 
addEvent("setMedic", true) 
addEventHandler("setMedic",root,joinMedic) 
addCommandHandler ( "nametagcolor", nametagColorChange ) 
  
function leaveMedic() 
        if isElementVisibleTo(ambulancee, source) then 
           setElementVisibleTo(ambulancee, source, false)  
        end 
end 
addEventHandler("setMedic",root,leaveMedic) 
  
addEvent("medic:healing", true) 
addEventHandler("medic:healing", root, 
function (medic) 
    if (getElementHealth(source) < 100) then 
        local Heal = getElementHealth(source) + 10 
        setElementHealth(source, Heal) 
        if (Heal > 100) then 
             setElementHealth(source, 100) 
        end 
        givePlayerMoney(medic, 100) 
        takePlayerMoney(source, 100) 
    end 
end) 
  
local jobVehicles = {} 
  
addEventHandler("onMarkerHit", ambulancee, 
function(hitElement) 
     if (getElementType(hitElement) ~= "player") then return end 
     local x, y, z = getElementPosition(hitElement) 
     local team = getPlayerTeam(hitElement) 
     if(isPedInVehicle(hitElement)) then return end 
     if (isElement(jobVehicles[hitElement])) then destroyElement(jobVehicles[hitElement]) end 
     if (team and getTeamName(team) == "Medic") then 
          jobVehicles[hitElement] = createVehicle(416, x, y, z, 0, 0, 180) 
          setTimer(warpPedIntoVehicle, 250, 1, hitElement, jobVehicles[hitElement]) 
     end 
end) 

Link to comment
i add it like you say but i can't see the marker and i can take the car
createBlip(2035.1999511719, -1406.5, 16.200000762939, 22) 
MedicTeam = createTeam ("Medic", 0, 255, 255) 
ambulancee = createMarker(2001, -1407.1999511719, 15.89999961853, "cylinder", 1.5, 0, 255,255, 255) -- Creates a marker in the center of the map 
setElementVisibleTo(ambulancee, root, false)   
  
function joinMedic() 
     setPlayerTeam(source,MedicTeam) 
     setPlayerNametagColor ( thePlayer, 0, 255, 255 ) 
     setElementVisibleTo(ambulancee, source, true)   
     setElementModel(source,276) 
     giveWeapon(source, 41, 999) 
     setElementData(source, "Occupation", "Medic") 
     outputChatBox("You are now Medic.", source, 0,255,0) 
end 
addEvent("setMedic", true) 
addEventHandler("setMedic",root,joinMedic) 
addCommandHandler ( "nametagcolor", nametagColorChange ) 
  
function leaveMedic() 
        if isElementVisibleTo(ambulancee, source) then 
           setElementVisibleTo(ambulancee, source, false)  
        end 
end 
addEventHandler("setMedic",root,leaveMedic) 
  
addEvent("medic:healing", true) 
addEventHandler("medic:healing", root, 
function (medic) 
    if (getElementHealth(source) < 100) then 
        local Heal = getElementHealth(source) + 10 
        setElementHealth(source, Heal) 
        if (Heal > 100) then 
             setElementHealth(source, 100) 
        end 
        givePlayerMoney(medic, 100) 
        takePlayerMoney(source, 100) 
    end 
end) 
  
local jobVehicles = {} 
  
addEventHandler("onMarkerHit", ambulancee, 
function(hitElement) 
     if (getElementType(hitElement) ~= "player") then return end 
     local x, y, z = getElementPosition(hitElement) 
     local team = getPlayerTeam(hitElement) 
     if(isPedInVehicle(hitElement)) then return end 
     if (isElement(jobVehicles[hitElement])) then destroyElement(jobVehicles[hitElement]) end 
     if (team and getTeamName(team) == "Medic") then 
          jobVehicles[hitElement] = createVehicle(416, x, y, z, 0, 0, 180) 
          setTimer(warpPedIntoVehicle, 250, 1, hitElement, jobVehicles[hitElement]) 
     end 
end) 

You want it for other jobs,

other jobs by meaning is taking a job that aren't Medic

for this you need to change the event "setMedic"

function leaveMedic() 
        if isElementVisibleTo(ambulancee, source) then 
           setElementVisibleTo(ambulancee, source, false) 
        end 
end 
addEventHandler("setMedic",root,leaveMedic) 

Link to comment
-when i add function leaveMedic i can't see the marker but i can take the ambulance

This to fix it

createBlip(2035.1999511719, -1406.5, 16.200000762939, 22) 
MedicTeam = createTeam ("Medic", 0, 255, 255) 
ambulancee = createMarker(2001, -1407.1999511719, 15.89999961853, "cylinder", 1.5, 0, 255,255, 255) -- Creates a marker in the center of the map 
setElementVisibleTo(ambulancee, root, false)   
  
function joinMedic() 
     setPlayerTeam(source,MedicTeam) 
     setPlayerNametagColor ( thePlayer, 0, 255, 255 ) 
     setElementVisibleTo(ambulancee, source, true)   
     setElementModel(source,276) 
     giveWeapon(source, 41, 999) 
     setElementData(source, "Occupation", "Medic") 
     outputChatBox("You are now Medic.", source, 0,255,0) 
end 
addEvent("setMedic", true) 
addEventHandler("setMedic",root,joinMedic) 
addCommandHandler ( "nametagcolor", nametagColorChange ) 
  
function leaveMedic() 
        if isElementVisibleTo(ambulancee, source) then 
           setElementVisibleTo(ambulancee, source, false) 
        end 
end 
  
addEvent("medic:healing", true) 
addEventHandler("medic:healing", root, 
function (medic) 
    if (getElementHealth(source) < 100) then 
        local Heal = getElementHealth(source) + 10 
        setElementHealth(source, Heal) 
        if (Heal > 100) then 
             setElementHealth(source, 100) 
        end 
        givePlayerMoney(medic, 100) 
        takePlayerMoney(source, 100) 
    end 
end) 
  
local jobVehicles = {} 
  
addEventHandler("onMarkerHit", ambulancee, 
function(hitElement) 
     if (getElementType(hitElement) ~= "player") then return end 
     if not isElementVisibleTo(ambulancee, hitElement) then return end 
     local x, y, z = getElementPosition(hitElement) 
     local team = getPlayerTeam(hitElement) 
     if(isPedInVehicle(hitElement)) then return end 
     if (isElement(jobVehicles[hitElement])) then destroyElement(jobVehicles[hitElement]) end 
     if (team and getTeamName(team) == "Medic") then 
          jobVehicles[hitElement] = createVehicle(416, x, y, z, 0, 0, 180) 
          setTimer(warpPedIntoVehicle, 250, 1, hitElement, jobVehicles[hitElement]) 
     end 
end) 

can u explain more?? :

When you join other job, all you need is put this:

leaveMedic() 

Link to comment
createBlip(2035.1999511719, -1406.5, 16.200000762939, 22) 
MedicTeam = createTeam ("Medic", 0, 255, 255) 
ambulancee = createMarker(2001, -1407.1999511719, 15.89999961853, "cylinder", 1.5, 0, 255,255, 255) -- Creates a marker in the center of the map 
setElementVisibleTo(ambulancee, root, false)   
  
function joinMedic() 
     setPlayerTeam(source,MedicTeam) 
     setPlayerNametagColor ( thePlayer, 0, 255, 255 ) 
     setElementVisibleTo(ambulancee, source, true)   
     setElementModel(source,276) 
     giveWeapon(source, 41, 999) 
     setElementData(source, "Occupation", "Medic") 
     outputChatBox("You are now Medic.", source, 0,255,0) 
end 
addEvent("setMedic", true) 
addEventHandler("setMedic",root,joinMedic) 
addCommandHandler ( "nametagcolor", nametagColorChange ) 
  
addEvent("medic:healing", true) 
addEventHandler("medic:healing", root, 
function (medic) 
    if (getElementHealth(source) < 100) then 
        local Heal = getElementHealth(source) + 10 
        setElementHealth(source, Heal) 
        if (Heal > 100) then 
             setElementHealth(source, 100) 
        end 
        givePlayerMoney(medic, 100) 
        takePlayerMoney(source, 100) 
    end 
end) 
  
local jobVehicles = {} 
  
addEventHandler("onMarkerHit", ambulancee, 
function(hitElement) 
     if (getElementType(hitElement) ~= "player") then return end 
     if not isElementVisibleTo(ambulancee, hitElement) then return end 
     local x, y, z = getElementPosition(hitElement) 
     local team = getPlayerTeam(hitElement) 
     if(isPedInVehicle(hitElement)) then return end 
     if (isElement(jobVehicles[hitElement])) then destroyElement(jobVehicles[hitElement]) end 
     if (team and getTeamName(team) == "Medic") then 
          jobVehicles[hitElement] = createVehicle(416, x, y, z, 0, 0, 180) 
          setTimer(warpPedIntoVehicle, 250, 1, hitElement, jobVehicles[hitElement]) 
     end 
end) 
  
function leaveMedic() 
        if isElementVisibleTo(ambulancee, source) then 
           setElementVisibleTo(ambulancee, source, false) 
        end 
end 
addEventHandler("setMedic",root,leaveMedic) 

Link to comment
so can you fix it ?

You want it for other jobs,

other jobs by meaning is taking a job that aren't Medic

for this you need to change the event "setMedic"

function leaveMedic() 
        if isElementVisibleTo(ambulancee, source) then 
           setElementVisibleTo(ambulancee, source, false) 
        end 
end 
addEventHandler("setMedic",root,leaveMedic) 

Link to comment
why other jobs i want someone fix my script if you don't know and ty

omg

Now it Work but when i take other job i can see the marker :/

Aren't you who want when you take other job, then remove the marker?

then how the hell i can know when you take other job what is the event name!

Link to comment
i gived you all the script (server side and client side) that's mean u will find the name of the event on the script or not ?

Other job mean other script

All what you post here is about medic job

if you use this

function leaveMedic() 
        if isElementVisibleTo(ambulancee, source) then 
           setElementVisibleTo(ambulancee, source, false) 
        end 
end 
addEventHandler("setMedic",root,leaveMedic) 

This will make no sense, because the event is setMedic that mean join medic job not leave medic job.

if you still can't get what i am saying, i am sorry i can't help you more than this.

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