Jump to content

zONEz

Members
  • Posts

    4
  • Joined

  • Last visited

zONEz's Achievements

Vic

Vic (3/54)

1

Reputation

  1. SOLVED!!! THX SO MUCH MAN @SpecT
  2. Player is still spawning on LS hospital. function respawnDeadPlayer() setPedAnimation(source, CRACK, crckdeth1, 9000, true) outputChatBox("Yaralandin!!!",source,255,0,0) fadeCamera(source, false, 7) setTimer(respawnPlayerAfterDied, 10000, 1,source) end addEventHandler("onPlayerWasted", root, respawnDeadPlayer) function respawnPlayerAfterDied(p) local x,y,z = getElementPosition(p) -- changed from "thePlayer" to "p" spawnPlayer(p, x, y, z) -- corrected the arguments fadeCamera(p, true, 5) outputChatBox("Tedavi oldun, hadi yine iyisin.",p,255,0,0) end That's my .lua code for respawning side. broph.lua file is same as your file. What is wrong?
  3. @SpecTThank you so much local vehiclesToSpawn = { } local spawnpoints = { {-11.054133415222,2329.2023925781,24.303375244141,90}, {-18.531280517578,2323.3835449219,24.303373336792,270}, {-27.869777679443,2321.8896484375,24.303373336792,0}, {-10.329539299011,2336.9331054688,24.303375244141,128}, } local vehicleDestroyTimers = {} local validSkins = {60} local playerVehicles = {} local function spawn(player) if player and isElement(player) then local x,y,z,r = unpack(spawnpoints[math.random(1,#spawnpoints)]) spawnPlayer(player,x+math.random(-3,3),y+math.random(-3,3),z,r,validSkins[math.random(1,#validSkins)],0,0) fadeCamera(player, true) setCameraTarget(player, player) end end local function onJoin() spawn(source) end local function destroyPlayerVehicles() local vehicles = playerVehicles[source] for _,vehicle in ipairs(vehicles) do if isElement(vehicle) then destroyElement(vehicle) end end playerVehicles[source] = nil end local function onEnter(player) local t = tonumber(get("vehicleRespawnTime")) or 60000 source.damageProof = false source.frozen = false local vehicledata = vehiclesToSpawn[source] setTimer(createNewVehicle,(t > 50 and t or 50),1,vehicledata) vehiclesToSpawn[source] = nil if not playerVehicles[player] then playerVehicles[player] = {} addEventHandler("onPlayerQuit",player,destroyPlayerVehicles) end table.insert(playerVehicles[player],source) removeEventHandler("onVehicleEnter",source,onEnter) end local function destroyVehicle(vehicle) if vehicle and isElement(vehicle) and getElementType(vehicle) == "vehicle" then destroyElement(vehicle) end end local function destroyTimer() if vehicleDestroyTimers[source] and isTimer(vehicleDestroyTimers[source]) then killTimer(vehicleDestroyTimers[source]) end removeEventHandler("onVehicleEnter",source,destroyTimer) end local function onExit() local t = tonumber(get("vehicleExpireTime")) or 600000 vehicleDestroyTimers[source] = setTimer(destroyVehicle,(t > 50 and t or 50),1,source) addEventHandler("onVehicleEnter",source,destroyTimer) end function createNewVehicle(vehicledata) local m,x,y,z,r = unpack(vehicledata) local vehicle = Vehicle(m,x,y,z,0,0,r) vehicle.damageProof = true vehicle.frozen = true vehiclesToSpawn[vehicle] = vehicledata addEventHandler("onVehicleEnter",vehicle,onEnter) addEventHandler("onVehicleExit",vehicle,onExit) end local function initScript() resetMapInfo() local players = getElementsByType("player") for _,player in ipairs(players) do spawn(player) end for _,vehicledata in ipairs(vehiclesToSpawn) do createNewVehicle(vehicledata) end addEventHandler("onPlayerJoin",root,onJoin) addEventHandler("onPlayerWasted",root,onWasted) end addEventHandler("onResourceStart",resourceRoot,initScript) My broph.lua's original codes are like this. When i edit it as you say, it becomes like this; local vehiclesToSpawn = { } local spawnpoints = { {-11.054133415222,2329.2023925781,24.303375244141,90}, {-18.531280517578,2323.3835449219,24.303373336792,270}, {-27.869777679443,2321.8896484375,24.303373336792,0}, {-10.329539299011,2336.9331054688,24.303375244141,128}, } local vehicleDestroyTimers = {} local validSkins = {60} local playerVehicles = {} local function spawn(player) if player and isElement(player) then local x,y,z,r = unpack(spawnpoints[math.random(1,#spawnpoints)]) spawnPlayer(player,x+math.random(-3,3),y+math.random(-3,3),z,r,validSkins[math.random(1,#validSkins)],0,0) fadeCamera(player, true) setCameraTarget(player, player) end end local function onJoin() spawn(source) end local function destroyPlayerVehicles() local vehicles = playerVehicles[source] for _,vehicle in ipairs(vehicles) do if isElement(vehicle) then destroyElement(vehicle) end end playerVehicles[source] = nil end local function onEnter(player) local t = tonumber(get("vehicleRespawnTime")) or 60000 source.damageProof = false source.frozen = false local vehicledata = vehiclesToSpawn[source] setTimer(createNewVehicle,(t > 50 and t or 50),1,vehicledata) vehiclesToSpawn[source] = nil if not playerVehicles[player] then playerVehicles[player] = {} addEventHandler("onPlayerQuit",player,destroyPlayerVehicles) end table.insert(playerVehicles[player],source) removeEventHandler("onVehicleEnter",source,onEnter) end local function destroyVehicle(vehicle) if vehicle and isElement(vehicle) and getElementType(vehicle) == "vehicle" then destroyElement(vehicle) end end local function destroyTimer() if vehicleDestroyTimers[source] and isTimer(vehicleDestroyTimers[source]) then killTimer(vehicleDestroyTimers[source]) end removeEventHandler("onVehicleEnter",source,destroyTimer) end local function onExit() local t = tonumber(get("vehicleExpireTime")) or 600000 vehicleDestroyTimers[source] = setTimer(destroyVehicle,(t > 50 and t or 50),1,source) addEventHandler("onVehicleEnter",source,destroyTimer) end function createNewVehicle(vehicledata) local m,x,y,z,r = unpack(vehicledata) local vehicle = Vehicle(m,x,y,z,0,0,r) vehicle.damageProof = true vehicle.frozen = true vehiclesToSpawn[vehicle] = vehicledata addEventHandler("onVehicleEnter",vehicle,onEnter) addEventHandler("onVehicleExit",vehicle,onExit) end local function initScript() resetMapInfo() local players = getElementsByType("player") for _,player in ipairs(players) do spawn(player) end for _,vehicledata in ipairs(vehiclesToSpawn) do createNewVehicle(vehicledata) end addEventHandler("onPlayerJoin",root,onJoin) addEventHandler("onPlayerWasted", root, function() --setTimer(spawn, 1800, 1, source) -- you can comment it like this to prevent it from running end ) end addEventHandler("onResourceStart",resourceRoot,initScript) But my player is still respwaning on the LS hospital. function respawnPlayerAfterDied(p) local x,y,z = getElementPosition(p) -- changed from "thePlayer" to "p" spawnPlayer(p, x, y, z) -- corrected the arguments fadeCamera(p, true, 5) outputChatBox("Tedavi oldun, hadi yine iyisin.",p,255,0,0) end I've add this script though.
  4. function respawnDeadPlayer() setPedAnimation(source, CRACK, crckdeth1, 9000, true) outputChatBox("Yaralandin!!!",source,255,0,0) fadeCamera(source, false, 7) setTimer(respawnPlayerAfterDied, 10000, 1,source) end addEventHandler("onPlayerWasted", root, respawnDeadPlayer) function respawnPlayerAfterDied(p) local x,y,z = getElementPosition(thePlayer) spawnPlayer(posX="x" posY="y" posZ="z") fadeCamera(p, true, 5) outputChatBox("Tedavi oldun, hadi yine iyisin.",p,255,0,0) end I've took this code from the one of the topic from the this forum. I've made, few kind of changes in it. (Pls let me know or debug the code if i have a problem in the code) On the "Play" gamemode when the play dies, this code works and timing is works but when spawning section comes, player spawns on LS hospital and warps to another location. I think, play spawning 2 times. I want the when player dies, player re spawns on his death location. How can i, disable the "Play" gamemode respawning function?
×
×
  • Create New...