Jump to content

Salvar getElementData na conta do player


Recommended Posts

rapaziada

Vê se vcs conseguem me ajudar no seguinte ... eu tenho um script de loja de armas com porte ... esse porte funciona com base no getElementData porem toda vez que o jogador sai do servidor e entra de novo ele perde o porte .. Tem alguma maneira de salvar essa porte na conta dele ?

          
                  
                                      





 

Edited by JonhAfrei179
Link to comment
2 hours ago, Tommy. said:

usa:
getElementData
setElementData
getAccountData
setAccountData

 

Quando o jogador sair você usa o getElementData e setAccountData
Quando o jogar logar você usa o getAccountData e setElementData

Int ficaria algo parecido com isso ?

funtion aPorte (player)
     if getElementData( player, "porte" ) == false then
          setAccountData( player, "porte", true
          outputChatBox("texto"
end
end
addEventHandler("onMarkerHit", Mporte, aPorte )

 

Link to comment
  • Other Languages Moderators

Não. Está errado. Faça assim:

funtion aPorte (hitElement)
	if (hitElement and getElementType (hitElement) == "player") then
		local account = getPlayerAccount (hitElement)
		if (isGuestAccount (account)) then return end
		if (getElementData (hitElement, "porte")) then
			setAccountData (account, "porte", getElementData (hitElement, "porte"))
			outputChatBox ("Dados salvos na conta.", hitElement)
		else
			outputChatBox ("Não há dados para serem salvos na conta.", hitElement)
		end
	end
end
addEventHandler ("onMarkerHit", Mporte, aPorte)
Edited by Lord Henry
Corrigida a indentação.
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...