Client
function dxDrawFramedText(message, left, top, width, height, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, frameColor)
color = color or tocolor(255, 255, 255, 255)
frameColor = frameColor or tocolor(0, 0, 0, 255)
scale = scale or 1.1
font = font or "default"
alignX = alignX or "left"
alignY = alignY or "top"
clip = clip or false
wordBreak = wordBreak or false
postGUI = postGUI or false
dxDrawText(message, left + 1, top + 1, width + 1, height + 1, frameColor, scale, font, alignX, alignY, clip, wordBreak, postGUI)
dxDrawText(message, left + 1, top - 1, width + 1, height - 1, frameColor, scale, font, alignX, alignY, clip, wordBreak, postGUI)
dxDrawText(message, left - 1, top + 1, width - 1, height + 1, frameColor, scale, font, alignX, alignY, clip, wordBreak, postGUI)
dxDrawText(message, left - 1, top - 1, width - 1, height - 1, frameColor, scale, font, alignX, alignY, clip, wordBreak, postGUI)
dxDrawText(message, left, top, width, height, color, scale, font, alignX, alignY, clip, wordBreak, postGUI)
end
Rnoteam = 255
Gnoteam = 0
bnoteam = 0
local x, y = guiGetScreenSize()
function MedicRender()
if getTeamName(getPlayerTeam(localPlayer)) == "Medic" then
if getElementDimension(localPlayer) == 55 then return end
if getElementData(localPlayer, "LegalStatus")== "Jailed" then return end
if getElementData(localPlayer, "LegalStatus")== "Arrested" then return end
if getElementData(localPlayer, "Kidnapped") then return end
if getElementData(localPlayer, "bag") then return end
if isPedInVehicle(localPlayer) then return end
if (isPedDead (localPlayer)) then return end
if not isPedOnGround(localPlayer) then return end
if getElementData(localPlayer, "MStat") == "Open" then
dxDrawFramedText("Press : [R] To Delete The Healing Marker Matker !!",x*0.01, y*0.640, x*0.99, y*0.97, tocolor(255, 0, 0, 255), 1, "default-bold", "left", "top", false, false, true, false, false)
else
dxDrawFramedText("Press : [R] To Create The Healing Marker Matker !!",x*0.01, y*0.640, x*0.99, y*0.97, tocolor(0, 255, 0, 255), 1, "default-bold", "left", "top", false, false, true, false, false)
end
end
end
addEventHandler("onClientRender", getRootElement(), MedicRender)
-------------------------------
addEventHandler("onClientPlayerDamage", root,
function(attacker, weapon)
if attacker and getElementType(attacker) == "player" and attacker ~= source then
local Model = getElementModel(attacker)
local Team = getPlayerTeam(attacker)
if Team and (getTeamName(Team) == "Medic") then
cancelEvent()
if not isTimer(waitTimer[source]) then
triggerServerEvent("healPlayer", attacker, source, attacker)
waitTimer[source] = setTimer(function(p) waitTimer[p] = nil end, 1500, 1, source)
end
end
end
end)
function onCompleteKid()
triggerServerEvent ("Medic",localPlayer )
end
bindKey("R", "down", onCompleteKid)
local healAmount = 75
local medicMarker = {}
local medicTimer = {}
function heal(helled, heller)
local money = getElementData(helled, "Money") or 0
if (healAmount <= money) then
local health = getElementHealth(helled)
local maxHealth = getPlayerMaxHealth(helled) or 100
if (health <= (maxHealth - 25)) then
setElementHealth(helled, health + 25)
payTheMoney(heller, helled)
elseif (health <= (maxHealth - 5)) and (health > (maxHealth - 25)) and (health < maxHealth) then
setElementHealth(helled, health + (maxHealth - health))
payTheMoney(heller, helled)
end
end
end
addEvent("healPlayer", true)
addEventHandler("healPlayer", root, heal)
function getPlayerMaxHealth(player)
local currentHealth = math.ceil(getElementHealth(player))
setElementHealth(player, 200)
local MaxHealth = math.ceil(getElementHealth(player))
setElementHealth(player, currentHealth)
return MaxHealth
end
function payTheMoney(heller, helled)
setElementData(helled, "Money", (getElementData(helled, "Money") or 0) - healAmount)
setElementData(heller, "Money", (getElementData(heller, "Money") or 0) + healAmount)
exports["guimessages"]:outputServer(heller, "#00FFFF[Medic Job] :#00FF00 You have earned $"..healAmount, 0, 255, 0)
exports["guimessages"]:outputServer(helled, "#00FFFF[Medic Job] :#FF9900 You've paid $"..healAmount.." for medical services.", 255, 125, 0)
end
addEvent("Medic", true)
addEventHandler("Medic", root,
function()
local team = getPlayerTeam(source)
local medicTeam = getTeamFromName("Medic")
if team and medicTeam and team == medicTeam then
if isElement(medicMarker[source]) then
destroyElement(medicMarker[source])
medicMarker[source] = nil
setElementFrozen(source, false)
toggleAllControls(source, true)
exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#FF0000 Medic marker unloaded successfully.", 255, 255, 0)
setElementData(source, "MStat", "Destroy")
else
if (getElementData(source, "WantLvl") or 0) > 0 then
exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#FF0000 Your wanted level prevent you from doing this action.", 255, 0, 0)
elseif isPedDead(source) then
exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#FF0000 What are you trying to do?!?! only alives can do this action!", 255, 0, 0)
elseif getElementData(source, "LegalStatus")== "Jailed" then
exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#FF0000 You Are Jailed you Can't do this Action!", 255, 0, 0)
elseif getElementData(source, "LegalStatus")== "Arrested" then
exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#FF0000 You Are Arrested you Can't do this Action!", 255, 0, 0)
elseif isPedInVehicle(source) then
exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#FF0000 You must be on foot to do this action.", 255, 0, 0)
elseif not isPedOnGround(source) then
exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#FF0000 You must be on the ground to do this action.", 255, 0, 0)
else
setElementFrozen(source, true)
toggleAllControls(source, false, true, false)
if isTimer(medicTimer[source]) then killTimer(medicTimer[source]) end
medicTimer[source] = setTimer(function(source)
local x, y, z = getElementPosition(source)
if isElement(medicMarker[source]) then destroyElement(medicMarker[source]) medicMarker[source] = nil end
medicMarker[source] = createMarker(x, y, z-1, "cylinder", 2.2, 100, 100, 255, 125)
setElementInterior(medicMarker[source], getElementInterior(source))
setElementDimension(medicMarker[source], getElementDimension(source))
exports["guimessages"]:outputServer(source, "#00FFFF[Medic Job] :#00FF00 Medic marker created successfully.", 0, 255, 0)
setElementData(source, "MStat", "Open")
--exports["guimessages"]:outputServer(source, "Do /"..cmd.." again to unload.", 100, 100, 255)
end, 200, 1, source)
end
end
end
end)
function eventCheck()
if isElement(medicMarker[source]) then
destroyElement(medicMarker[source])
medicMarker[source] = nil
setElementFrozen(source, false)
toggleAllControls(source, true)
end
end
addEventHandler("onPlayerQuit", root, eventCheck)
addEventHandler("onPlayerWasted", root, eventCheck)
addEventHandler("onElementDataChange", getRootElement(),
function(Date)
if Date == "Money" then
setPlayerMoney(getElementData(source, "Money"))
end
end)
setTimer(function()
for heller, marker in pairs(medicMarker) do
for i, helled in ipairs(getElementsWithinColShape(getElementColShape(marker), "player")) do
if helled ~= heller then
heal(helled, heller)
end
end
end
end, 3000, 0)
Server