Sign in to follow this  
magicplayerc

Reconnect function after being stuck back with wanted level is done only that is not releasing the prisoner when it finishes the level what is the error help?

Recommended Posts

function diminuiestrela ()
	for _,jog in ipairs ( getElementsByType ('player') ) do		
local Serial =  getPlayerSerial(jog)
		if (  getElementData (jog, 'naprisao')  or getElementData (jog, 'navtr') or getElementData(ResourceEscolhido,""..Serial.."preso",true) ) then               
			setPlayerWantedLevel (jog, getPlayerWantedLevel(jog)-1)	
			
			if (  getPlayerWantedLevel (jog) < 1 ) then
				libera (jog)
			end	
		end		
			
	end	
	
	if ( i == 4 ) then
		i = 1
	else
		i = i +1
	end

	
end
setTimer (diminuiestrela, 40000, 10000)


function Logar ()
local Serial =  getPlayerSerial(source)
if getElementData(ResourceEscolhido,""..Serial.."preso",true) then
outputChatBox("Você deslogou Preso, e por isso foi adicionado 6 estrelas", source)
setPlayerWantedLevel ( source, 6 )
setElementInterior(source,6)
setElementPosition (source, 264.1, 77.9, 1001.0)
end
end
addEventHandler ( 'onPlayerLogin', getRootElement ( ),Logar)


function onPlayerSpawn()
	if getElementData(source, "preso") then
	outputChatBox("Você deslogou Preso, e por isso foi adicionado 6 estrelas", source)
     setElementInterior(source,6)
     setElementPosition (source, 264.1, 77.9, 1001.0)	
	end
end
addEventHandler("onPlayerSpawn", getRootElement, onPlayerSpawn)


function onSetTime()
	for _, jog in pairs(getElementsByType("player")) do
		if ( getElementData(jog,"naprisao"..getPlayerSerial(jog).."navtr") or ( getElementData(jog, "preso") ) ) then
			setPlayerWantedLevel(jog, getPlayerWantedLevel(jog)-1)
			if ( getPlayerWantedLevel(jog) == 0 ) then
				Liberar(jog)
			end
		end
	end
end	
setTimer(onSetTime, 60000, 0)

 

Edited by magicplayerc

Share this post


Link to post
function quitPreso()
	if getElementData(source, "preso") then
		local account = getPlayerAccount(source)
    	if (account) and not (isGuestAccount(account)) then
			setAccountData(account, "preso", true)
		end
	end
end
addEventHandler("onPlayerQuit", root, quitPreso)

function joinPreso()
	local account = getPlayerAccount(source)
	if getAccountData(account, "preso", true) then
		outputChatBox("Você deslogou Preso, e por isso foi adicionado 6 estrelas", source)
		setPlayerWantedLevel(source, 6)
		setElementInterior(source,6)
		setElementPosition(source, 264.1, 77.9, 1001.0)
		setElementData(source, "preso", true)
	end
end
addEventHandler("onPlayerLogin", root, joinPreso)

EDIT: Se eu entendi bem, isso deve funcionar.

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.