Mark0 Posted September 14, 2012 Share Posted September 14, 2012 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
TAPL Posted September 14, 2012 Share Posted September 14, 2012 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
Mark0 Posted September 14, 2012 Author Share Posted September 14, 2012 Now it Work but when i take other job i can see the marker Link to comment
TAPL Posted September 14, 2012 Share Posted September 14, 2012 Now it Work but when i take other job i can see the marker When you take other job, use this if isElementVisibleTo(ambulancee, source) then setElementVisibleTo(ambulancee, source, false) end Link to comment
Mark0 Posted September 14, 2012 Author Share Posted September 14, 2012 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
TAPL Posted September 15, 2012 Share Posted September 15, 2012 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
Mark0 Posted September 21, 2012 Author Share Posted September 21, 2012 can u explain more?? : -when i add function leaveMedic i can't see the marker but i can take the ambulance Link to comment
TAPL Posted September 21, 2012 Share Posted September 21, 2012 -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
Mark0 Posted September 21, 2012 Author Share Posted September 21, 2012 yes i do it but also don't work Link to comment
Mark0 Posted September 21, 2012 Author Share Posted September 21, 2012 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
TAPL Posted September 21, 2012 Share Posted September 21, 2012 Man, you're join Medic and in same time you leave Medic -_-" Link to comment
Mark0 Posted September 21, 2012 Author Share Posted September 21, 2012 so can you fix it ? Link to comment
TAPL Posted September 21, 2012 Share Posted September 21, 2012 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
Mark0 Posted September 21, 2012 Author Share Posted September 21, 2012 but i do it like you say what is wrong ? add it inside the script Link to comment
TAPL Posted September 21, 2012 Share Posted September 21, 2012 but i do it like you say what is wrong ? add it inside the script i don't know what is your events/jobs You should knows what events to use when you changing your job like "setPolice" or whatever. Link to comment
Mark0 Posted September 21, 2012 Author Share Posted September 21, 2012 (edited) so shoold i post my client side ? removed Edited September 21, 2012 by Guest Link to comment
TAPL Posted September 21, 2012 Share Posted September 21, 2012 isElementVisibleTo and setElementVisibleTo is server side function. What other jobs you have? Link to comment
Mark0 Posted September 21, 2012 Author Share Posted September 21, 2012 why other jobs i want someone fix my script if you don't know and ty Link to comment
TAPL Posted September 21, 2012 Share Posted September 21, 2012 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
Mark0 Posted September 21, 2012 Author Share Posted September 21, 2012 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 ? Link to comment
TAPL Posted September 21, 2012 Share Posted September 21, 2012 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
Mark0 Posted September 21, 2012 Author Share Posted September 21, 2012 so it's not possible to fix the medic script Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now