Jump to content

Podem me ajudar?


Recommended Posts

Posted

Boa noite galera, tenho um script de trabalho de mergulhador que ao passar em um CP aparece um painel e você pega o trampo, porém ao passar no CP para acabar o trampo você ganha o gold mas continua com a skin de mergulhador que deu, então queria que vocês me ajudassem com o comando para remover a skin, obrigado pela atenção e pela ajuda!

Segue o código >>

function startJobDiver ( thePlayer, seat, jacked )
if ( isElement ( objectmission ) ) then
	destroyElement ( objectmission ) end
	if ( isElement ( markertable ) ) then
	destroyElement ( markertable ) end
	if ( isElement ( markergobeach ) ) then
	destroyElement ( markergobeach ) end
	if ( isElement ( BlipDiver ) ) then
	destroyElement ( BlipDiver ) end
	local x, y, z = unpack ( Markers [ math.random ( #Markers ) ] )
	markertable = createMarker ( x, y, z, "cylinder", 5.0, 255, 0, 0, 0, theplayer )
	objectmission = createObject ( 1550, x, y, z ) 
	addEventHandler ( "onMarkerHit", markertable , goBeach )
	outputChatBox("Em algum lugar entre os objetos no fundo do mar há uma sacola de dinheiro, mergulhe e procure-a.", thePlayer, 255, 255, 0)
end



function goBeach ( thePlayer, seat, jacked )
	markergobeach = createMarker ( 2936.3999023438, -2052.8999023438, 3.5, "cylinder", 2, 255, 0, 0, 50, thePlayer )
	BlipDiver = createBlipAttachedTo ( markergobeach , 41, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer )
	if ( isElement ( objectmission ) ) then
	destroyElement ( objectmission ) end
	if ( isElement ( markertable ) ) then
	destroyElement ( markertable ) end
	outputChatBox("Você encontrou a sacola de dinheiro molhado, retorne até a praia.", thePlayer, 255, 255, 0)
	addEventHandler ( "onMarkerHit", markergobeach , donegobeach )
	
end

function donegobeach ( thePlayer )
	local TotalDiverjob = getElementData(thePlayer, "TotalpointDiverjob") or 0
    setElementData(thePlayer, "TotalpointDiverjob", TotalDiverjob + 1)
	givePlayerMoney ( thePlayer, 750 )
	startJobDiver ( thePlayer )
	outputChatBox("A sacola de dinheiro molhado foi aberta e você conseguiu recuperar $750,00.", thePlayer, 0, 255, 0)
	if ( isElement ( markergobeach ) ) then
	destroyElement ( markergobeach ) end
	if ( isElement ( BlipDiver ) ) then
	destroyElement ( BlipDiver ) end
end

 

Posted (edited)

Use setElementModel na função 'donegobeach'. Você quer volte a última skin ou apenas setar outra?

Se quiser setar a skin que o jogador estava, é só armazenar ela, com setElementData por exemplo. Também troque a função setPedSkin por setElementModel no evento "SkinDriver".

Salvando a skin do jogador:

addEvent("SkinDiver",true)
addEventHandler("SkinDiver",root,
function (skin)
	setElementData( source, "playerOriginalSkin", getElementModel(source), false )
	setElementModel ( source, 45 )
end
)

Setando na função 'donegobeach':

function donegobeach ( thePlayer )
	local TotalDiverjob = getElementData(thePlayer, "TotalpointDiverjob") or 0
	local playerSkin = getElementData( thePlayer, "playerOriginalSkin" ) or 0
	setElementData(thePlayer, "TotalpointDiverjob", TotalDiverjob + 1)
	setElementModel( thePlayer, playerSkin )
	removeElementData( thePlayer, "playerOriginalSkin" )
	givePlayerMoney ( thePlayer, 750 )
	startJobDiver ( thePlayer )
	outputChatBox("A sacola de dinheiro molhado foi aberta e você conseguiu recuperar $750,00.", thePlayer, 0, 255, 0)
	if ( isElement ( markergobeach ) ) then
	destroyElement ( markergobeach ) end
	if ( isElement ( BlipDiver ) ) then
	destroyElement ( BlipDiver ) end
end

 

Edited by DNL291
correção do elementdata

Please do not PM me with scripting related question nor support, use the forums instead.

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...