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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.