Estevam2d Posted October 30, 2013 Share Posted October 30, 2013 How do I get this script to repair the vehicle and not the life of the ped? I want to use a spray to repair the vehicle Cliente.lua local marker = createMarker( 2035.1999511719, -1406.5, 16.200000762939, "Cylinder", 2, 6, 183, 248, 153) GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function guiMyCwindow(w,h,t) local x,y = guiGetScreenSize() return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) end windowjob = guiMyCwindow(999,999,"Medic job") guiSetVisible(windowjob, false) GUIEditor_Button[1] = guiCreateButton(22,200,108,35,"Take job",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,200,110,36,"Cancel",false,windowjob) GUIEditor_Memo[1] = guiCreateMemo(19,33,273,100,"To take medic job, press Take job.\n\nIf you don't want to, press Cancel.",false,windowjob) guiEditSetReadOnly(GUIEditor_Memo[1],true) function Medicjob(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, Medicjob) function Medicjobleave(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", marker, Medicjobleave) function joinTeam() triggerServerEvent("setMedic",localPlayer) guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) function removeMedicWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeMedicWindow, false) addEventHandler("onClientPlayerDamage", localPlayer, function(attacker, weapon, bodypart, loss) team = getPlayerTeam(attacker) if (attacker and getElementType(attacker) == "player" and weapon == 41 and team and getTeamName(team) == "Medic") then -- Checks if the player is using spray and is into Medic team cancelEvent() -- Cancels the damage cause by the spray if (not isTimer(pause)) then local health = getElementHealth(localPlayer) if (health < 99) then triggerServerEvent("medic:healing", localPlayer, attacker) -- Calls the Server Event pause = setTimer(function() end, 1000, 1) -- Makes a timer for the function so it won't fully heal in the first time end end end end) Server.lua createBlip ( 2035.1999511719, -1406.5, 16.200000762939, 22,2,0,255,0, 255,0, 200) function createMedicTeam () MedicTeam = createTeam ("Medic", 6, 183, 248) end addEventHandler ("onResourceStart", resourceRoot, createMedicTeam) function joinMedic() setPlayerTeam(source,MedicTeam) setPlayerNametagColor ( source, 6, 183, 248 ) 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 -- New health setElementHealth(source, Heal) if (Heal > 100) then setElementHealth(source, 100) end givePlayerMoney(medic, 100) -- Gives 100$ to the medic each time the function is executed takePlayerMoney(source, 100) -- Takes 100$ from the source when he get healed end end) Link to comment
tosfera Posted October 31, 2013 Share Posted October 31, 2013 This is a medic script. How do you expect to get this working for vehicles. This will never work, better start making a new 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