'~DaLesTe^' Posted June 27, 2019 Share Posted June 27, 2019 Hello, I am trying to create a script where the player can not use a certain command when it receives damage. For example: "It is not possible to teleport in combat!" If a player receives damage, it is necessary to wait 10 seconds to be able to use life pickups and teleport. Thanks; Link to comment
KaMi Posted June 27, 2019 Share Posted June 27, 2019 (edited) use: onClientPlayerDamage setElementData setTimer Example: --Not tested local timeEffect = 10000 addEventHandler("onClientPlayerDamage", getLocalPlayer(), function() if ( getElementData( source, "antiEscape" ) == false ) then setElementData( source, "antiEscape", true ) setTimer( setElementData, timeEffect, 1, source, "antiEscape", false ) end end ) --Your teleport code addCommandHandler("teleport", function() if ( getElementData( localPlayer, "antiEscape" ) == false ) then --teleport code else outputChatBox("You can't escape !" ) end end ) Edited June 27, 2019 by <~KaMiKaZe~> Link to comment
'~DaLesTe^' Posted June 27, 2019 Author Share Posted June 27, 2019 (edited) Code: teleportes = { {"condominio", 2212.9479980469, 218.67300415039, 492.70068359375,"Foi para o Condominio"}, {"rampa4",-681.61298, -331.70407, 1065.12817,"Foi para a Rampa #4"}, {"rampa5",1580.10986, 1016.11517, 1336.80627,"Foi para a Rampa #5"}, {"batebate",-1416.758666992, 988.67651367188, 1024.0202636719,"Foi para a Pista de Bate-Bate"}, {"rally",-1435.75, -652.66406, 1054.9375,"Foi para a Pista de Rally"}, {"barco",-2303.12183, 1557.78577, 1.56776,"Foi para o Barco"}, {"racha",-4065.4763184594, -854.5, 454.79611206055,"Foi para a Pista de Racha"}, } --- your code local timeEffect = 10000 addEventHandler("onClientPlayerDamage", root, function() if ( getElementData( source, "antiEscape" ) == false ) then setElementData( source, "antiEscape", true ) setTimer( setElementData, timeEffect, 1, source, "antiEscape", false ) end end ) ---- local commandSpam = {} local playertag = getElementData(player,"gang.tag") or "" function pCommandSpam(comando) for k,v in pairs(teleportes) do if getElementDimension(source) == 0 then if getElementInterior(source) == 0 then if ( getElementData( source, "antiEscape" ) == false ) then -- here if comando == v[1] then if (not commandSpam[source]) then local veh = getPedOccupiedVehicle(source) setElementPosition ( source, v[2], v[3], v[4] ) if (veh) then setElementPosition ( veh, v[2], v[3], v[4] ) end if(v[5])then exports["killmessages2"]:outputMessage ( "#ffffff" ..playertag.. "".. getPlayerName(source) .."#ffffff(ID:" .. (getPlayerID(source) or "???") .. ")#AC0000 Foi Para "..v[5].." #ffffff(/" ..v[1].. ") ", root, 0, 255, 0, true ) outputChatBox( "#AC0000[TELE] #ffffff" ..playertag.. "".. getPlayerName(source) .."(ID:" .. (getPlayerID(source) or "???") .. ")#c4c4c4 você foi para /" ..v[1].. "", source, 0, 255, 0, true ) else outputChatBox("You can't escape !" ) -- here end end commandSpam[source] = 1 elseif (commandSpam[source] == 1) then cancelEvent() outputChatBox ( "Aguarde 5 segundos para se teleportar novamente!", source) else commandSpam[source] = commandSpam[source] + 1 end break end end end end end addEventHandler("onPlayerCommand", root, pCommandSpam) setTimer(function() commandSpam = {} end, 5000, 0) --- ignore function getPlayerFromID(id) return call(getResourceFromName("game_id2"), "getPlayerFromID", tonumber(id)) end function getPlayerID(player) return getElementData(player,"id") end Error: Edited June 27, 2019 by '~DaLesTe^' Link to comment
SycroX Posted June 27, 2019 Share Posted June 27, 2019 (edited) 13 hours ago, '~DaLesTe^' said: Code: teleportes = { {"condominio", 2212.9479980469, 218.67300415039, 492.70068359375,"Foi para o Condominio"}, {"rampa4",-681.61298, -331.70407, 1065.12817,"Foi para a Rampa #4"}, {"rampa5",1580.10986, 1016.11517, 1336.80627,"Foi para a Rampa #5"}, {"batebate",-1416.758666992, 988.67651367188, 1024.0202636719,"Foi para a Pista de Bate-Bate"}, {"rally",-1435.75, -652.66406, 1054.9375,"Foi para a Pista de Rally"}, {"barco",-2303.12183, 1557.78577, 1.56776,"Foi para o Barco"}, {"racha",-4065.4763184594, -854.5, 454.79611206055,"Foi para a Pista de Racha"}, } --- your code local timeEffect = 10000 addEventHandler("onClientPlayerDamage", root, function() if ( getElementData( source, "antiEscape" ) == false ) then setElementData( source, "antiEscape", true ) setTimer( setElementData, timeEffect, 1, source, "antiEscape", false ) end end ) ---- local commandSpam = {} local playertag = getElementData(player,"gang.tag") or "" function pCommandSpam(comando) for k,v in pairs(teleportes) do if getElementDimension(source) == 0 then if getElementInterior(source) == 0 then if ( getElementData( source, "antiEscape" ) == false ) then -- here if comando == v[1] then if (not commandSpam[source]) then local veh = getPedOccupiedVehicle(source) setElementPosition ( source, v[2], v[3], v[4] ) if (veh) then setElementPosition ( veh, v[2], v[3], v[4] ) end if(v[5])then exports["killmessages2"]:outputMessage ( "#ffffff" ..playertag.. "".. getPlayerName(source) .."#ffffff(ID:" .. (getPlayerID(source) or "???") .. ")#AC0000 Foi Para "..v[5].." #ffffff(/" ..v[1].. ") ", root, 0, 255, 0, true ) outputChatBox( "#AC0000[TELE] #ffffff" ..playertag.. "".. getPlayerName(source) .."(ID:" .. (getPlayerID(source) or "???") .. ")#c4c4c4 você foi para /" ..v[1].. "", source, 0, 255, 0, true ) else outputChatBox("You can't escape !" ) -- here end end commandSpam[source] = 1 elseif (commandSpam[source] == 1) then cancelEvent() outputChatBox ( "Aguarde 5 segundos para se teleportar novamente!", source) else commandSpam[source] = commandSpam[source] + 1 end break end end end end end addEventHandler("onPlayerCommand", root, pCommandSpam) setTimer(function() commandSpam = {} end, 5000, 0) --- ignore function getPlayerFromID(id) return call(getResourceFromName("game_id2"), "getPlayerFromID", tonumber(id)) end function getPlayerID(player) return getElementData(player,"id") end Error: i didn't understand anything from your code as you mixed the client side with server side and there were some unidentified variables there so i rewrote the code again + there was no need to use data , a simple table would be enough local CommandSpam , AntiTeleport , AfterDamageTeleportTime = {} , {} , 5000 Teleport = { {"condominio", 2212.9479980469, 218.67300415039, 492.70068359375, "Foi para o Condominio"}, {"rampa4", -681.61298, -331.70407, 1065.12817, "Foi para a Rampa #4"}, {"rampa5", 1580.10986, 1016.11517, 1336.80627, "Foi para a Rampa #5"}, {"batebate", -1416.758666992, 988.67651367188, 1024.0202636719, "Foi para a Pista de Bate-Bate"}, {"rally", -1435.75, -652.66406, 1054.9375, "Foi para a Pista de Rally"}, {"barco", -2303.12183, 1557.78577, 1.56776, "Foi para o Barco"}, {"racha", -4065.4763184594, -854.5, 454.79611206055, "Foi para a Pista de Racha"}, } addEventHandler ( "onPlayerCommand" , root , function ( Command ) if getElementDimension ( source ) == 0 and getElementInterior ( source ) == 0 then if not AntiTeleport [ source ] then if not CommandSpam [ source ] then for _ , Value in pairs ( Teleport ) do if Value [ 1 ] == Command then local Vehicle = getPedOccupiedVehicle ( Vehicle ) if Vehicle then setElementPosition ( Vehicle , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) else setElementPosition ( source , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) end if Value [ 5 ] then local playertag = getElementData ( source , "gang.tag" ) or "" exports["killmessages2"]:outputMessage ( "#ffffff" ..playertag.. "".. getPlayerName(source) .."#ffffff(ID:" .. (getPlayerID(source) or "???") .. ")#AC0000 Foi Para "..Value [ 5].." #ffffff(/" ..Value [ 1].. ") ", root, 0, 255, 0, true ) outputChatBox( "#AC0000[TELE] #ffffff" ..playertag.. "".. getPlayerName(source) .."(ID:" .. (getPlayerID(source) or "???") .. ")#c4c4c4 você foi para /" ..Value [ 1].. "", source, 0, 255, 0, true ) end CommandSpam [ source ] = setTimer ( function ( source ) CommandSpam [ source ] = false end , 5000 , 1 , source ) break end end else outputChatBox ( "Aguarde ".. (CommandSpam [ source ] and math.floor ( getTimerDetails ( CommandSpam [ source ] ) / 1000 ) or 5 ) .." segundos para se teleportar novamente!", source) end end end end ) addEventHandler ( "onPlayerDamage" , root , function ( ) if AntiTeleport [ source ] and isTimer ( AntiTeleport [ source ] ) then resetTimer ( AntiTeleport [ source ] ) return end AntiTeleport [ source ] = setTimer ( function ( source ) AntiTeleport [ source ] = false end , AfterDamageTeleportTime , 1 , source ) end ) --- ignore function getPlayerFromID(id) return call(getResourceFromName("game_id2"), "getPlayerFromID", tonumber(id)) end function getPlayerID(player) return getElementData(player,"id") end lol i always forget to use break Edited June 27, 2019 by #x1AhMeD-09 added break to end the loop Link to comment
'~DaLesTe^' Posted June 27, 2019 Author Share Posted June 27, 2019 3 hours ago, #x1AhMeD-09 said: i didn't understand anything from your code as you mixed the client side with server side and there were some unidentified variables there so i rewrote the code again + there was no need to use data , a simple table would be enough local CommandSpam , AntiTeleport , AfterDamageTeleportTime = {} , {} , 5000 Teleport = { {"condominio", 2212.9479980469, 218.67300415039, 492.70068359375, "Foi para o Condominio"}, {"rampa4", -681.61298, -331.70407, 1065.12817, "Foi para a Rampa #4"}, {"rampa5", 1580.10986, 1016.11517, 1336.80627, "Foi para a Rampa #5"}, {"batebate", -1416.758666992, 988.67651367188, 1024.0202636719, "Foi para a Pista de Bate-Bate"}, {"rally", -1435.75, -652.66406, 1054.9375, "Foi para a Pista de Rally"}, {"barco", -2303.12183, 1557.78577, 1.56776, "Foi para o Barco"}, {"racha", -4065.4763184594, -854.5, 454.79611206055, "Foi para a Pista de Racha"}, } addEventHandler ( "onPlayerCommand" , root , function ( Command ) if getElementDimension ( source ) == 0 and getElementInterior ( source ) == 0 then if not AntiTeleport [ source ] then if not CommandSpam [ source ] then for _ , Value in pairs ( Teleport ) do if Value [ 1 ] == Command then local Vehicle = getPedOccupiedVehicle ( Vehicle ) if Vehicle then setElementPosition ( Vehicle , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) else setElementPosition ( source , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) end if Value [ 5 ] then local playertag = getElementData ( source , "gang.tag" ) or "" exports["killmessages2"]:outputMessage ( "#ffffff" ..playertag.. "".. getPlayerName(source) .."#ffffff(ID:" .. (getPlayerID(source) or "???") .. ")#AC0000 Foi Para "..Value [ 5].." #ffffff(/" ..Value [ 1].. ") ", root, 0, 255, 0, true ) outputChatBox( "#AC0000[TELE] #ffffff" ..playertag.. "".. getPlayerName(source) .."(ID:" .. (getPlayerID(source) or "???") .. ")#c4c4c4 você foi para /" ..Value [ 1].. "", source, 0, 255, 0, true ) end CommandSpam [ source ] = setTimer ( function ( source ) CommandSpam [ source ] = false end , 5000 , 1 , source ) break end end else outputChatBox ( "Aguarde ".. (CommandSpam [ source ] and math.floor ( getTimerDetails ( CommandSpam [ source ] ) / 1000 ) or 5 ) .." segundos para se teleportar novamente!", source) end end end end ) addEventHandler ( "onPlayerDamage" , root , function ( ) if AntiTeleport [ source ] and isTimer ( AntiTeleport [ source ] ) then resetTimer ( AntiTeleport [ source ] ) return end AntiTeleport [ source ] = setTimer ( function ( source ) AntiTeleport [ source ] = false end , AfterDamageTeleportTime , 1 , source ) end ) --- ignore function getPlayerFromID(id) return call(getResourceFromName("game_id2"), "getPlayerFromID", tonumber(id)) end function getPlayerID(player) return getElementData(player,"id") end lol i always forget to use break How to put "it is not possible to teleport in combat" while the player tries to teleport? Link to comment
SycroX Posted June 28, 2019 Share Posted June 28, 2019 local CommandSpam , AntiTeleport , AfterDamageTeleportTime = {} , {} , 5000 Teleport = { {"condominio", 2212.9479980469, 218.67300415039, 492.70068359375, "Foi para o Condominio"}, {"rampa4", -681.61298, -331.70407, 1065.12817, "Foi para a Rampa #4"}, {"rampa5", 1580.10986, 1016.11517, 1336.80627, "Foi para a Rampa #5"}, {"batebate", -1416.758666992, 988.67651367188, 1024.0202636719, "Foi para a Pista de Bate-Bate"}, {"rally", -1435.75, -652.66406, 1054.9375, "Foi para a Pista de Rally"}, {"barco", -2303.12183, 1557.78577, 1.56776, "Foi para o Barco"}, {"racha", -4065.4763184594, -854.5, 454.79611206055, "Foi para a Pista de Racha"}, } addEventHandler ( "onPlayerCommand" , root , function ( Command ) if getElementDimension ( source ) == 0 and getElementInterior ( source ) == 0 then if not AntiTeleport [ source ] then if not CommandSpam [ source ] then for _ , Value in pairs ( Teleport ) do if Value [ 1 ] == Command then local Vehicle = getPedOccupiedVehicle ( Vehicle ) if Vehicle then setElementPosition ( Vehicle , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) else setElementPosition ( source , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) end if Value [ 5 ] then local playertag = getElementData ( source , "gang.tag" ) or "" exports["killmessages2"]:outputMessage ( "#ffffff" ..playertag.. "".. getPlayerName(source) .."#ffffff(ID:" .. (getPlayerID(source) or "???") .. ")#AC0000 Foi Para "..Value [ 5].." #ffffff(/" ..Value [ 1].. ") ", root, 0, 255, 0, true ) outputChatBox( "#AC0000[TELE] #ffffff" ..playertag.. "".. getPlayerName(source) .."(ID:" .. (getPlayerID(source) or "???") .. ")#c4c4c4 você foi para /" ..Value [ 1].. "", source, 0, 255, 0, true ) end CommandSpam [ source ] = setTimer ( function ( source ) CommandSpam [ source ] = false end , 5000 , 1 , source ) break end end else outputChatBox ( "Aguarde ".. (CommandSpam [ source ] and math.floor ( getTimerDetails ( CommandSpam [ source ] ) / 1000 ) or 5 ) .." segundos para se teleportar novamente!", source) end else outputChatBox ( "it is not possible to teleport in combat" , source , 255 , 0 , 0 , true ) end end end ) addEventHandler ( "onPlayerDamage" , root , function ( ) if AntiTeleport [ source ] and isTimer ( AntiTeleport [ source ] ) then resetTimer ( AntiTeleport [ source ] ) return end AntiTeleport [ source ] = setTimer ( function ( source ) AntiTeleport [ source ] = false end , AfterDamageTeleportTime , 1 , source ) end ) --- ignore function getPlayerFromID(id) return call(getResourceFromName("game_id2"), "getPlayerFromID", tonumber(id)) end function getPlayerID(player) return getElementData(player,"id") end Link to comment
'~DaLesTe^' Posted July 2, 2019 Author Share Posted July 2, 2019 On 28/06/2019 at 02:06, #x1AhMeD-09 said: local CommandSpam , AntiTeleport , AfterDamageTeleportTime = {} , {} , 5000 Teleport = { {"condominio", 2212.9479980469, 218.67300415039, 492.70068359375, "Foi para o Condominio"}, {"rampa4", -681.61298, -331.70407, 1065.12817, "Foi para a Rampa #4"}, {"rampa5", 1580.10986, 1016.11517, 1336.80627, "Foi para a Rampa #5"}, {"batebate", -1416.758666992, 988.67651367188, 1024.0202636719, "Foi para a Pista de Bate-Bate"}, {"rally", -1435.75, -652.66406, 1054.9375, "Foi para a Pista de Rally"}, {"barco", -2303.12183, 1557.78577, 1.56776, "Foi para o Barco"}, {"racha", -4065.4763184594, -854.5, 454.79611206055, "Foi para a Pista de Racha"}, } addEventHandler ( "onPlayerCommand" , root , function ( Command ) if getElementDimension ( source ) == 0 and getElementInterior ( source ) == 0 then if not AntiTeleport [ source ] then if not CommandSpam [ source ] then for _ , Value in pairs ( Teleport ) do if Value [ 1 ] == Command then local Vehicle = getPedOccupiedVehicle ( Vehicle ) if Vehicle then setElementPosition ( Vehicle , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) else setElementPosition ( source , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) end if Value [ 5 ] then local playertag = getElementData ( source , "gang.tag" ) or "" exports["killmessages2"]:outputMessage ( "#ffffff" ..playertag.. "".. getPlayerName(source) .."#ffffff(ID:" .. (getPlayerID(source) or "???") .. ")#AC0000 Foi Para "..Value [ 5].." #ffffff(/" ..Value [ 1].. ") ", root, 0, 255, 0, true ) outputChatBox( "#AC0000[TELE] #ffffff" ..playertag.. "".. getPlayerName(source) .."(ID:" .. (getPlayerID(source) or "???") .. ")#c4c4c4 você foi para /" ..Value [ 1].. "", source, 0, 255, 0, true ) end CommandSpam [ source ] = setTimer ( function ( source ) CommandSpam [ source ] = false end , 5000 , 1 , source ) break end end else outputChatBox ( "Aguarde ".. (CommandSpam [ source ] and math.floor ( getTimerDetails ( CommandSpam [ source ] ) / 1000 ) or 5 ) .." segundos para se teleportar novamente!", source) end else outputChatBox ( "it is not possible to teleport in combat" , source , 255 , 0 , 0 , true ) end end end ) addEventHandler ( "onPlayerDamage" , root , function ( ) if AntiTeleport [ source ] and isTimer ( AntiTeleport [ source ] ) then resetTimer ( AntiTeleport [ source ] ) return end AntiTeleport [ source ] = setTimer ( function ( source ) AntiTeleport [ source ] = false end , AfterDamageTeleportTime , 1 , source ) end ) --- ignore function getPlayerFromID(id) return call(getResourceFromName("game_id2"), "getPlayerFromID", tonumber(id)) end function getPlayerID(player) return getElementData(player,"id") end Okay, but it's spamming the messages: outputChatBox ( "Aguarde ".. (CommandSpam [ source ] and math.floor ( getTimerDetails ( CommandSpam [ source ] ) / 1000 ) or 5 ) .." segundos para se teleportar novamente!", source) and outputuhatBox ( "it is not possibl e to teleport in c omb at" , source , 255 , 0 , 0 , true ) ... on all kinds of commands I type, not just teleports. Link to comment
SycroX Posted July 3, 2019 Share Posted July 3, 2019 local CommandSpam , AntiTeleport , AfterDamageTeleportTime = {} , {} , 5000 Teleport = { {"condominio", 2212.9479980469, 218.67300415039, 492.70068359375, "Foi para o Condominio"}, {"rampa4", -681.61298, -331.70407, 1065.12817, "Foi para a Rampa #4"}, {"rampa5", 1580.10986, 1016.11517, 1336.80627, "Foi para a Rampa #5"}, {"batebate", -1416.758666992, 988.67651367188, 1024.0202636719, "Foi para a Pista de Bate-Bate"}, {"rally", -1435.75, -652.66406, 1054.9375, "Foi para a Pista de Rally"}, {"barco", -2303.12183, 1557.78577, 1.56776, "Foi para o Barco"}, {"racha", -4065.4763184594, -854.5, 454.79611206055, "Foi para a Pista de Racha"}, } addEventHandler ( "onPlayerCommand" , root , function ( Command ) if getElementDimension ( source ) == 0 and getElementInterior ( source ) == 0 then for _ , Value in pairs ( Teleport ) do if Value [ 1 ] == Command then if not AntiTeleport [ source ] then if not CommandSpam [ source ] then local Vehicle = getPedOccupiedVehicle ( Vehicle ) if Vehicle then setElementPosition ( Vehicle , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) else setElementPosition ( source , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) end if Value [ 5 ] then local playertag = getElementData ( source , "gang.tag" ) or "" exports["killmessages2"]:outputMessage ( "#ffffff" ..playertag.. "".. getPlayerName(source) .."#ffffff(ID:" .. (getPlayerID(source) or "???") .. ")#AC0000 Foi Para "..Value [ 5].." #ffffff(/" ..Value [ 1].. ") ", root, 0, 255, 0, true ) outputChatBox( "#AC0000[TELE] #ffffff" ..playertag.. "".. getPlayerName(source) .."(ID:" .. (getPlayerID(source) or "???") .. ")#c4c4c4 você foi para /" ..Value [ 1].. "", source, 0, 255, 0, true ) end CommandSpam [ source ] = setTimer ( function ( source ) CommandSpam [ source ] = false end , 5000 , 1 , source ) else outputChatBox ( "Aguarde ".. (CommandSpam [ source ] and math.floor ( getTimerDetails ( CommandSpam [ source ] ) / 1000 ) or 5 ) .." segundos para se teleportar novamente!", source) end else outputChatBox ( "it is not possible to teleport in combat" , source , 255 , 0 , 0 , true ) end break end end end end ) addEventHandler ( "onPlayerDamage" , root , function ( ) if AntiTeleport [ source ] and isTimer ( AntiTeleport [ source ] ) then resetTimer ( AntiTeleport [ source ] ) return end AntiTeleport [ source ] = setTimer ( function ( source ) AntiTeleport [ source ] = false end , AfterDamageTeleportTime , 1 , source ) end ) --- ignore function getPlayerFromID(id) return call(getResourceFromName("game_id2"), "getPlayerFromID", tonumber(id)) end function getPlayerID(player) return getElementData(player,"id") end Link to comment
'~DaLesTe^' Posted July 3, 2019 Author Share Posted July 3, 2019 9 hours ago, #x1AhMeD-09 said: local CommandSpam , AntiTeleport , AfterDamageTeleportTime = {} , {} , 5000Teleport = { {"condominio", 2212.9479980469, 218.67300415039, 492.70068359375, "Foi para o Condominio"}, {"rampa4", -681.61298, -331.70407, 1065.12817, "Foi para a Rampa #4"}, {"rampa5", 1580.10986, 1016.11517, 1336.80627, "Foi para a Rampa #5"}, {"batebate", -1416.758666992, 988.67651367188, 1024.0202636719, "Foi para a Pista de Bate-Bate"}, {"rally", -1435.75, -652.66406, 1054.9375, "Foi para a Pista de Rally"}, {"barco", -2303.12183, 1557.78577, 1.56776, "Foi para o Barco"}, {"racha", -4065.4763184594, -854.5, 454.79611206055, "Foi para a Pista de Racha"},}addEventHandler ( "onPlayerCommand" , root , function ( Command ) if getElementDimension ( source ) == 0 and getElementInterior ( source ) == 0 then for _ , Value in pairs ( Teleport ) do if Value [ 1 ] == Command then if not AntiTeleport [ source ] then if not CommandSpam [ source ] then local Vehicle = getPedOccupiedVehicle ( Vehicle ) if Vehicle then setElementPosition ( Vehicle , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) else setElementPosition ( source , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) end if Value [ 5 ] then local playertag = getElementData ( source , "gang.tag" ) or "" exports["killmessages2"]:outputMessage ( "#ffffff" ..playertag.. "".. getPlayerName(source) .."#ffffff(ID:" .. (getPlayerID(source) or "???") .. ")#AC0000 Foi Para "..Value [ 5].." #ffffff(/" ..Value [ 1].. ") ", root, 0, 255, 0, true ) outputChatBox( "#AC0000[TELE] #ffffff" ..playertag.. "".. getPlayerName(source) .."(ID:" .. (getPlayerID(source) or "???") .. ")#c4c4c4 você foi para /" ..Value [ 1].. "", source, 0, 255, 0, true ) end CommandSpam [ source ] = setTimer ( function ( source ) CommandSpam [ source ] = false end , 5000 , 1 , source ) else outputChatBox ( "Aguarde ".. (CommandSpam [ source ] and math.floor ( getTimerDetails ( CommandSpam [ source ] ) / 1000 ) or 5 ) .." segundos para se teleportar novamente!", source) end else outputChatBox ( "it is not possible to teleport in combat" , source , 255 , 0 , 0 , true ) end break end end endend )addEventHandler ( "onPlayerDamage" , root , function ( ) if AntiTeleport [ source ] and isTimer ( AntiTeleport [ source ] ) then resetTimer ( AntiTeleport [ source ] ) return end AntiTeleport [ source ] = setTimer ( function ( source ) AntiTeleport [ source ] = false end , AfterDamageTeleportTime , 1 , source )end )--- ignorefunction getPlayerFromID(id)return call(getResourceFromName("game_id2"), "getPlayerFromID", tonumber(id))end function getPlayerID(player)return getElementData(player,"id")end Thanks bro, but i have another error. Code: Spoiler local CommandSpam , AntiTeleport , AfterDamageTeleportTime = {} , {} , 5000 teleportes = { {"drift",-296.92343139648, 1539.3560791016, 75.5625,"Foi para a Pista de Drift"}, {"floresta",-1292.8233642578, -2159.5888671875, 22.212591171265,"Foi para a Floresta"}, {"bairro",770.75983886719, -673.3233032226, 366.39999389648,"Foi para o Bairro"}, {"mount",-2338.4633789063, -1623.2933349609, 483.70858764648,"Foi para o Mount Chilliad"}, {"praia",324, -1779, 5,"Foi para a Praia"}, {"pistals",1994, -2446, 14,"Foi para o Aeroporto de LS"}, {"pistalv",1498, 1528, 11,"Foi para o Aeroporto de LV"}, {"pistasf",-1339, 52, 15,"Foi para o Aeroporto de SF"}, {"favela",2249, -1047, 55,"Foi para a Favela"}, {"rampa1", -1594.1474609375, -254.13656616211, 476.79843139648,"Foi para a Rampa #1"}, {"paraquedas", 989.94641113281, -1621.0570068359, 2251.9091796875,"Foi saltar de Paraquedas"}, {"rampa2",1078.3706054688, 972.89129638672, 266.59530639648, "Foi para a Rampa #2"}, {"arena1", 3344.7109375, -2548.6672363281, 258.46493530273, "Foi para a Arena #1"}, {"arena2",-2280.0202636719, 2308.8525390625, 4.9635863304138,"Foi para a Arena #2"}, {"x2",1330.7166748047, 2136.0305175781, 11.015625,"Foi para a Arena X2"}, {"x1", -5307.2294921875, -205.81309509277, 4956.482421875, "Foi para a Arena X1"}, {"arrancada",406.13702392578, 2537.8151855469, 16.546295166016,"Foi para a Arrancada"}, {"rampa3",1461.7163818359, 341.52435302734, 665.28228759766,"Foi para a Rampa #3"}, {"cj",2488, -1670, 14,"Foi para a Casa do CJ"}, {"hospital",1178.1077880859, -1323.4639892578, 14.103762626648,"Foi para o Hospital"}, {"mount",-2338.4633789063, -1623.2933349609, 483.70858764648,"Foi para o Mount Chilliad"}, {"topo",860.58880615234, -2287.9299316406, 892.32263183594,"Foi para o Topo"}, {"arena4", 2287.1967773438, 672.9337685547, 10.671875,"Foi para a Arena #4"}, {"ammu", 2119.7568359375, 957.57293701172, 10.81298828125,"Foi para a Ammu"}, {"avenida", 2058.6020507813, 837.92016601563, 6.8843750953674,"Foi para a Avenida"}, {"banco", 2435.8037109375 , 2377.1762695313, 10.8203125,"Foi para o Banco"}, {"arena", 580.9580078125, -3076.4384765625, 10.0703125,"Foi para a Arena"}, {"corrida", 1006.9000244141, 2473.8000488281, 10.800000190735,"Foi para o Racha"}, {"condominio", 2212.9479980469, 218.67300415039, 492.70068359375, "Foi para o Condominio"}, {"rampa4", -681.61298, -331.70407, 1065.12817, "Foi para a Rampa #4"}, {"rampa5", 1580.10986, 1016.11517, 1336.80627, "Foi para a Rampa #5"}, {"batebate", -1416.758666992, 988.67651367188, 1024.0202636719, "Foi para a Pista de Bate-Bate"}, {"rally", -1435.75, -652.66406, 1054.9375, "Foi para a Pista de Rally"}, {"barco", -2303.12183, 1557.78577, 1.56776, "Foi para o Barco"}, {"racha", -4065.4763184594, -854.5, 454.79611206055, "Foi para a Pista de Racha"}, {"stunt", -696.53137207031, 1666.1668701172, 22.40781211853,"Foi para a Pista de Stunt"}, {"ausente",1431.7767333984, 1412.8642578125, 10.812978744507,"Foi para a Area de AFK"}, {"descida2", -1080.0048828125, -2505.6228027344, 511.46875,"Foi para a Descida #2"}, {"descida1", 156.01455688477, -2614.0886230469, 965.25469970703,"Foi para a Descida #1"}, {"topo2", 1487.5988769531, -2748.4904785156, 219.82795715332,"Foi para o Topo #2"}, {"parkour", 834.79278564453, -2048.9521484375, 12.8671875,"Foi para o Parkour"}, {"vila", -2942.1770019531, 469.8955078125, 4.9410625,"Foi para a Vila"}, {"x3", 429.4794921875, -2109.4052734375, 211.12655639648, "Foi para a Arena x3"}, {"tunel", 2585.1896972656, -1492.2657470703, 22.713787078857, "Foi para o Tunel"}, {"ilha", 565.68475341797, -3047.8254394531, 9.0342044830322, "Foi para a Ilha"}, {"descida3", -614.44104003906, 548.31243892484, 356.88537597656, "Foi para a Descida #3"}, {"x4", 1517, -1468, 64, "Foi para a Arena X4"}, {"garagem", -2012.9562988281, 292.6872253418, 34.390727996826, "Foi para a Garagem de Veiculos"}, {"duelo2", 1483.4633789063, -2395.7033691406, 553.82781982422, "Foi para a Arena de Duelo #2"}, {"arenalv", 2785, 912, 11, "Foi para a Arena de LV"}, {"dropper", 3000.626953125, -460.890625, 346.75357055664, "Foi para o Dropper"}, {"labirinto", 170.8897857666, -2834.3898925781, 442.42840576172, "Foi para o Labirinto"}, {"duelo", 3720.2368164063, 2941.6826171875, 297.2843629297, "Foi para a Arena de Duelo"}, {"praia2", 2856.8269042969, -1963.7368164063, 10.937321662903, "Foi para a Praia #2"}, {"basquete", 2782.2741699219, -2020.6383056641, 13.5546875, "Foi para a Arena de Basquete"}, {"fazenda", -1099.357421875, -1649.5495605469, 76.3671875, "Foi para a Fazenda"}, {"praia3", -2745.2783203125, -2575.21875, 3.8607654571533, "Foi para a Praia #3"}, {"arena3",211.42056274414, 1810.6236572266, 21.8671875, "Foi para a Arena #3"}, {"balada", 1053.4812011719, -1927.4565429688, 13.152410507202, "Foi para a Balada"}, {"arenadd", 3158.1001, -1990.1, 2.9, "Foi para a Arena DD"}, {"cinema", 1479.6149902344, -1705.2219238281, 15.5, "Foi para o Cinema"}, {"ar", 4874.4765625, -590.52325439453, 5709.6254882813, "Foi para a Arena no Ar"}, {"arena5", 2520.3178710938, -1504.2377929688, 23.82125, "Foi para a Arena #5"} , } addEventHandler ( "onPlayerCommand" , root , function ( Command ) if getElementDimension ( source ) == 0 and getElementInterior ( source ) == 0 then for _ , Value in pairs ( Teleport ) do if Value [ 1 ] == Command then if not AntiTeleport [ source ] then if not CommandSpam [ source ] then local Vehicle = getPedOccupiedVehicle ( Vehicle ) if Vehicle then setElementPosition ( Vehicle , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) else setElementPosition ( source , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) end if Value [ 5 ] then local playertag = getElementData ( source , "gang.tag" ) or "" exports["killmessages2"]:outputMessage ( "#ffffff" ..playertag.. "".. getPlayerName(source) .."#ffffff(ID:" .. (getPlayerID(source) or "???") .. ")#AC0000 Foi Para "..Value [ 5].." #ffffff(/" ..Value [ 1].. ") ", root, 0, 255, 0, true ) outputChatBox( "#AC0000[TELE] #ffffff" ..playertag.. "".. getPlayerName(source) .."(ID:" .. (getPlayerID(source) or "???") .. ")#c4c4c4 você foi para /" ..Value [ 1].. "", source, 0, 255, 0, true ) end CommandSpam [ source ] = setTimer ( function ( source ) CommandSpam [ source ] = false end , 5000 , 1 , source ) else outputChatBox ( "Aguarde ".. (CommandSpam [ source ] and math.floor ( getTimerDetails ( CommandSpam [ source ] ) / 1000 ) or 5 ) .." segundos para se teleportar novamente!", source) end else outputChatBox ( "it is not possible to teleport in combat" , source , 255 , 0 , 0 , true ) end break end end end end ) addEventHandler ( "onPlayerDamage" , root , function ( ) if AntiTeleport [ source ] and isTimer ( AntiTeleport [ source ] ) then resetTimer ( AntiTeleport [ source ] ) return end AntiTeleport [ source ] = setTimer ( function ( source ) AntiTeleport [ source ] = false end , AfterDamageTeleportTime , 1 , source ) end ) function getPlayerFromID(id) return call(getResourceFromName("game_id2"), "getPlayerFromID", tonumber(id)) end function getPlayerID(player) return getElementData(player,"id") end Error: Player can't teleport in vehicle bad argument #1 to 'pairs' (table expected, got nil) Link to comment
SycroX Posted July 3, 2019 Share Posted July 3, 2019 (edited) replace line 18 ( in my code ) = line 78 in your code this line local Vehicle = getPedOccupiedVehicle ( Vehicle ) with local Vehicle = getPedOccupiedVehicle ( source ) Edited July 3, 2019 by #x1AhMeD-09 Link to comment
'~DaLesTe^' Posted July 3, 2019 Author Share Posted July 3, 2019 12 minutes ago, #x1AhMeD-09 said: replace line 18 ( in my code ) = line 78 in your code this line local Vehicle = getPedOccupiedVehicle ( Vehicle ) with local Vehicle = getPedOccupiedVehicle ( source ) bad argument #1 to 'pairs' (table expected, got nil) Link to comment
SycroX Posted July 3, 2019 Share Posted July 3, 2019 local CommandSpam , AntiTeleport , AfterDamageTeleportTime = {} , {} , 5000 teleportes = { {"drift",-296.92343139648, 1539.3560791016, 75.5625,"Foi para a Pista de Drift"}, {"floresta",-1292.8233642578, -2159.5888671875, 22.212591171265,"Foi para a Floresta"}, {"bairro",770.75983886719, -673.3233032226, 366.39999389648,"Foi para o Bairro"}, {"mount",-2338.4633789063, -1623.2933349609, 483.70858764648,"Foi para o Mount Chilliad"}, {"praia",324, -1779, 5,"Foi para a Praia"}, {"pistals",1994, -2446, 14,"Foi para o Aeroporto de LS"}, {"pistalv",1498, 1528, 11,"Foi para o Aeroporto de LV"}, {"pistasf",-1339, 52, 15,"Foi para o Aeroporto de SF"}, {"favela",2249, -1047, 55,"Foi para a Favela"}, {"rampa1", -1594.1474609375, -254.13656616211, 476.79843139648,"Foi para a Rampa #1"}, {"paraquedas", 989.94641113281, -1621.0570068359, 2251.9091796875,"Foi saltar de Paraquedas"}, {"rampa2",1078.3706054688, 972.89129638672, 266.59530639648, "Foi para a Rampa #2"}, {"arena1", 3344.7109375, -2548.6672363281, 258.46493530273, "Foi para a Arena #1"}, {"arena2",-2280.0202636719, 2308.8525390625, 4.9635863304138,"Foi para a Arena #2"}, {"x2",1330.7166748047, 2136.0305175781, 11.015625,"Foi para a Arena X2"}, {"x1", -5307.2294921875, -205.81309509277, 4956.482421875, "Foi para a Arena X1"}, {"arrancada",406.13702392578, 2537.8151855469, 16.546295166016,"Foi para a Arrancada"}, {"rampa3",1461.7163818359, 341.52435302734, 665.28228759766,"Foi para a Rampa #3"}, {"cj",2488, -1670, 14,"Foi para a Casa do CJ"}, {"hospital",1178.1077880859, -1323.4639892578, 14.103762626648,"Foi para o Hospital"}, {"mount",-2338.4633789063, -1623.2933349609, 483.70858764648,"Foi para o Mount Chilliad"}, {"topo",860.58880615234, -2287.9299316406, 892.32263183594,"Foi para o Topo"}, {"arena4", 2287.1967773438, 672.9337685547, 10.671875,"Foi para a Arena #4"}, {"ammu", 2119.7568359375, 957.57293701172, 10.81298828125,"Foi para a Ammu"}, {"avenida", 2058.6020507813, 837.92016601563, 6.8843750953674,"Foi para a Avenida"}, {"banco", 2435.8037109375 , 2377.1762695313, 10.8203125,"Foi para o Banco"}, {"arena", 580.9580078125, -3076.4384765625, 10.0703125,"Foi para a Arena"}, {"corrida", 1006.9000244141, 2473.8000488281, 10.800000190735,"Foi para o Racha"}, {"condominio", 2212.9479980469, 218.67300415039, 492.70068359375, "Foi para o Condominio"}, {"rampa4", -681.61298, -331.70407, 1065.12817, "Foi para a Rampa #4"}, {"rampa5", 1580.10986, 1016.11517, 1336.80627, "Foi para a Rampa #5"}, {"batebate", -1416.758666992, 988.67651367188, 1024.0202636719, "Foi para a Pista de Bate-Bate"}, {"rally", -1435.75, -652.66406, 1054.9375, "Foi para a Pista de Rally"}, {"barco", -2303.12183, 1557.78577, 1.56776, "Foi para o Barco"}, {"racha", -4065.4763184594, -854.5, 454.79611206055, "Foi para a Pista de Racha"}, {"stunt", -696.53137207031, 1666.1668701172, 22.40781211853,"Foi para a Pista de Stunt"}, {"ausente",1431.7767333984, 1412.8642578125, 10.812978744507,"Foi para a Area de AFK"}, {"descida2", -1080.0048828125, -2505.6228027344, 511.46875,"Foi para a Descida #2"}, {"descida1", 156.01455688477, -2614.0886230469, 965.25469970703,"Foi para a Descida #1"}, {"topo2", 1487.5988769531, -2748.4904785156, 219.82795715332,"Foi para o Topo #2"}, {"parkour", 834.79278564453, -2048.9521484375, 12.8671875,"Foi para o Parkour"}, {"vila", -2942.1770019531, 469.8955078125, 4.9410625,"Foi para a Vila"}, {"x3", 429.4794921875, -2109.4052734375, 211.12655639648, "Foi para a Arena x3"}, {"tunel", 2585.1896972656, -1492.2657470703, 22.713787078857, "Foi para o Tunel"}, {"ilha", 565.68475341797, -3047.8254394531, 9.0342044830322, "Foi para a Ilha"}, {"descida3", -614.44104003906, 548.31243892484, 356.88537597656, "Foi para a Descida #3"}, {"x4", 1517, -1468, 64, "Foi para a Arena X4"}, {"garagem", -2012.9562988281, 292.6872253418, 34.390727996826, "Foi para a Garagem de Veiculos"}, {"duelo2", 1483.4633789063, -2395.7033691406, 553.82781982422, "Foi para a Arena de Duelo #2"}, {"arenalv", 2785, 912, 11, "Foi para a Arena de LV"}, {"dropper", 3000.626953125, -460.890625, 346.75357055664, "Foi para o Dropper"}, {"labirinto", 170.8897857666, -2834.3898925781, 442.42840576172, "Foi para o Labirinto"}, {"duelo", 3720.2368164063, 2941.6826171875, 297.2843629297, "Foi para a Arena de Duelo"}, {"praia2", 2856.8269042969, -1963.7368164063, 10.937321662903, "Foi para a Praia #2"}, {"basquete", 2782.2741699219, -2020.6383056641, 13.5546875, "Foi para a Arena de Basquete"}, {"fazenda", -1099.357421875, -1649.5495605469, 76.3671875, "Foi para a Fazenda"}, {"praia3", -2745.2783203125, -2575.21875, 3.8607654571533, "Foi para a Praia #3"}, {"arena3",211.42056274414, 1810.6236572266, 21.8671875, "Foi para a Arena #3"}, {"balada", 1053.4812011719, -1927.4565429688, 13.152410507202, "Foi para a Balada"}, {"arenadd", 3158.1001, -1990.1, 2.9, "Foi para a Arena DD"}, {"cinema", 1479.6149902344, -1705.2219238281, 15.5, "Foi para o Cinema"}, {"ar", 4874.4765625, -590.52325439453, 5709.6254882813, "Foi para a Arena no Ar"}, {"arena5", 2520.3178710938, -1504.2377929688, 23.82125, "Foi para a Arena #5"} , } addEventHandler ( "onPlayerCommand" , root , function ( Command ) if getElementDimension ( source ) == 0 and getElementInterior ( source ) == 0 then for _ , Value in pairs ( teleportes ) do if Value [ 1 ] == Command then if not AntiTeleport [ source ] then if not CommandSpam [ source ] then local Vehicle = getPedOccupiedVehicle ( source ) if Vehicle then setElementPosition ( Vehicle , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) else setElementPosition ( source , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) end if Value [ 5 ] then local playertag = getElementData ( source , "gang.tag" ) or "" exports["killmessages2"]:outputMessage ( "#ffffff" ..playertag.. "".. getPlayerName(source) .."#ffffff(ID:" .. (getPlayerID(source) or "???") .. ")#AC0000 Foi Para "..Value [ 5].." #ffffff(/" ..Value [ 1].. ") ", root, 0, 255, 0, true ) outputChatBox( "#AC0000[TELE] #ffffff" ..playertag.. "".. getPlayerName(source) .."(ID:" .. (getPlayerID(source) or "???") .. ")#c4c4c4 você foi para /" ..Value [ 1].. "", source, 0, 255, 0, true ) end CommandSpam [ source ] = setTimer ( function ( source ) CommandSpam [ source ] = false end , 5000 , 1 , source ) else outputChatBox ( "Aguarde ".. (CommandSpam [ source ] and math.floor ( getTimerDetails ( CommandSpam [ source ] ) / 1000 ) or 5 ) .." segundos para se teleportar novamente!", source) end else outputChatBox ( "it is not possible to teleport in combat" , source , 255 , 0 , 0 , true ) end break end end end end ) addEventHandler ( "onPlayerDamage" , root , function ( ) if AntiTeleport [ source ] and isTimer ( AntiTeleport [ source ] ) then resetTimer ( AntiTeleport [ source ] ) return end AntiTeleport [ source ] = setTimer ( function ( source ) AntiTeleport [ source ] = false end , AfterDamageTeleportTime , 1 , source ) end ) function getPlayerFromID(id) return call(getResourceFromName("game_id2"), "getPlayerFromID", tonumber(id)) end function getPlayerID(player) return getElementData(player,"id") end 1 Link to comment
'~DaLesTe^' Posted July 3, 2019 Author Share Posted July 3, 2019 3 hours ago, #x1AhMeD-09 said: local CommandSpam , AntiTeleport , AfterDamageTeleportTime = {} , {} , 5000teleportes = { {"drift",-296.92343139648, 1539.3560791016, 75.5625,"Foi para a Pista de Drift"}, {"floresta",-1292.8233642578, -2159.5888671875, 22.212591171265,"Foi para a Floresta"}, {"bairro",770.75983886719, -673.3233032226, 366.39999389648,"Foi para o Bairro"}, {"mount",-2338.4633789063, -1623.2933349609, 483.70858764648,"Foi para o Mount Chilliad"}, {"praia",324, -1779, 5,"Foi para a Praia"}, {"pistals",1994, -2446, 14,"Foi para o Aeroporto de LS"}, {"pistalv",1498, 1528, 11,"Foi para o Aeroporto de LV"}, {"pistasf",-1339, 52, 15,"Foi para o Aeroporto de SF"}, {"favela",2249, -1047, 55,"Foi para a Favela"}, {"rampa1", -1594.1474609375, -254.13656616211, 476.79843139648,"Foi para a Rampa #1"}, {"paraquedas", 989.94641113281, -1621.0570068359, 2251.9091796875,"Foi saltar de Paraquedas"}, {"rampa2",1078.3706054688, 972.89129638672, 266.59530639648, "Foi para a Rampa #2"}, {"arena1", 3344.7109375, -2548.6672363281, 258.46493530273, "Foi para a Arena #1"}, {"arena2",-2280.0202636719, 2308.8525390625, 4.9635863304138,"Foi para a Arena #2"}, {"x2",1330.7166748047, 2136.0305175781, 11.015625,"Foi para a Arena X2"}, {"x1", -5307.2294921875, -205.81309509277, 4956.482421875, "Foi para a Arena X1"}, {"arrancada",406.13702392578, 2537.8151855469, 16.546295166016,"Foi para a Arrancada"}, {"rampa3",1461.7163818359, 341.52435302734, 665.28228759766,"Foi para a Rampa #3"}, {"cj",2488, -1670, 14,"Foi para a Casa do CJ"}, {"hospital",1178.1077880859, -1323.4639892578, 14.103762626648,"Foi para o Hospital"}, {"mount",-2338.4633789063, -1623.2933349609, 483.70858764648,"Foi para o Mount Chilliad"}, {"topo",860.58880615234, -2287.9299316406, 892.32263183594,"Foi para o Topo"}, {"arena4", 2287.1967773438, 672.9337685547, 10.671875,"Foi para a Arena #4"}, {"ammu", 2119.7568359375, 957.57293701172, 10.81298828125,"Foi para a Ammu"}, {"avenida", 2058.6020507813, 837.92016601563, 6.8843750953674,"Foi para a Avenida"}, {"banco", 2435.8037109375 , 2377.1762695313, 10.8203125,"Foi para o Banco"}, {"arena", 580.9580078125, -3076.4384765625, 10.0703125,"Foi para a Arena"}, {"corrida", 1006.9000244141, 2473.8000488281, 10.800000190735,"Foi para o Racha"}, {"condominio", 2212.9479980469, 218.67300415039, 492.70068359375, "Foi para o Condominio"}, {"rampa4", -681.61298, -331.70407, 1065.12817, "Foi para a Rampa #4"}, {"rampa5", 1580.10986, 1016.11517, 1336.80627, "Foi para a Rampa #5"}, {"batebate", -1416.758666992, 988.67651367188, 1024.0202636719, "Foi para a Pista de Bate-Bate"}, {"rally", -1435.75, -652.66406, 1054.9375, "Foi para a Pista de Rally"}, {"barco", -2303.12183, 1557.78577, 1.56776, "Foi para o Barco"}, {"racha", -4065.4763184594, -854.5, 454.79611206055, "Foi para a Pista de Racha"}, {"stunt", -696.53137207031, 1666.1668701172, 22.40781211853,"Foi para a Pista de Stunt"}, {"ausente",1431.7767333984, 1412.8642578125, 10.812978744507,"Foi para a Area de AFK"}, {"descida2", -1080.0048828125, -2505.6228027344, 511.46875,"Foi para a Descida #2"}, {"descida1", 156.01455688477, -2614.0886230469, 965.25469970703,"Foi para a Descida #1"}, {"topo2", 1487.5988769531, -2748.4904785156, 219.82795715332,"Foi para o Topo #2"}, {"parkour", 834.79278564453, -2048.9521484375, 12.8671875,"Foi para o Parkour"}, {"vila", -2942.1770019531, 469.8955078125, 4.9410625,"Foi para a Vila"}, {"x3", 429.4794921875, -2109.4052734375, 211.12655639648, "Foi para a Arena x3"}, {"tunel", 2585.1896972656, -1492.2657470703, 22.713787078857, "Foi para o Tunel"}, {"ilha", 565.68475341797, -3047.8254394531, 9.0342044830322, "Foi para a Ilha"}, {"descida3", -614.44104003906, 548.31243892484, 356.88537597656, "Foi para a Descida #3"}, {"x4", 1517, -1468, 64, "Foi para a Arena X4"}, {"garagem", -2012.9562988281, 292.6872253418, 34.390727996826, "Foi para a Garagem de Veiculos"}, {"duelo2", 1483.4633789063, -2395.7033691406, 553.82781982422, "Foi para a Arena de Duelo #2"}, {"arenalv", 2785, 912, 11, "Foi para a Arena de LV"}, {"dropper", 3000.626953125, -460.890625, 346.75357055664, "Foi para o Dropper"}, {"labirinto", 170.8897857666, -2834.3898925781, 442.42840576172, "Foi para o Labirinto"}, {"duelo", 3720.2368164063, 2941.6826171875, 297.2843629297, "Foi para a Arena de Duelo"}, {"praia2", 2856.8269042969, -1963.7368164063, 10.937321662903, "Foi para a Praia #2"}, {"basquete", 2782.2741699219, -2020.6383056641, 13.5546875, "Foi para a Arena de Basquete"}, {"fazenda", -1099.357421875, -1649.5495605469, 76.3671875, "Foi para a Fazenda"}, {"praia3", -2745.2783203125, -2575.21875, 3.8607654571533, "Foi para a Praia #3"}, {"arena3",211.42056274414, 1810.6236572266, 21.8671875, "Foi para a Arena #3"}, {"balada", 1053.4812011719, -1927.4565429688, 13.152410507202, "Foi para a Balada"}, {"arenadd", 3158.1001, -1990.1, 2.9, "Foi para a Arena DD"}, {"cinema", 1479.6149902344, -1705.2219238281, 15.5, "Foi para o Cinema"}, {"ar", 4874.4765625, -590.52325439453, 5709.6254882813, "Foi para a Arena no Ar"}, {"arena5", 2520.3178710938, -1504.2377929688, 23.82125, "Foi para a Arena #5"},}addEventHandler ( "onPlayerCommand" , root , function ( Command ) if getElementDimension ( source ) == 0 and getElementInterior ( source ) == 0 then for _ , Value in pairs ( teleportes ) do if Value [ 1 ] == Command then if not AntiTeleport [ source ] then if not CommandSpam [ source ] then local Vehicle = getPedOccupiedVehicle ( source ) if Vehicle then setElementPosition ( Vehicle , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) else setElementPosition ( source , Value [ 2 ] , Value [ 3 ] , Value [ 4 ] ) end if Value [ 5 ] then local playertag = getElementData ( source , "gang.tag" ) or "" exports["killmessages2"]:outputMessage ( "#ffffff" ..playertag.. "".. getPlayerName(source) .."#ffffff(ID:" .. (getPlayerID(source) or "???") .. ")#AC0000 Foi Para "..Value [ 5].." #ffffff(/" ..Value [ 1].. ") ", root, 0, 255, 0, true ) outputChatBox( "#AC0000[TELE] #ffffff" ..playertag.. "".. getPlayerName(source) .."(ID:" .. (getPlayerID(source) or "???") .. ")#c4c4c4 você foi para /" ..Value [ 1].. "", source, 0, 255, 0, true ) end CommandSpam [ source ] = setTimer ( function ( source ) CommandSpam [ source ] = false end , 5000 , 1 , source ) else outputChatBox ( "Aguarde ".. (CommandSpam [ source ] and math.floor ( getTimerDetails ( CommandSpam [ source ] ) / 1000 ) or 5 ) .." segundos para se teleportar novamente!", source) end else outputChatBox ( "it is not possible to teleport in combat" , source , 255 , 0 , 0 , true ) end break end end endend )addEventHandler ( "onPlayerDamage" , root , function ( ) if AntiTeleport [ source ] and isTimer ( AntiTeleport [ source ] ) then resetTimer ( AntiTeleport [ source ] ) return end AntiTeleport [ source ] = setTimer ( function ( source ) AntiTeleport [ source ] = false end , AfterDamageTeleportTime , 1 , source )end )function getPlayerFromID(id)return call(getResourceFromName("game_id2"), "getPlayerFromID", tonumber(id))end function getPlayerID(player)return getElementData(player,"id")end Thanks very much. When the player receives damage wait 5 seconds to pickup health / armor how i put it ? if (getPickupType(pickup) == 1) then -- If it's an armour pickup cancelEvent() -- Cancel the event outputChatBox("Wait 5 seconds for pickups.", source, 255, 0, 0) 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