Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --=================================================================================================================--
- --=================================================================================================================--
- --=================================================================================================================--
- local HOSPITAL_PRICE = 100
- local HOSPITAL_LENGHT = 2.1
- local HOSPITAL_BLOODTIMER = 75
- local HOSPITAL_UNTILFIRSTAID = "45.000"
- local HOSPITAL_FIRSTPERSON_TIMER = 0.5
- local HOSPITAL_MARKET = { 1177.75, -1323.24, 14.09, 0, 0, -86.81, "All Saints General", 1181.55, -1319.66, 13.58, 0, 0, 127.03 }
- local HOSPITAL_MONTGOMERY = { 1242.79, 329.95, 19.76, 0, 0, -21.13, "Crippen Memorial", 1241.82, 334.13, 19.55, 0, 0, -170.11 }
- local HOSPITAL_JEFFERSON = { 2012.62, -1435.74, 13.55, 0, 0, 136.74, "County General", 2010.69, -1440.31, 13.56, 0, 0, -28.22 }
- local HOSPITAL_BLOOD_LITE = { 50.0, 25.0 }
- local HOSPITAL_BLOOD_MIDDLE = { 25.0, 15.0 }
- local HOSPITAL_BLOOD_HARD = { 15.0, 0.0 }
- --=================================================================================================================--
- --=================================================================================================================--
- --=================================================================================================================--
- local Hospital = {}
- Hospital.Window = {}
- Hospital.Button = {}
- Hospital.Memo = {}
- Hospital.Checkbox = {}
- Hospital.Label = {}
- Hospital.Edit = {}
- Hospital.Progress = {}
- Hospital.Grid = {}
- Hospital.Image = {}
- --=================================================================================================================--
- --=================================================================================================================--
- --=================================================================================================================--
- function HospitalCountdown()
- if tonumber(Hospital["count"]) < 0.1 then
- removeEventHandler("onClientRender", getRootElement(), HospitalCountdown)
- removeEventHandler("onClientPreRender", getRootElement(), adjustCamera)
- removeEventHandler("onClientCursorMove", getRootElement(), adjustCursor)
- Hospital["count"] = "0.0000"
- HospitalSystem()
- end
- --=================================================================================================================--
- dxDrawRectangle(7.0,485.0,135.0,42.0,tocolor(0,0,0,100),false)
- dxDrawText("0:"..gettok(Hospital["count"],1,string.byte('.'))..":"..gettok(Hospital["count"],2,string.byte('.')).."\n"..getLanguageText("HOSPITAL", "COUNTDOWN"),13.0,491.0,136.0,525.0,tocolor(255,255,255,255),1.0,"default-bold","left","top",false,false,false)
- end
- function getLanguageText(text, text)
- return "No Language XML"
- end
- function HospitalWindow()
- Hospital.Window[1] = guiCreateWindow(0.0953,0.251,0.4148,0.4111,"Hospital",true)
- Hospital.Image[1] = guiCreateStaticImage(0.0169,0.0356,0.354,0.4228,"Bilder/hospital_symbol.png",true,Hospital.Window[1])
- Hospital.Grid[1] = guiCreateGridList(0.4689,0.0641,0.5104,0.3872,true,Hospital.Window[1])
- guiGridListSetSelectionMode(Hospital.Grid[1],2)
- Hospital.Label[1] = guiCreateLabel(0.0406,0.0491,0.8635,0.1779,getLanguageText("HOSPITAL", "G_RECS"),true,Hospital.Grid[1])
- guiLabelSetColor(Hospital.Label[1],255,255,255)
- guiLabelSetVerticalAlign(Hospital.Label[1],"top")
- guiLabelSetHorizontalAlign(Hospital.Label[1],"left",false)
- guiSetFont(Hospital.Label[1],"default-bold-small")
- Hospital.Label[2] = guiCreateLabel(0.0369,0.0798,0.5867,0.1166,"______________________",true,Hospital.Grid[1])
- guiLabelSetColor(Hospital.Label[2],255,255,255)
- guiLabelSetVerticalAlign(Hospital.Label[2],"top")
- guiLabelSetHorizontalAlign(Hospital.Label[2],"left",false)
- Hospital.Label[3] = guiCreateLabel(0.0406,0.2393,0.8745,0.6687,string.format(getLanguageText("HOSPITAL", "GUI_DATA"), getPlayerName(getLocalPlayer()), tostring(getElementData(getLocalPlayer(),"age")), 'Stable', Hospital["hospital"], 'Spaeter'),true,Hospital.Grid[1])
- guiSetAlpha(Hospital.Label[3],0.60000002384186)
- guiLabelSetColor(Hospital.Label[3],255,255,255)
- guiLabelSetVerticalAlign(Hospital.Label[3],"top")
- guiLabelSetHorizontalAlign(Hospital.Label[3],"left",false)
- guiSetFont(Hospital.Label[3],"default-bold-small")
- Hospital.Button[1] = guiCreateButton(0.3898,0.4751,0.1657,0.0309,"Maximize",true,Hospital.Window[1])
- guiSetFont(Hospital.Button[1],"default-bold-small")
- Hospital.Image[2] = guiCreateStaticImage(0.823,0.5534,0.1582,0.4204,"Bilder/hospital_doctor.png",true,Hospital.Window[1])
- Hospital.Checkbox[1] = guiCreateCheckBox(0.0282,0.658,0.2731,0.0404,getLanguageText("HOSPITAL", "GUI_POLICE"),false,true,Hospital.Window[1])
- guiCheckBoxSetSelected(Hospital.Checkbox[1],true)
- guiSetFont(Hospital.Checkbox[1],"default-bold-small")
- Hospital.Memo[1] = guiCreateMemo(0.0282,0.715,0.5254,0.2447,"Strafanzeige stellen",true,Hospital.Window[1])
- guiSetAlpha(Hospital.Memo[1],0.60000002384186)
- Hospital.Edit[1] = guiCreateEdit(0.3277,0.6508,0.2241,0.0451,Hospital["killer"],true,Hospital.Window[1])
- Hospital.Label[4] = guiCreateLabel(0.339,0.6247,0.1262,0.0356,"Killer",true,Hospital.Window[1])
- guiLabelSetColor(Hospital.Label[4],255,255,255)
- guiLabelSetVerticalAlign(Hospital.Label[4],"top")
- guiLabelSetHorizontalAlign(Hospital.Label[4],"left",false)
- guiSetFont(Hospital.Label[4],"default-small")
- Hospital.Button[2] = guiCreateButton(0.5763,0.9192,0.2373,0.038,"Anzeige aufgeben",true,Hospital.Window[1])
- guiSetFont(Hospital.Button[2],"default-bold-small")
- Hospital.Label[5] = guiCreateLabel(0.58,0.8385,0.2335,0.0689,getLanguageText("HOSPITAL", "GUI_SIGNS"),true,Hospital.Window[1])
- guiLabelSetColor(Hospital.Label[5],255,255,255)
- guiLabelSetVerticalAlign(Hospital.Label[5],"top")
- guiLabelSetHorizontalAlign(Hospital.Label[5],"left",false)
- guiSetFont(Hospital.Label[5],"default-bold-small")
- Hospital.Progress[1] = guiCreateProgressBar(0.5706,0.7696,0.2467,0.0546,true,Hospital.Window[1])
- guiSetAlpha(Hospital.Progress[1],0.5)
- guiProgressBarSetProgress(Hospital.Progress[1],23)
- Hospital.Label[6] = guiCreateLabel(0.5838,0.7435,0.1789,0.0285,"Behandlungsfortschritt:",true,Hospital.Window[1])
- guiLabelSetColor(Hospital.Label[6],255,255,255)
- guiLabelSetVerticalAlign(Hospital.Label[6],"top")
- guiLabelSetHorizontalAlign(Hospital.Label[6],"left",false)
- guiSetFont(Hospital.Label[6],"default-small")
- end
- --=================================================================================================================--
- --=================================================================================================================--
- --=================================================================================================================--
- function DeathSystem(killer, weapon, bodypart)
- if not killer then
- Hospital["killer"] = "N/A"
- else
- Hospital["killer"] = getPlayerName(killer)
- end
- Hospital["x"], Hospital["y"], Hospital["z"] = getElementPosition(source)
- Hospital["locations"] = {
- getMeterDistance(Hospital["x"], Hospital["y"], Hospital["z"], HOSPITAL_MARKET[1], HOSPITAL_MARKET[2], HOSPITAL_MARKET[3]),
- getMeterDistance(Hospital["x"], Hospital["y"], Hospital["z"], HOSPITAL_MONTGOMERY[1], HOSPITAL_MONTGOMERY[2], HOSPITAL_MONTGOMERY[3]),
- getMeterDistance(Hospital["x"], Hospital["y"], Hospital["z"], HOSPITAL_JEFFERSON[1], HOSPITAL_JEFFERSON[2], HOSPITAL_JEFFERSON[3]) }
- for i = 1, #Hospital["locations"] do
- if Hospital["distance"] == nil or Hospital["distance"] == 0 then
- Hospital["distance"] = Hospital["locations"][i]
- else
- if Hospital["distance"] > Hospital["locations"][i] then
- Hospital["distance"] = Hospital["locations"][i]
- Hospital["hospital"] = i
- end
- end
- end
- if Hospital["hospital"] == 1 then Hospital["hospital"] = HOSPITAL_MARKET[7]
- elseif Hospital["hospital"] == 2 then Hospital["hospital"] = HOSPITAL_MONTGOMERY[7]
- elseif Hospital["hospital"] == 3 then Hospital["hospital"] = HOSPITAL_JEFFERSON[7]
- end
- HospitalSystem()
- setTimer(FirstPerson, 1000*HOSPITAL_FIRSTPERSON_TIMER, 1)
- end
- function outputError(text)
- outputChatBox(text)
- end
- function DamageSystem(attacker, weapon, bodypart, loss)
- outputError("DamageSystem triggered")
- if isTimer(Hospital["timer"]) then
- killTimer(Hospital["timer"])
- end
- outputError("DamageSystem - Line")
- if getElementHealth(getLocalPlayer()) > HOSPITAL_BLOOD_LITE[1] and getElementHealth(getLocalPlayer()) < HOSPITAL_BLOOD_LITE[2] then
- Hospital["timer"] = setTimer(DamageBlood, HOSPITAL_BLOODTIMER*1000, 0, "HOSPITAL_BLOOD_LITE")
- elseif getElementHealth(getLocalPlayer()) > HOSPITAL_BLOOD_MIDDLE[1] and getElementHealth(getLocalPlayer()) < HOSPITAL_BLOOD_MIDDLE[2] then
- Hospital["timer"] = setTimer(DamageBlood, HOSPITAL_BLOODTIMER*1000, 0, "HOSPITAL_BLOOD_MIDDLE")
- elseif getElementHealth(getLocalPlayer()) > HOSPITAL_BLOOD_HARD[1] and getElementHealth(getLocalPlayer()) < HOSPITAL_BLOOD_HARD[2] then
- Hospital["timer"] = setTimer(DamageBlood, HOSPITAL_BLOODTIMER*1000, 0, "HOSPITAL_BLOOD_HARD")
- end
- outputError("DamageSystem - DamageSystem passed")
- end
- function DamageBlood(typ)
- if typ == "HOSPITAL_BLOOD_LITE" then
- outputChatBox(getLanguageText("HOSPITAL", "PED_BLOOD_LITE"), 255, 255, 255, true)
- Hospital["damage_x"], Hospital["damage_y"], Hospital["damage_z"] = getElementPosition(getLocalPlayer())
- fxAddBlood ( Hospital["damage_x"], Hospital["damage_y"], Hospital["damage_z"]-2, 0.00000, 0.00000, 0.00000, math.random(1,2), 1)
- elseif typ == "HOSPITAL_BLOOD_MIDDLE" then
- outputChatBox(getLanguageText("HOSPITAL", "HOSPITAL_BLOOD_MIDDLE"), 255, 255, 255, true)
- Hospital["damage_x"], Hospital["damage_y"], Hospital["damage_z"] = getElementPosition(getLocalPlayer())
- fxAddBlood ( Hospital["damage_x"], Hospital["damage_y"], Hospital["damage_z"]-2, 0.00000, 0.00000, 0.00000, math.random(2,3), 1)
- elseif typ == "HOSPITAL_BLOOD_HARD" then
- outputChatBox(getLanguageText("HOSPITAL", "HOSPITAL_BLOOD_HARD"), 255, 255, 255, true)
- Hospital["damage_x"], Hospital["damage_y"], Hospital["damage_z"] = getElementPosition(getLocalPlayer())
- fxAddBlood ( Hospital["damage_x"], Hospital["damage_y"], Hospital["damage_z"]-2, 0.00000, 0.00000, 0.00000, math.random(3,4), 1)
- end
- end
- function HospitalSystem()
- HospitalWindow()
- for i = 1, 2 do
- addEventHandler("onClientGUIClick", Hospital.Button[i], HospitalClick, false)
- end
- end
- function HospitalClick(button, state)
- if button == "left" then
- if state == Hospital.Button[1] then
- Buttontext = ""..(guiGetText(Hospital.Button[1]) == "Maximize" and "Maximize" or "Minimize")..""
- if guiGetText(Hospital.Button[1]) == "Maximize" then
- guiSetText(Hospital.Button[1], "Minimize")
- else
- guiSetText(Hospital.Button[1], "Maximize")
- end
- addEventHandler("onClientRender", getRootElement(), HospitalMenu)
- elseif state == Hospital.Button[2] then
- outputChatBox("Not completed")
- end
- end
- end
- function HospitalMenu()
- local MAIN_BIG_SIZEWINDOW = 0.251
- local MAIN_SMALL_SIZEWINDOW = 0.151
- local MAIN_VALUE_SETSIZE = 0.01
- --
- Hospital["main_x"], Hospital["main_y"] = guiGetSize(Hospital.Window[1], true)
- if Hospital["main_y"] < MAIN_BIG_SIZEWINDOW then
- guiSetSize(Hospital.Window[1], Hospital["main_x"], Hospital["main_y"]+MAIN_VALUE_SETSIZE, true)
- if Hospital["main_y"] > MAIN_SMALL_SIZEWINDOW then
- removeEventHandler("onClientRender", getRootElement(), HospitalMenu)
- end
- elseif Hospital["main_y"] > MAIN_SMALL_SIZEWINDOW then
- guiSetSize(Hospital.Window[1], Hospital["main_x"], Hospital["main_y"]-MAIN_VALUE_SETSIZE, true)
- if Hospital["main_y"] < MAIN_BIG_SIZEWINDOW then
- removeEventHandler("onClientRender", getRootElement(), HospitalMenu)
- end
- end
- end
- --=================================================================================================================--
- --=================================================================================================================--
- --=================================================================================================================--
- function FirstPerson()
- Hospital["fperson"] = true
- Hospital["count"] = HOSPITAL_UNTILFIRSTAID
- addEventHandler("onClientRender", getRootElement(), HospitalCountdown)
- addEventHandler("onClientPreRender", getRootElement(), adjustCamera)
- addEventHandler("onClientCursorMove", getRootElement(), adjustCursor)
- end
- function adjustCamera(timeSlice)
- Hospital["count"] = tonumber(Hospital["count"])-timeSlice
- if Hospital["fperson"] == true then
- Hospital["head_x"], Hospital["head_y"], Hospital["head_z"] = getPedBonePosition(getLocalPlayer(), 6)
- setCameraMatrix(Hospital["head_x"], Hospital["head_y"], Hospital["head_z"], Hospital["head_x"] + Hospital["absoulute_x"], Hospital["head_y"] + Hospital["absoulute_y"], Hospital["head_z"] + Hospital["absoulute_z"])
- end
- end
- function adjustCursor(cursorX, cursorY, absoluteX, absoluteY, worldX, worldY, worldZ)
- Hospital["cursor_x"], Hospital["cursor_y"], Hospital["cursor_z"] = getCameraMatrix()
- Hospital["absoulute_x"] = (worldX-Hospital["cursor_x"])/300
- Hospital["absoulute_y"] = (worldY-Hospital["cursor_y"])/300
- Hospital["absoulute_z"] = (worldZ-Hospital["cursor_z"])/300
- end
- --=================================================================================================================--
- --=================================================================================================================--
- --=================================================================================================================--
- addEventHandler("OnClientPlayerDamage", getRootElement(), DamageSystem)
- addEventHandler("OnClientPlayerWasted", getRootElement(), DeathSystem)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement