Jump to content

BUG no script de fome sede sono


Recommended Posts

2 minutes ago, Lord Henry said:

Da próxima vez poste na sessão adequada de Programação em Lua.

Mostre o script que vc está tentando fazer para que possamos identificar o problema.

Peço desculpas pois acabei de chegar no fórum e não tinha conhecimento de onde ficava a sessão de programação em Lua., to vendo as regras agora.

O script foi um da internet, o problema acho que está no servidor pois já testei 2 scripts diferentes e eles apresentam o mesmo "bug"

Link to comment
----------------------------------------------------------------------------------------------------------------------------------------

-- F O M E

----------------------------------------------------------------------------------------------------------------------------------------

-- True = Ligado
-- False = Desligado

Fome01 = true -- Marker 01
Fome02 = true -- Marker 02
Fome03 = false -- Marker 03
Fome04 = false -- Marker 04
Fome05 = false -- Marker 05
Fome06 = false -- Marker 06
Fome07 = false -- Marker 07
Fome08 = false -- Marker 08
Fome09 = false -- Marker 09
Fome10 = false -- Marker 10

-- Se Você quiser Colocar +1 Marker coloque True no Numero conforme o Marker

local RF = 20
local GF = 70
local BF = 230
local AlphaF = 95
local TamanhoMK = 1.2

if Fome01 == true then
MarkersFome = createMarker ( 370.93375, -6.48615, 1001.85889 -1, "cylinder", TamanhoMK, RF, GF, BF, AlphaF ) -- Marker 01
setElementDimension( MarkersFome, 0 )
setElementInterior ( MarkersFome, 9 )
end

if Fome02 == true then
MarkersFome2 = createMarker ( -787.98914, 500.49689, 1371.74219 -1, "cylinder", TamanhoMK, RF, GF, BF, AlphaF ) -- Marker 02
setElementDimension( MarkersFome2, 0 )
setElementInterior ( MarkersFome2, 1 )
end

if Fome03 == true then
MarkersFome3 = createMarker ( 0, 0, 0 -1, "cylinder", TamanhoMK, RF, GF, BF, AlphaF ) -- Marker 03
setElementDimension( MarkersFome3, 0 )
setElementInterior ( MarkersFome3, 0 )
end

if Fome04 == true then
MarkersFome4 = createMarker ( 0, 0, 0 -1, "cylinder", TamanhoMK, RF, GF, BF, AlphaF ) -- Marker 04
setElementDimension( MarkersFome4, 0 )
setElementInterior ( MarkersFome4, 0 )
end

if Fome05 == true then
MarkersFome5 = createMarker ( 0, 0, 0 -1, "cylinder", TamanhoMK, RF, GF, BF, AlphaF ) -- Marker 05
setElementDimension( MarkersFome5, 0 )
setElementInterior ( MarkersFome5, 0 )
end

if Fome06 == true then
MarkersFome6 = createMarker ( 0, 0, 0 -1, "cylinder", TamanhoMK, RF, GF, BF, AlphaF ) -- Marker 06
setElementDimension( MarkersFome6, 0 )
setElementInterior ( MarkersFome6, 0 )
end

if Fome07 == true then
MarkersFome7 = createMarker ( 0, 0, 0 -1, "cylinder", TamanhoMK, RF, GF, BF, AlphaF ) -- Marker 07
setElementDimension( MarkersFome7, 0 )
setElementInterior ( MarkersFome7, 0 )
end

if Fome08 == true then
MarkersFome8 = createMarker ( 0, 0, 0 -1, "cylinder", TamanhoMK, RF, GF, BF, AlphaF ) -- Marker 08
setElementDimension( MarkersFome8, 0 )
setElementInterior ( MarkersFome8, 0 )
end

if Fome09 == true then
MarkersFome9 = createMarker ( 0, 0, 0 -1, "cylinder", TamanhoMK, RF, GF, BF, AlphaF ) -- Marker 09
setElementDimension( MarkersFome9, 0 )
setElementInterior ( MarkersFome9, 0 )
end

if Fome10 == true then
MarkersFome10 = createMarker ( 0, 0, 0 -1, "cylinder", TamanhoMK, RF, GF, BF, AlphaF ) -- Marker 10
setElementDimension( MarkersFome10, 0 )
setElementInterior ( MarkersFome10, 0 )
end

----------------------------------------------------------------------------------------------------------------------------------------

function RemoverDinheiro01 ()
 takePlayerMoney ( source, 14 )
end
addEvent( "TH>RemoverDinheiro01", true )
addEventHandler( "TH>RemoverDinheiro01", root, RemoverDinheiro01 )

function RemoverDinheiro02 ()
 takePlayerMoney ( source, 15 )
end
addEvent( "TH>RemoverDinheiro02", true )
addEventHandler( "TH>RemoverDinheiro02", root, RemoverDinheiro02 )

function RemoverDinheiro03 ()
 takePlayerMoney ( source, 21 )
end
addEvent( "TH>RemoverDinheiro03", true )
addEventHandler( "TH>RemoverDinheiro03", root, RemoverDinheiro03 )

function RemoverDinheiro04 ()
 takePlayerMoney ( source, 21 )
end
addEvent( "TH>RemoverDinheiro04", true )
addEventHandler( "TH>RemoverDinheiro04", root, RemoverDinheiro04 )

function RemoverDinheiro05 ()
 takePlayerMoney ( source, 27 )
end
addEvent( "TH>RemoverDinheiro05", true )
addEventHandler( "TH>RemoverDinheiro05", root, RemoverDinheiro05 )

function RemoverDinheiro06 ()
 takePlayerMoney ( source, 30 )
end
addEvent( "TH>RemoverDinheiro06", true )
addEventHandler( "TH>RemoverDinheiro06", root, RemoverDinheiro06 )

----------------------------------------------------------------------------------------------------------------------------------------

if Fome01 == true then
function EntrarNoMarkerMsgFome ( hitElement, matchingDimension )	
    if isPedInVehicle ( hitElement ) then return end
	setElementData ( hitElement, "TH:NoMarker", true )
	triggerClientEvent ( hitElement, "Abrir:PainelLojaTH", root)
end
addEventHandler( "onMarkerHit", MarkersFome, EntrarNoMarkerMsgFome )

function SairDoMarkerMsgFome ( leaveElement, matchingDimension )
    if isPedInVehicle ( leaveElement ) then return end
	setElementData ( leaveElement, "TH:NoMarker", false )
	triggerClientEvent ( leaveElement, "Fechar:PainelLojaTH", root)
end
addEventHandler( "onMarkerLeave", MarkersFome, SairDoMarkerMsgFome )
end

----------------------------------------------------------------------------------------------------------------------------------------

if Fome02 == true then
function EntrarNoMarkerMsgFome ( hitElement, matchingDimension )	
    if isPedInVehicle ( hitElement ) then return end
	setElementData ( hitElement, "TH:NoMarker", true )
	triggerClientEvent ( hitElement, "Abrir:PainelLojaTH", root)
end
addEventHandler( "onMarkerHit", MarkersFome2, EntrarNoMarkerMsgFome )

function SairDoMarkerMsgFome ( leaveElement, matchingDimension )
    if isPedInVehicle ( leaveElement ) then return end
	setElementData ( leaveElement, "TH:NoMarker", false )
	triggerClientEvent ( leaveElement, "Fechar:PainelLojaTH", root)
end
addEventHandler( "onMarkerLeave", MarkersFome2, SairDoMarkerMsgFome )
end

----------------------------------------------------------------------------------------------------------------------------------------

if Fome03 == true then
function EntrarNoMarkerMsgFome ( hitElement, matchingDimension )	
    if isPedInVehicle ( hitElement ) then return end
	setElementData ( hitElement, "TH:NoMarker", true )
	triggerClientEvent ( hitElement, "Abrir:PainelLojaTH", root)
end
addEventHandler( "onMarkerHit", MarkersFome3, EntrarNoMarkerMsgFome )

function SairDoMarkerMsgFome ( leaveElement, matchingDimension )
    if isPedInVehicle ( leaveElement ) then return end
	setElementData ( leaveElement, "TH:NoMarker", false )
	triggerClientEvent ( leaveElement, "Fechar:PainelLojaTH", root)
end
addEventHandler( "onMarkerLeave", MarkersFome3, SairDoMarkerMsgFome )
end

----------------------------------------------------------------------------------------------------------------------------------------

if Fome04 == true then
function EntrarNoMarkerMsgFome ( hitElement, matchingDimension )	
    if isPedInVehicle ( hitElement ) then return end
	setElementData ( hitElement, "TH:NoMarker", true )
	triggerClientEvent ( hitElement, "Abrir:PainelLojaTH", root)
end
addEventHandler( "onMarkerHit", MarkersFome4, EntrarNoMarkerMsgFome )

function SairDoMarkerMsgFome ( leaveElement, matchingDimension )
    if isPedInVehicle ( leaveElement ) then return end
	setElementData ( leaveElement, "TH:NoMarker", false )
	triggerClientEvent ( leaveElement, "Fechar:PainelLojaTH", root)
end
addEventHandler( "onMarkerLeave", MarkersFome4, SairDoMarkerMsgFome )
end

----------------------------------------------------------------------------------------------------------------------------------------

if Fome05 == true then
function EntrarNoMarkerMsgFome ( hitElement, matchingDimension )	
    if isPedInVehicle ( hitElement ) then return end
	setElementData ( hitElement, "TH:NoMarker", true )
	triggerClientEvent ( hitElement, "Abrir:PainelLojaTH", root)
end
addEventHandler( "onMarkerHit", MarkersFome5, EntrarNoMarkerMsgFome )

function SairDoMarkerMsgFome ( leaveElement, matchingDimension )
    if isPedInVehicle ( leaveElement ) then return end
	setElementData ( leaveElement, "TH:NoMarker", false )
	triggerClientEvent ( leaveElement, "Fechar:PainelLojaTH", root)
end
addEventHandler( "onMarkerLeave", MarkersFome5, SairDoMarkerMsgFome )
end

----------------------------------------------------------------------------------------------------------------------------------------

if Fome06 == true then
function EntrarNoMarkerMsgFome ( hitElement, matchingDimension )	
    if isPedInVehicle ( hitElement ) then return end
	setElementData ( hitElement, "TH:NoMarker", true )
	triggerClientEvent ( hitElement, "Abrir:PainelLojaTH", root)
end
addEventHandler( "onMarkerHit", MarkersFome6, EntrarNoMarkerMsgFome )

function SairDoMarkerMsgFome ( leaveElement, matchingDimension )
    if isPedInVehicle ( leaveElement ) then return end
	setElementData ( leaveElement, "TH:NoMarker", false )
	triggerClientEvent ( leaveElement, "Fechar:PainelLojaTH", root)
end
addEventHandler( "onMarkerLeave", MarkersFome6, SairDoMarkerMsgFome )
end

----------------------------------------------------------------------------------------------------------------------------------------

if Fome07 == true then
function EntrarNoMarkerMsgFome ( hitElement, matchingDimension )	
    if isPedInVehicle ( hitElement ) then return end
	setElementData ( hitElement, "TH:NoMarker", true )
	triggerClientEvent ( hitElement, "Abrir:PainelLojaTH", root)
end
addEventHandler( "onMarkerHit", MarkersFome7, EntrarNoMarkerMsgFome )

function SairDoMarkerMsgFome ( leaveElement, matchingDimension )
    if isPedInVehicle ( leaveElement ) then return end
	setElementData ( leaveElement, "TH:NoMarker", false )
	triggerClientEvent ( leaveElement, "Fechar:PainelLojaTH", root)
end
addEventHandler( "onMarkerLeave", MarkersFome7, SairDoMarkerMsgFome )
end

----------------------------------------------------------------------------------------------------------------------------------------

if Fome08 == true then
function EntrarNoMarkerMsgFome ( hitElement, matchingDimension )	
    if isPedInVehicle ( hitElement ) then return end
	setElementData ( hitElement, "TH:NoMarker", true )
	triggerClientEvent ( hitElement, "Abrir:PainelLojaTH", root)
end
addEventHandler( "onMarkerHit", MarkersFome8, EntrarNoMarkerMsgFome )

function SairDoMarkerMsgFome ( leaveElement, matchingDimension )
    if isPedInVehicle ( leaveElement ) then return end
	setElementData ( leaveElement, "TH:NoMarker", false )
	triggerClientEvent ( leaveElement, "Fechar:PainelLojaTH", root)
end
addEventHandler( "onMarkerLeave", MarkersFome8, SairDoMarkerMsgFome )
end

----------------------------------------------------------------------------------------------------------------------------------------

if Fome09 == true then
function EntrarNoMarkerMsgFome ( hitElement, matchingDimension )	
    if isPedInVehicle ( hitElement ) then return end
	setElementData ( hitElement, "TH:NoMarker", true )
	triggerClientEvent ( hitElement, "Abrir:PainelLojaTH", root)
end
addEventHandler( "onMarkerHit", MarkersFome9, EntrarNoMarkerMsgFome )

function SairDoMarkerMsgFome ( leaveElement, matchingDimension )
    if isPedInVehicle ( leaveElement ) then return end
	setElementData ( leaveElement, "TH:NoMarker", false )
	triggerClientEvent ( leaveElement, "Fechar:PainelLojaTH", root)
end
addEventHandler( "onMarkerLeave", MarkersFome9, SairDoMarkerMsgFome )
end

----------------------------------------------------------------------------------------------------------------------------------------

if Fome10 == true then
function EntrarNoMarkerMsgFome ( hitElement, matchingDimension )	
    if isPedInVehicle ( hitElement ) then return end
	setElementData ( hitElement, "TH:NoMarker", true )
	triggerClientEvent ( hitElement, "Abrir:PainelLojaTH", root)
end
addEventHandler( "onMarkerHit", MarkersFome10, EntrarNoMarkerMsgFome )

function SairDoMarkerMsgFome ( leaveElement, matchingDimension )
    if isPedInVehicle ( leaveElement ) then return end
	setElementData ( leaveElement, "TH:NoMarker", false )
	triggerClientEvent ( leaveElement, "Fechar:PainelLojaTH", root)
end
addEventHandler( "onMarkerLeave", MarkersFome10, SairDoMarkerMsgFome )
end

----------------------------------------------------------------------------------------------------------------------------------------

function deslogar(acc)
	cancelEvent ()
end
addEventHandler("onPlayerLogout",getRootElement(),deslogar)

----------------------------------------------------------------------------------------------------------------------------------------

addEventHandler ("onPlayerLogin",root,function(_,Acc)
local FomeAcc2 = getAccountData ( Acc, "TH:Fome" )
  if FomeAcc2 == false then
   setElementData (source, "TH:Fome", 100)
   setElementData (source, "Fome:Logado", true)
   else
   setElementData (source, "TH:Fome", FomeAcc2 )
   setElementData (source, "Fome:Logado", true)
end
end)

----------------------------------------------------------------------------------------------------------------------------------------

function saveAccountDataFome ( account )
if isGuestAccount ( account ) then return false end
Player = getAccountPlayer (account)
Fomes = getElementData (Player, "TH:Fome" )
setAccountData (account,"TH:Fome",Fomes)
end

----------------------------------------------------------------------------------------------------------------------------------------

addEventHandler ( 'onPlayerQuit', root, function ( )
    local acc = getPlayerAccount ( source )
    saveAccountDataFome ( acc )
end )

----------------------------------------------------------------------------------------------------------------------------------------

addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), function( )        
 for _, plr in pairs( getElementsByType( "player" ) ) do 
 local Acc = getPlayerAccount (plr)
    if not isGuestAccount (Acc) then
    local FomeAcc = getAccountData (Acc,"TH:Fome")
        if FomeAcc == false then
        setElementData (plr,"TH:Fome",100)
		setElementData (plr, "Fome:Logado", true)
        else
        setElementData (plr,"TH:Fome",FomeAcc)
		setElementData (plr, "Fome:Logado", true)
        end
    end    
 end
 end)
 
----------------------------------------------------------------------------------------------------------------------------------------
 
addEventHandler ("onResourceStop",getResourceRootElement( getThisResource()),function()
for index,players in ipairs(getElementsByType("player")) do 
 local acc = getPlayerAccount ( players )
 saveAccountDataFome ( acc )
end
end)

----------------------------------------------------------------------------------------------------------------------------------------

-- S E D E

----------------------------------------------------------------------------------------------------------------------------------------

addEventHandler ("onPlayerLogin",root,function(_,Acc)
local SedeAcc2 = getAccountData ( Acc, "TH:Sede" )
  if SedeAcc2 == false then
   setElementData (source, "TH:Sede", 100)
   setElementData (source, "Sede:Logado", true)
   else
   setElementData (source, "TH:Sede", SedeAcc2 )
   setElementData (source, "Sede:Logado", true)
end
end)

----------------------------------------------------------------------------------------------------------------------------------------

function saveAccountDataSede ( account )
if isGuestAccount ( account ) then return false end
Player = getAccountPlayer (account)
Sedes = getElementData (Player, "TH:Sede" )
setAccountData (account,"TH:Sede",Sedes)
end

----------------------------------------------------------------------------------------------------------------------------------------

addEventHandler ( 'onPlayerQuit', root, function ( )
    local acc = getPlayerAccount ( source )
    saveAccountDataSede ( acc )
end )

----------------------------------------------------------------------------------------------------------------------------------------

addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), function( )        
 for _, plr in pairs( getElementsByType( "player" ) ) do 
 local Acc = getPlayerAccount (plr)
    if not isGuestAccount (Acc) then
    local SedeAcc = getAccountData (Acc,"TH:Sede")
        if SedeAcc == false then
        setElementData (plr,"TH:Sede",100)
		setElementData (plr, "Sede:Logado", true)
        else
        setElementData (plr,"TH:Sede",SedeAcc)
		setElementData (plr, "Sede:Logado", true)
        end
    end    
 end
 end)
 
----------------------------------------------------------------------------------------------------------------------------------------
 
addEventHandler ("onResourceStop",getResourceRootElement( getThisResource()),function()
for index,players in ipairs(getElementsByType("player")) do 
 local acc = getPlayerAccount ( players )
 saveAccountDataSede ( acc )
end
end)

----------------------------------------------------------------------------------------------------------------------------------------

-- S O N O

----------------------------------------------------------------------------------------------------------------------------------------

ValorParaDormir = 100
TempoDesmaiado = 10000 -- 10 Segundos ( Trocar no Client.Lua Tambem )
TempoDormir = 5000 -- 5 Segundos  ( Trocar no Client.Lua Tambem )
MensagemDormir = "[ Dormir ] - Digite /Dormir Para Deitar na Cama, Valor $100"

----------------------------------------------------------------------------------------------------------------------------------------

local R = 100
local G = 240
local B = 10
local Alpha = 50

MarkersDormir = createMarker ( 2237.60327, -1154.80420, 1029.79688 -1, "cylinder", 1.2, R, G, B, Alpha )
setElementDimension( MarkersDormir, 0 )
setElementInterior( MarkersDormir, 15 )

MarkersDormir2 = createMarker ( 2251.09009, -1158.48267, 1029.79688 -1, "cylinder", 1.2, R, G, B, Alpha )
setElementDimension( MarkersDormir2, 0 )
setElementInterior( MarkersDormir2, 15 )

MarkersDormir3 = createMarker ( 2237.59424, -1165.65015, 1029.79688 -1, "cylinder", 1.2, R, G, B, Alpha )
setElementDimension( MarkersDormir3, 0 )
setElementInterior( MarkersDormir3, 15 )

MarkersDormir4 = createMarker ( 2230.35449, -1184.99915, 1029.79688 -1, "cylinder", 1.2, R, G, B, Alpha )
setElementDimension( MarkersDormir4, 0 )
setElementInterior( MarkersDormir4, 15 )

MarkersDormir5 = createMarker ( 2204.83496, -1192.26233, 1029.79688 -1, "cylinder", 1.2, R, G, B, Alpha )
setElementDimension( MarkersDormir5, 0 )
setElementInterior( MarkersDormir5, 15 )

MarkersDormir6 = createMarker ( 2196.73730, -1177.74097, 1029.80432 -1, "cylinder", 1.2, R, G, B, Alpha )
setElementDimension( MarkersDormir6, 0 )
setElementInterior( MarkersDormir6, 15 )

MarkersDormir7 = createMarker ( 2196.85303, -1161.53381, 1029.79688 -1, "cylinder", 1.2, R, G, B, Alpha )
setElementDimension( MarkersDormir7, 0 )
setElementInterior( MarkersDormir7, 15 )

MarkersDormir8 = createMarker ( 2189.48853, -1152.31982, 1029.79688 -1, "cylinder", 1.2, R, G, B, Alpha )
setElementDimension( MarkersDormir8, 0 )
setElementInterior( MarkersDormir8, 15 )

----------------------------------------------------------------------------------------------------------------------------------------

function DormirNoMarker ( source )

if not getElementData ( source, "TH:LiberarComando" ) == true then outputChatBox ( "[ Dormir ] - Você Não esta Com Sono", source, 255, 255, 255, true ) return end
if getElementData ( source, "TH:Dormindo" ) == true then outputChatBox ( "[ Dormir ] - Você Ja esta Dormindo", source, 255, 255, 255, true ) return end

local iEW = isElementWithinMarker

local money = getPlayerMoney(source)
if money < ValorParaDormir then outputChatBox ( "[ Dormir ] - Dinheiro Insuficiente", source, 255, 255, 255, true ) return end
takePlayerMoney ( source, ValorParaDormir )

if iEW ( source, MarkersDormir ) then
ExeDormir ( source )
setElementPosition ( source, 2235.94873, -1154.69507, 1030.49426 )
setElementRotation ( source, 0, 0, 90)
setTimer ( setElementPosition, TempoDormir, 1, source, 2237.60327, -1154.80420, 1029.79688 )
end

if iEW ( source, MarkersDormir2 ) then
ExeDormir ( source )
setElementPosition ( source, 2252.91260, -1158.35510, 1030.44104 )
setElementRotation ( source, 0, 0, 90)
setTimer ( setElementPosition, TempoDormir, 1, source, 2251.09009, -1158.48267, 1029.79688 )
end

if iEW ( source, MarkersDormir3 ) then
ExeDormir ( source )
setElementPosition ( source, 2236.02246, -1165.37793, 1030.49426 )
setElementRotation ( source, 0, 0, 90)
setTimer ( setElementPosition, TempoDormir, 1, source, 2237.59424, -1165.65015, 1029.79688 )
end

if iEW ( source, MarkersDormir4 ) then
ExeDormir ( source )
setElementPosition ( source, 2230.88843, -1183.34521, 1030.52490 )
setElementRotation ( source, 0, 0, 0 )
setTimer ( setElementPosition, TempoDormir, 1, source, 2230.35449, -1184.99915, 1029.79688 )
end

if iEW ( source, MarkersDormir5 ) then
ExeDormir ( source )
setElementPosition ( source, 2204.31152, -1193.93835, 1030.52490 )
setElementRotation ( source, 0, 0, 180 )
setTimer ( setElementPosition, TempoDormir, 1, source, 2204.83496, -1192.26233, 1029.79688 )
end

if iEW ( source, MarkersDormir6 ) then
ExeDormir ( source )
setElementPosition ( source, 2198.53662, -1178.55664, 1030.49426 )
setElementRotation ( source, 0, 0, 270 )
setTimer ( setElementPosition, TempoDormir, 1, source, 2196.73730, -1177.74097, 1029.80432 )
end

if iEW ( source, MarkersDormir7 ) then
ExeDormir ( source )
setElementPosition ( source, 2198.47559, -1162.45532, 1030.49426 )
setElementRotation ( source, 0, 0, 270 )
setTimer ( setElementPosition, TempoDormir, 1, source, 2196.85303, -1161.53381, 1029.79688 )
end

if iEW ( source, MarkersDormir8 ) then
ExeDormir ( source )
setElementPosition ( source, 2187.92554, -1151.83484, 1030.49426 )
setElementRotation ( source, 0, 0, 90 )
setTimer ( setElementPosition, TempoDormir, 1, source, 2189.48853, -1152.31982, 1029.79688 )
end
end
addCommandHandler ( "dormir", DormirNoMarker )

----------------------------------------------------------------------------------------------------------------------------------------

function ExeDormir ( source )

setTimer ( setPedAnimation, 200, 1, source, "CRACK", "crckidle2" )

setElementData ( source, "TH:Sono", 100 )
setElementData ( source, "TH:Dormindo", true )
setElementData ( source, "TH:LiberarComando", false )

toggleAllControls ( source, false )

setTimer ( setElementData, TempoDormir, 1, source, "TH:Dormindo", false )
setTimer ( setElementData, TempoDormir, 1, source, "TH:Sono", 100 )
setTimer ( outputChatBox, TempoDormir, 1, "[ Dormir ] - Você Acordou !", source, 255, 255, 255, true )
setTimer ( toggleAllControls, TempoDormir, 1, source, true )
setTimer ( setPedAnimation, TempoDormir, 1, source, false )

end

----------------------------------------------------------------------------------------------------------------------------------------

function DesmaiouVacilou ()

local DinheiroPerdido = math.random(500,700)
takePlayerMoney ( source, DinheiroPerdido )
setTimer ( outputChatBox, TempoDesmaiado, 1, "[ Dormir ] - Você Desmaiou e Foi Roubado. Valor Perdido -$" .. DinheiroPerdido .. "", source, 255, 255, 255, true )

end
addEvent ("TH>RoubarDesmaiado",true) 
addEventHandler ("TH>RoubarDesmaiado", root, DesmaiouVacilou )

----------------------------------------------------------------------------------------------------------------------------------------

function EntrarNoMarkerMsgDormir ( hitElement, matchingDimension )
    if isPedInVehicle ( hitElement ) then return end
    outputChatBox ( MensagemDormir, hitElement, 255, 255, 255, true )
end
addEventHandler( "onMarkerHit", MarkersDormir, EntrarNoMarkerMsgDormir )

function EntrarNoMarkerMsgDormir ( hitElement, matchingDimension )
    if isPedInVehicle ( hitElement ) then return end
    outputChatBox ( MensagemDormir, hitElement, 255, 255, 255, true )
end
addEventHandler( "onMarkerHit", MarkersDormir2, EntrarNoMarkerMsgDormir )

function EntrarNoMarkerMsgDormir ( hitElement, matchingDimension )
    if isPedInVehicle ( hitElement ) then return end
    outputChatBox ( MensagemDormir, hitElement, 255, 255, 255, true )
end
addEventHandler( "onMarkerHit", MarkersDormir3, EntrarNoMarkerMsgDormir )

function EntrarNoMarkerMsgDormir ( hitElement, matchingDimension )
    if isPedInVehicle ( hitElement ) then return end
    outputChatBox ( MensagemDormir, hitElement, 255, 255, 255, true )
end
addEventHandler( "onMarkerHit", MarkersDormir4, EntrarNoMarkerMsgDormir )

function EntrarNoMarkerMsgDormir ( hitElement, matchingDimension )
    if isPedInVehicle ( hitElement ) then return end
    outputChatBox ( MensagemDormir, hitElement, 255, 255, 255, true )
end
addEventHandler( "onMarkerHit", MarkersDormir5, EntrarNoMarkerMsgDormir )

function EntrarNoMarkerMsgDormir ( hitElement, matchingDimension )
    if isPedInVehicle ( hitElement ) then return end
    outputChatBox ( MensagemDormir, hitElement, 255, 255, 255, true )
end
addEventHandler( "onMarkerHit", MarkersDormir6, EntrarNoMarkerMsgDormir )

function EntrarNoMarkerMsgDormir ( hitElement, matchingDimension )
    if isPedInVehicle ( hitElement ) then return end
    outputChatBox ( MensagemDormir, hitElement, 255, 255, 255, true )
end
addEventHandler( "onMarkerHit", MarkersDormir7, EntrarNoMarkerMsgDormir )

function EntrarNoMarkerMsgDormir ( hitElement, matchingDimension )
    if isPedInVehicle ( hitElement ) then return end
    outputChatBox ( MensagemDormir, hitElement, 255, 255, 255, true )
end
addEventHandler( "onMarkerHit", MarkersDormir8, EntrarNoMarkerMsgDormir )

----------------------------------------------------------------------------------------------------------------------------------------

addEventHandler ("onPlayerLogin",root,function(_,Acc)
local SonoAcc2 = getAccountData ( Acc, "TH:Sono" )
  if SonoAcc2 == false then
   setElementData (source, "TH:Sono", 100)
   setElementData (source, "Sono:Logado", true)
   else
   setElementData (source, "TH:Sono", SonoAcc2 )
   setElementData (source, "Sono:Logado", true)
end
end)

----------------------------------------------------------------------------------------------------------------------------------------

function saveAccountDataSono ( account )
if isGuestAccount ( account ) then return false end
Player = getAccountPlayer (account)
Sonos = getElementData (Player, "TH:Sono" )
setAccountData (account,"TH:Sono",Sonos)
end

----------------------------------------------------------------------------------------------------------------------------------------

addEventHandler ( 'onPlayerQuit', root, function ( )
    local acc = getPlayerAccount ( source )
    saveAccountDataSono ( acc )
end )

----------------------------------------------------------------------------------------------------------------------------------------

addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), function( )        
 for _, plr in pairs( getElementsByType( "player" ) ) do 
 local Acc = getPlayerAccount (plr)
    if not isGuestAccount (Acc) then
    local SonoAcc = getAccountData (Acc,"TH:Sono")
        if SonoAcc == false then
        setElementData (plr,"TH:Sono",100)
		setElementData (plr, "Sono:Logado", true)
        else
        setElementData (plr,"TH:Sono",SonoAcc)
		setElementData (plr, "Sono:Logado", true)
        end
    end    
 end
 end)
 
----------------------------------------------------------------------------------------------------------------------------------------
 
addEventHandler ("onResourceStop",getResourceRootElement( getThisResource()),function()
for index,players in ipairs(getElementsByType("player")) do 
 local acc = getPlayerAccount ( players )
 saveAccountDataSono ( acc )
end
end)

---------------------------------------------------------------------------------------------------------------------------------------- 

 

Link to comment

Mano, você precisa mostrar o client também..... já que o problema parece estar lá, oque você quer fazer é quando o jogador passar no marker o painel abrir apertando a tecla F11? E se apertar fora dele, nada acontece?

OBS: Tente otimizar esse código, da pra diminuir umas 100 linhas ++.

Link to comment
3 minutes ago, Jonas^ said:

Mano, você precisa mostrar o client também..... já que o problema parece estar lá, oque você quer fazer é quando o jogador passar no marker o painel abrir apertando a tecla F11? E se apertar fora dele, nada acontece?

OBS: Tente otimizar esse código, da pra diminuir umas 100 linhas ++.

era para abrir automaticamente, mas não está funcionando...

ah, e agora que percebi o script está compilado não tem como saber nada no client...

obrigado msm assim pela ajuda =/ 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...