VenomOG Posted August 15, 2018 Share Posted August 15, 2018 PROBLEMS: 1. when player revives it works etc but then after some seconds he gets teleported at What i need: how can i cancel him from teleporting at hospital CODE: addEvent("serverRevivePlayer", true) addEventHandler("serverRevivePlayer", resourceRoot, function(targetPlayer) if isElement(targetPlayer) then local x, y, z = getElementPosition(targetPlayer) spawnPlayer(targetPlayer, x, y, z) setCameraTarget(targetPlayer, targetPlayer) exports.SAEGMessages:sendClientMessage("You got revived by: "..getPlayerName(client), targetPlayer,255,255,255) exports.SAEGMessages:sendClientMessage("You revived: "..getPlayerName(targetPlayer), client,255,255,255) end end) Link to comment
Skully Posted August 16, 2018 Share Posted August 16, 2018 Please show the code which displays what triggers the event "serverRevivePlayer". Link to comment
JeViCo Posted August 16, 2018 Share Posted August 16, 2018 (edited) 7 hours ago, KnucklesSAEG said: when player revives it works etc but then after some seconds he gets teleported You have another spawnPlayer function somewhere to avoid it you can use setElementData local respawntime = 1500 -- time in ms after you get teleported (for example if you have 1500 ms you should write here 1600 or 1700 to prevent bugs) addEvent("serverRevivePlayer", true) addEventHandler("serverRevivePlayer", resourceRoot, function(targetPlayer) if isElement(targetPlayer) then local x, y, z = getElementPosition(targetPlayer) spawnPlayer(targetPlayer, x, y, z) setCameraTarget(targetPlayer, targetPlayer) exports.SAEGMessages:sendClientMessage("You got revived by: "..getPlayerName(client), targetPlayer,255,255,255) exports.SAEGMessages:sendClientMessage("You revived: "..getPlayerName(targetPlayer), client,255,255,255) setElementData(targetPlayer,"player:revived",true) setTimer(removeElementData,respawntime,1,targetPlayer,"player:revived") end end) you have to find another spawnPlayer function (onPlayerWasted event) and edit it like this: before spawnPlayer(player, x, y, z) setCameraTarget(player, player) after if not getElementData(player,"player:revived") then spawnPlayer(player, x, y, z) setCameraTarget(player, player) end Edited August 16, 2018 by JeViCo 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