Jump to content

billal

Members
  • Posts

    132
  • Joined

  • Last visited

Everything posted by billal

  1. billal

    ...

    -- C is_spawn_protected = nil --[[ Get spawn protection ]]-- function set_spawn_protection(time_s) is_spawn_protected = setTimer(function() end, time_s*1000, 1) end addEvent("GTWhospital.setSpawnProtection", true) addEventHandler("GTWhospital.setSpawnProtection", localPlayer, set_spawn_protection) --[[ Protect players from taking damage on spawn]]-- function protect_spawn(attacker, weapon, bodypart) if not isTimer(is_spawn_protected) then return end cancelEvent() end addEventHandler("onClientPlayerDamage", localPlayer, protect_spawn) --[[ Protect players from being choked upon spawn ]]-- function protect_spawn_choke(weaponID, responsiblePed) if not isTimer(is_spawn_protected) then return end cancelEvent() end addEventHandler("onClientPlayerChoke", localPlayer, protect_spawn_choke) --[[ Global spawn sound handler ]]-- function onSoundEvent(cmd, sound) playSoundFrontEnd(tonumber(sound)) end addCommandHandler("sound", onSoundEvent) -- S timers = { } awaiting_spawn = { } weapon_list = {{ }} ammo_list = {{ }} -- List of available hospitals hs_table = { -- x y z rot view x view y view z [1]={ 1177, -1320, 14.137756347656, 270, 1200.6923828125, -1324.9873046875, 20.398437 }, [2]={ -2666, 630, 13.567041397095, 180, -2664.4501953125, 611.0771484375, 20.454549789429 }, [3]={ 1607, 1818, 10.8203125, 0, 1607.3310546875, 1839.7470703125, 16.8203125 }, [4]={ 2040, -1420, 16.9921875, 90, 2031.8486328125, -1419.5927734375, 22.9921875 }, [5]={ -2200, -2308, 30.625, -45, -2193.5888671875, -2301.6630859375, 36.625 }, [6]={ 208, -65.3, 1.4357746839523, 180, 208.310546875, -75.525390625, 7.4357746839523 }, [7]={ 1245.8, 336.9, 19.40625, -20, 1250.3759765625, 346.681640625, 25.40625 }, [8]={ -317.4, 1056.4, 19.59375, 0, -316.8125, 1066.306640625, 25.59375 }, [9]={ -1514.8, 2527.9, 55.6875, 1.790, -1514.283203125, 2536.412109375, 61.6875 }, } -- Cost of the healthcare hs_charge = 500 hs_respawn_time = 10 -- Check GTWjail respawn times if you decide to change this value! hs_spawn_protection_time = 20 --[[ Load all the hospitals from the table ]]-- function load_hospitals() for i=1, #hs_table do createBlip(hs_table[i][1], hs_table[i][2], hs_table[i][3], 22, 1, 0, 0, 0, 255, 2, 180) local h_marker = createMarker(hs_table[i][1], hs_table[i][2], hs_table[i][3]-1, "cylinder", 2, 0, 200, 0, 30) addEventHandler("onMarkerHit", h_marker, hs_start_heal) addEventHandler("onMarkerLeave", h_marker, hs_stop_heal) end end addEventHandler("onResourceStart", resourceRoot, load_hospitals) --[[ Return the nearest hospital depending on a players location ]]-- function get_nearest_hospital(plr) if not plr or not isElement(plr) or getElementType(plr) ~= "player" then return end local n_loc,min = nil,9999 for k,v in ipairs(hs_table) do -- Get the distance for each point local px,py,pz=getElementPosition(plr) local dist = getDistanceBetweenPoints2D(px,py,v[1],v[2]) -- Update coordinates if distance is smaller if dist < min then n_loc = v min = dist end -- 2015-03-01 Dead in interior? respawn at LS hospital if getElementInterior(plr) > 0 then break end end -- Check if jailed or not and return either hospital or jail local isJailed = exports.GTWjail:isJailed(thePlayer) if not isJailed then return n_loc[1]+math.random(-1,1),n_loc[2]+math.random(-1,1),n_loc[3],n_loc[4],n_loc[5],n_loc[6],n_loc[7] else return -2965+math.random(-5,5),2305+math.random(-5,5),9,270 end end --[[ Toggle controls for a player ]]-- function toggle_controls(plr, n_state) if not plr or not isElement(plr) or getElementType(plr) ~= "player" then return end toggleControl(plr, "jump", n_state) toggleControl(plr, "sprint", n_state) toggleControl(plr, "crouch", n_state) toggleControl(plr, "fire", n_state) toggleControl(plr, "aim_weapon", n_state) toggleControl(plr, "enter_exit", n_state) toggleControl(plr, "enter_passenger", n_state) toggleControl(plr, "forwards", n_state) toggleControl(plr, "walk", n_state) toggleControl(plr, "backwards", n_state) toggleControl(plr, "left", n_state) toggleControl(plr, "right", n_state) toggleControl(plr, "vehicle_fire", n_state) end --[[ Respawn after death "onPlayerSpawn" ]]-- function player_Spawn(x,y,z, r, team_name, skin_id, int,dim) -- Check if a player is picked up by an ambulance if not awaiting_spawn[source] then return end -- Restore weapons if weapon_list[source] and ammo_list[source] then for k,wep in ipairs(weapon_list[source]) do if weapon_list[source][k] and ammo_list[source][k] then -- Return ammo to the player giveWeapon(source, weapon_list[source][k], ammo_list[source][k], false) -- Clean up used space weapon_list[source][k] = nil ammo_list[source][k] = nil end end end -- Check if jailed local isJailed = exports.GTWjail:isJailed(source) if isJailed then return end -- Set camera view target local x,y,z, r, vx,vy,vz = get_nearest_hospital(source) setCameraMatrix(source, vx,vy,vz, x,y,z, 0,75) -- Fade in the camera and set it's target fadeCamera(source, true, 6,255,255,255) -- Make sure the player is not frozen setElementFrozen(source, false) toggle_controls(source, false) setTimer(finish_spawn, 8000, 1, source) -- Set health to 30 setElementHealth(source, 30) -- Reset ambulance data awaiting_spawn[source] = nil -- Infom the player about his respawn exports.GTWtopbar:dm("Hospital: You have been healed at "..getZoneName(x,y,z)..", for a cost of $"..hs_charge, source, 255, 100, 0) end addEventHandler("onPlayerSpawn", root, player_Spawn) --[[ Helper function for spawn triggers and style ]]-- function finish_spawn(plr) if not plr or not isElement(plr) or getElementType(plr) ~= "player" then return end setCameraTarget(plr, plr) -- Enable controls toggle_controls(plr, true) -- Play a spawn sound playSoundFrontEnd(plr, 11) -- Enable spawn protection triggerClientEvent(plr, "GTWhospital.setSpawnProtection", plr, hs_spawn_protection_time) end --[[ On player wasted, fade out and send to hospital ]]-- function on_death(ammo, attacker, weapon, bodypart) -- Save all weapons currently hold by a player weapon_list[source] = { 0,0,0,0,0,0,0,0,0,0,0,0 } ammo_list[source] = { 0,0,0,0,0,0,0,0,0,0,0,0 } -- Check all weapon slots and save their ammo for k,v in ipairs(weapon_list[source]) do weapon_list[source][k] = getPedWeapon(source, k) setPedWeaponSlot(source, k) ammo_list[source][k] = getPedTotalAmmo(source, k) end -- Check if jailed or not local isJailed = exports.GTWjail:isJailed(source) if isJailed then return end -- Make sure warp to hospital is possible if getPedOccupiedVehicle(source) then removePedFromVehicle(source) end -- Take some of the money takePlayerMoney(source, hs_charge) fadeCamera(source, false, 8, 0, 0, 0) -- Respawn player after "hs_respawn_time" seconds setTimer(plr_respawn, hs_respawn_time*1000, 1, source) -- Add to respawn awaiting_spawn[source] = true -- Notify player about his death exports.GTWtopbar:dm("Hospital: You are dead! an ambulance will pick you up soon", source, 255, 100, 0) end addEventHandler("onPlayerWasted", root, on_death) --[[ Helper function to spawn player ]]-- function plr_respawn(plr) if not plr or not isElement(plr) or getElementType(plr) ~= "player" then return end local x,y,z, r, vx,vy,vz = get_nearest_hospital(plr) spawnPlayer(plr, x,y,z+1, r, getElementModel(plr), 0,0, getPlayerTeam(plr)) end --[[ Dump weapons into users database on quit ]]-- function dump_weapons() -- Get player account local acc = getPlayerAccount(source) -- Reset ambulance data awaiting_spawn[source] = nil -- Check if there is any weapons in memory if not weapon_list[source] then return end -- Save the weapons and ammo stored in memory for k,w in ipairs(weapon_list[source]) do if weapon_list[source][k] and ammo_list[source][k] then setAccountData(acc, "acorp.weapon."..tostring(k), weapon_list[source][k]) setAccountData(acc, "acorp.ammo."..tostring(k), ammo_list[source][k]) end end end addEventHandler("onPlayerQuit", root, dump_weapons) --[[ Heal player once in a health marker ]]-- function hospital_heal(plr) if not plr or not isElement(plr) or getElementType(plr) ~= "player" then return end local health = getElementHealth(plr) local charge = math.floor(hs_charge/10) if health < 90 and getPlayerMoney(plr) >= charge then setElementHealth(plr, health+10) takePlayerMoney(plr, charge) elseif getPlayerMoney(plr) >= charge then setElementHealth(plr, 100) takePlayerMoney(plr, charge) exports.GTWtopbar:dm("Hospital: Go away, you're fine!", plr, 255, 100, 0) if isTimer(timers[plr]) then killTimer(timers[plr]) end elseif getPlayerMoney(plr) < charge then exports.GTWtopbar:dm("Hospital: You can't afford the healthcare!", plr, 255, 0, 0) end end addCommandHandler("gtwinfo", function(plr, cmd) outputChatBox("[GTW-RPG] "..getResourceName( getThisResource())..", by: "..getResourceInfo( getThisResource(), "author")..", v-"..getResourceInfo( getThisResource(), "version")..", is represented", plr) end) --[[ Start an healing timer, increasing the health of a player ]]-- function hs_start_heal(hitElement, matchingDimension) if isTimer(timers[hitElement]) then killTimer(timers[hitElement]) end if getElementHealth(hitElement) < 90 then exports.GTWtopbar:dm("Stay in the marker to get healed!", hitElement, 255, 100, 0) timers[hitElement] = setTimer(hospital_heal, 1400, 0, hitElement) end end --[[ Stop and kill the heal timers ]]-- function hs_stop_heal(plr, matchingDimension) if isTimer(timers[plr]) then killTimer(timers[plr]) end end
  2. billal

    ...

    حلو سفاح هيك مب مب ينتقل ابي اعرف كيف اجيب الاحداثيات من مود تاني يعني مثلا عندي مود مشفى كل مدينة حطيت فيها احداثيات لما لالاعب يموت يروح لمشفى المدينة اللي مات فيها هل ينفع استعمل الكودexports وكمان نفس الكود استعمل لكي يجيب احداثيات البيت من مود البيوت الخ....
  3. billal

    ...

    شكرا اوسكار لكن في مشكلة بالكود حقك هو صحيح يرسن في الاحداثيات اللي تختارها كل ما يموت لكن المشكلة لما تختار من اللوحة يعمل انتقال
  4. billal

    ...

    المشفى لكل اللاعبين مركز الشرطة للشرطين فقط المقر كل قروب مقر خاص البيت كل لاعب بيته الخاص الامر معقد شوية
  5. billal

    ...

    شكرا عمل رائع لم يعمل كما اردت بالضبط لكني استفدت كثيرا اضن انني الحين اقدر اعدل علىيه شوية يمكن انجح
  6. billal

    ...

    مثال؟؟؟
  7. billal

    ...

    لا ليس هاذا ما اريد انا لا اريد لوحة انتقال فتصميم لوحة الانتقالات سهلة جدا انا اريد اختار في اللوحة المكان اللي ارسن اليه لما اموت اتمنى تفهموني
  8. شكراً بلال ابي شي آخر مهم كثير ابي اللوحة اذا دخلت الماركر مرة تفتح بس اذا دخلتها مرة ثانية بعد المرة الاولى ما تفتح الا بعد فترة يعني اللوحة اذا فتحت مرة لا تفتح مرة ثانية الا بعد فترة محددة جرب هاذا -- Code By #Cross function StartTimer() Seconds = 300 Timer = setTimer( function() local Value = Seconds - 1 Seconds = Value >= 0 and Value or 0 guiSetText(Label, math.floor( Sec / 60 )..":"..( Sec % 60 )) --- Label = الليبل حقك ., if ( Seconds == 0 ) then killTimer(Timer) guiSetVisible(GUIEditor.window[1],false) end end,1000, 0 ) end StartTimer( )
  9. player مو معرفه مب مهم السطر 7و8بعدين اصلحه يهمني السطر5و6
  10. billal

    ...

    ابي حل لهاذا الكود المنوب كلينت GUIEditor = { window = {}, radiobutton = {} } GUIEditor.window[1] = guiCreateWindow(290, 132, 210, 315, "spawn", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.radiobutton[1] = guiCreateRadioButton(21, 32, 163, 15, "الانتحار للمشفى", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.radiobutton[1], "NormalTextColour", "FF882BD0") GUIEditor.radiobutton[2] = guiCreateRadioButton(21, 78, 163, 15, "الانتحار للمقر", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.radiobutton[2], "NormalTextColour", "FF0DEF0D") GUIEditor.radiobutton[3] = guiCreateRadioButton(21, 123, 167, 15, "الانتحار للبيت", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.radiobutton[3], "NormalTextColour", "FFE95014") GUIEditor.radiobutton[4] = guiCreateRadioButton(21, 172, 158, 15, "الانتحار لمركز الشرطة", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.radiobutton[4], "NormalTextColour", "FF0813F6") function narotu() if guiGetVisible(GUIEditor.window[1]) == false then guiSetVisible(GUIEditor.window[1],true) showCursor(true) else guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end bindKey("F2","down",narotu) if localPlayer == player then if guiRadioButtonSetSelected(GUIEditor.radiobutton[1], true) then triggerServerEvent('narotu', localPlayer) elseif guiRadioButtonSetSelected(GUIEditor.radiobutton[2], true) then triggerServerEvent('billal', localPlayer) end end سيرفر addEvent ('onPlayerSpawn',true) addEventHandler ('onPlayerSpawn',root, function(narotu) setTimer(setElementPosition, 500, 1, source,931.78,1564.12,16.96) end ) addEvent ('onPlayerSpawn',true) addEventHandler ('onPlayerSpawn',root, function(billal) setTimer(setElementPosition, 500, 1, source,800.78,1564.12,16.96) end )
  11. انت مب فاهم قصدي لو كان الاحداثيات هيك لكنت عملتها بسهولة لكن المشكلة في في كتير احداثيات يعني لازم كل واحد من قروب معين يرسن بمقره وايضا كل واحد عنده بيت يرسن ببيته يعني خلاصة القول x,y,zمتغيرة عند كل لاعب وانا مو عارف شو الكود اللازم
  12. addEventHandler('onPlayerSpawn', root, function() local acc = getPlayerAccount( player ); if isGuestAccount( acc ) then export--------كيف اجيب احداثيات الرسباون من مود المشفى او من مود المقر setTimer(setElementPosition, 500, 1, source,x,y,z) setElementHealth ( player, 100 ) setPedArmor ( player, 100 ) end end )
  13. جرب ضيف انت واذا اخطات بنصلح اذا كنت اي مود هكذا ماراح تتعلم البرمجة ماشاء الله عليك ساعدتني كثيرا نفسيا
  14. setElementInterior setElementDimension
  15. اذا عندي مود البيوت وعندي مود لما اللاعب يموت يروح للمشفى وعندي عصابة فيها مقر كيف اضيفهم للجدول؟؟؟؟
  16. اعتقد انك عملتهم في عالم واحد يعني انك حاط Dimension = 0 Interior = 0 ---------------------------- لازم تعمل عالمين مختلفين مثلا الهجولة كل مايتعلق بها يكون في العالم Dimension = 0 Interior = 0 اما ديث ماتش وكل موداته تغيرهم مثلا Dimension = 5 Interior = 0 كدا ماراح يشوفو بعضهم بالماب
  17. اعتقد لازم تعمل لوحة انتقال يعني اللي يختار زر1يروح للهجوله واللي يضغط زر2يروح ديث ماتش ولازم تخلي كل عالم وحده يعني تغير Dimension + Interior
  18. هلا شباب اب اصمم لوحة اختار وين ارسن يعني اختار منها سباون للمشفى او للبيت او للمقر او للجيش....... المشكلة شو الكود عشان تطلع قريد ليست حق مكان سباون باللوحة؟؟؟؟ GUIEditor = { gridlist = {}, window = {}, button = {}, label = {} } GUIEditor.window[1] = guiCreateWindow(511, 158, 203, 351, "Spawn Manager", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(10, 56, 183, 198, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Spawn", 0.9) GUIEditor.button[1] = guiCreateButton(10, 264, 183, 37, "OK", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.label[1] = guiCreateLabel(11, 23, 54, 23, "Current:", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetVerticalAlign(GUIEditor.label[1], "center") GUIEditor.label[2] = guiCreateLabel(65, 23, 128, 23, "", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[2], "default-bold-small") guiLabelSetVerticalAlign(GUIEditor.label[2], "center") GUIEditor.button[2] = guiCreateButton(10, 264+37+3, 183, 264, "Close", false, GUIEditor.window[1]) function narotu() if guiGetVisible(GUIEditor.window[1]) == false then guiSetVisible(GUIEditor.window[1],true) showCursor(true) else guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end bindKey("F2","down",narotu) addEventHandler('onClientGUIClick', GUIEditor.button[2],function ( ) guiSetVisible(GUIEditor.window[1], false) showCursor(false) end )
  19. يا اخي انا جبتلك رابط من الناتMTA dayzمو مشفر يمكن تسفيد منه!? https://github.com/mtadayz/MTADayZ/archive/master.zip
  20. ابحث في ملف السيرفر عن كود setAnimation واطرحه هنا لنعدله لك ان شاء الله
  21. وظيفة المزارع ؟ يمكن مشن او ( مهمة ) بس وظيفة ؟! لو تبي المود هنا القسم الغلطء ولو تبي الأكواد ي حليلك لما تطلب كود وتبيه جاهز وش تستفيد غير الأعتماد على غيركء؟ حاول ونساعدك ي قلبيءءء شكرا على الفتوى يا شيخ
  22. حط كود setTimer لفنكشن الحركة
×
×
  • Create New...