Jump to content

Recommended Posts

Olá estou aqui com uns mods de empregos que permitem ganhar exp sempre que conclui o trabalho porem estava a funcionar perfeitamente mas depois de colocar o servidor na host começou  a aparecer este erro : "ERROR:[Agencia]/ir-lixeiro/Danilin_S.lua:147:attempt to perform arithmetic on a boolean value" e ja nao esta ganhando EXP

Alguem sabe resolver?

Apenas tem Server-Side


local Marker_Emprego = createMarker ( 2182.86792, -1982.49438 +6, 13.55141 -1, "cylinder", 1.5, 16, 111, 231, 50)
local Blip_Emprego = createBlipAttachedTo( Marker_Emprego, 11 )
local Veiculo = createVehicle( 408, 2178.33301, -1982.59888 +6, 13.55138 +0.5, 0, 0, 90 )
setBlipVisibleDistance(Blip_Emprego, 150)
setElementFrozen( Veiculo, true )
setVehicleDamageProof( Veiculo, true )
setVehicleLocked(Veiculo, true)

Marker_Aleatorios = 
 {   
   {2182.49585, -1996.44495, 13.54688},
   {2190.50732, -2002.93738, 13.54688},
   {2165.94678, -1986.73853, 13.55469},
   {2193.5373535156, -2009.6970214844, 13.55469},
   -- AS MESMA POS DA DE CIMA (PRA NÃO SAIR O MESMO TODA HORA)   
   {2190.50732, -2002.93738, 13.54688},
   {2182.49585, -1996.44495, 13.54688}, 
   {2193.5373535156, -2009.6970214844, 13.55469},
   {2165.94678, -1986.73853, 13.55469},
 }
 --[[
         ><><><><><><><><><><><><><><><><><><><><
         ><             Infos Trab             ><
         ><><><><><><><><><><><><><><><><><><><><
--]]
local Blip_Marcar = createBlipAttachedTo( Marker_Emprego, 0 )
setElementVisibleTo ( Blip_Marcar, root, false )
function Infos_Emprego ( source )
	local Emprego = getElementData ( source, "Emprego" )
	if Emprego == "Lixeiro" then
		if isElementVisibleTo ( Blip_Marcar, source ) then
			setElementVisibleTo ( Blip_Marcar, source, false )
			outputChatBoxInfo ( "Seu Local de Trabalho foi Desmarcado do Mapa!", source, 255, 165, 0, true )
		else
			setElementVisibleTo ( Blip_Marcar, source, true )
			outputChatBoxInfo ( "Seu Local de Trabalho foi Marcado no Mapa!", source, 255, 165, 0, true )
		end
	end	
end    
addCommandHandler ( "infos", Infos_Emprego )

--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><           Carregar Lixo            ><
         ><><><><><><><><><><><><><><><><><><><><
--]]
Object_Lixo = {}
Marker_Entregar = {}

function Pegar_Lixo (source) 			
	local Emprego = getElementData ( source, "Emprego" )
	local Px, Py, Pz = getElementPosition( Marker_Emprego )
	local Lixo = getElementData( source, "Lixo" )  
	local Random_Pos = math.random ( #Marker_Aleatorios )
	if not isPedInVehicle ( source ) then
		if isElementWithinMarker(source, Marker_Emprego) then
			if Lixo == false then 		
				if Emprego == "Lixeiro" then
					setPedAnimation( source, "CARRY", "liftup", 1.0, false )
					setTimer(function()
						if isElement( Object_Lixo[source] ) then destroyElement( Object_Lixo[source] ) end
						if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end
						setElementData(source, "Recompensa", 0)
						setPedAnimation( source, nil )
						setElementData( source, "Lixo", true )
						toggleControl( source, "jump", false )
						toggleControl( source, "fire", false )
						toggleControl(source, "aim_weapon", false)
						setPedAnimation( source, "CARRY", "crry_prtial", 4.1, true, true, true )
						Object_Lixo[source] = createObject( 1264, Px, Py, Pz )
						Marker_Entregar[source] = createMarker ( Marker_Aleatorios[Random_Pos][1], Marker_Aleatorios[Random_Pos][2], Marker_Aleatorios[Random_Pos][3] -2.2, "cylinder", 2.5, 16, 111, 231, 50)					
						setElementVisibleTo ( Marker_Entregar[source], root, false )
						setElementVisibleTo ( Marker_Entregar[source], source, true )
						addEventHandler("onMarkerHit", Marker_Entregar[source], Fim_Emprego)
						exports.bone_attach:attachElementToBone(Object_Lixo[source], source, 4, 0, 0.4, - 0.6, -90, 0, 0 )
					end, 1000, 1)
				else
					outputChatBoxError ( "Apenas lixeiros podem trabalhar aqui!", source, 255, 165, 0, true )
				end
			end
		end
	end
end	
addCommandHandler("lixo", Pegar_Lixo)

function Mensagem_Aviso (source)
	local Emprego = getElementData ( source, "Emprego" )
	if isPedInVehicle ( source ) then return end
	if Emprego == "Lixeiro" then
		if isElementWithinMarker(source, Marker_Emprego) then
			--outputChatBox ( "Digite /lixo para pegar no lixo!", source, 255, 165, 0, true )
		end
	end
end
addEventHandler("onMarkerHit", Marker_Emprego, Mensagem_Aviso)

--[[
         ><><><><><><><><><><><><><><><><><><><><
         ><           Entregar Lixo            ><
         ><><><><><><><><><><><><><><><><><><><><
--]]
function Fim_Emprego (source)
	local Xp = tonumber(getElementData(source, "minutes")) or 0
	local Lixo = getElementData( source, "Lixo" )	
	local Recompensa = math.random(25, 50)
	local Recompensaxp = math.random(25, 50)
	if not isPedInVehicle ( source ) then 
		if isElementWithinMarker(source, Marker_Entregar[source]) then
			if Lixo == true then    
				setPedAnimation( source, "CARRY", "putdwn", 1.0, false, false, false, true )  
				setTimer(function()
					if isElement( Object_Lixo[source] ) then destroyElement( Object_Lixo[source] ) end
					if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end
					setElementData( source, "Lixo", false )	
					toggleControl( source, "jump", true )
					toggleControl( source, "fire", true )
					toggleControl(source, "aim_weapon", true)
					setPedAnimation( source, "CARRY", "liftup", 0.0, false, false, false, false )
					--if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("Vip2")) then
						--setElementData(source, "Recompensa", Recompensa *2)
						--setElementData(source, "minutes", Xp + getElementData(source, "Recompensa"))
						--givePlayerMoney(source, getElementData(source, "Recompensa"))
						--triggerClientEvent(source, "addNotification", root, "#106FE7[ #ffffffVIP#106FE7 ] #ffffffVocê entregou o lixo e ganhou: "..getElementData(source, "Recompensa").."$", "sucesso")
					--elseif isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("Vip")) then
						--setElementData(source, "Recompensa", Recompensa *2)
						--setElementData(source, "minutes", Xp + getElementData(source, "Recompensa"))
						--givePlayerMoney(source, Recompensa)
						--triggerClientEvent(source, "addNotification", root, "#106FE7[ #ffffffVIP#106FE7 ] #ffffffVocê entregou o lixo e ganhou: "..getElementData(source, "Recompensa").."$", "sucesso")
					if isObjectInACLGroup("user." ..getAccountName(getPlayerAccount(source)), aclGetGroup("Everyone")) then
						setElementData(source, "Recompensa", Recompensa)
						givePlayerMoney(source, Recompensa)
						setElementData(source, "minutes", Xp + getElementData(source, "Recompensaxp"))
						if ( getElementData(source,"minutes") > 999 ) then
                        setElementData(source,"minutes",0)
                        setElementData(source,"Level",(getElementData(source,"Level") or 0) +1)
                        end
					end
				end, 1200, 1) 
			end
		end
	end
end	

addEventHandler( "onPlayerQuit", root,
  function()
	if isElement( Object_Lixo[source] ) then destroyElement( Object_Lixo[source] ) end
	if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end
  end)
  
addEventHandler( "onPlayerWasted", root,
  function()
	if isElement( Object_Lixo[source] ) then destroyElement( Object_Lixo[source] ) end
	if isElement( Marker_Entregar[source] ) then destroyElement( Marker_Entregar[source] ) end
	setElementData( source, "Lixo", false )	
	toggleControl( source, "jump", true )
	toggleControl( source, "fire", true )
	toggleControl(source, "aim_weapon", true)
  end)
  
function outputChatBoxInfo(text, player, ...)
	triggerClientEvent(player, "N3xT.dxNotification", root, tostring(text), "info")
end

function outputChatBoxError(text, player, ...)
	triggerClientEvent(player, "N3xT.dxNotification", root, tostring(text), "error")
end

 

Edited by ImSoCrzy
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...