Jump to content

Sistema Samu por ID


Recommended Posts

Em vez de busca nick do jogador, busque o ID, um exemplo :

--/> Busca Pelo Nome !
addCommandHandler("curar", function(source, cmd, nome)
   local player = getPlayerFromPartialName(nome)
end)

--/> Busca Pelo ID ! Lembrando, precisa o jogador ser setado o ID por Elemento / ou aplicar conforme seu script.
addCommandHandler("curar", function(source, cmd, id)
   local player = getPlayerFromID(id)
end)

function getPlayerFromID ( id )
   for _, player in ipairs ( getElementsByType ( "player" ) ) do
   local player_id = getElementData ( player, "ID" )
      if ( player_id == tonumber(id) ) then
      player_nick = getPlayerName ( player )
      return player_nick
      end
   end		
end  

 

Edited by Angelo Pereira
Link to comment
1 hour ago, Angelo Pereira said:

Em vez de busca nick do jogador, busque o ID, um exemplo :


--/> Busca Pelo Nome !
addCommandHandler("curar", function(source, cmd, nome)
   local player = getPlayerFromPartialName(nome)
end)

--/> Busca Pelo ID ! Lembrando, precisa o jogador ser setado o ID por Elemento / ou aplicar conforme seu script.
addCommandHandler("curar", function(source, cmd, id)
   local player = getPlayerFromID(id)
end)

function getPlayerFromID ( id )
   for _, player in ipairs ( getElementsByType ( "player" ) ) do
   local player_id = getElementData ( player, "ID" )
      if ( player_id == tonumber(id) ) then
      player_nick = getPlayerName ( player )
      return player_nick
      end
   end		
end  

 

Tem discörd? Me explica uma coisinha sobre ID ?

 

Lucaas#0663

Link to comment
21 minutes ago, Lucas Pane said:

Tem discörd? Me explica uma coisinha sobre ID ?

 

Lucaas#0663

 Ângelo Pereira#4059

 

Caso seu ID for contado pelo ID por conta, faça assim :

addCommandHandler("curar", function(source, cmd, id)
   local player = getPlayerFromID(id)
   if player then
   end
end)

function getPlayerFromID ( id )
   for _, player in ipairs ( getElementsByType ( "player" ) ) do
   local id_account = getAccountID(getPlayerAccount(player)) 
      if ( id_account == tonumber(id) ) then
         player_nick = getPlayerName ( player )
         return player_nick
      end
   end		
end  

 

Edited by Angelo Pereira
Link to comment
  • 4 months later...
  • 1 month later...
On 11/02/2020 at 20:13, Angelo Pereira said:

 Ângelo Pereira#4059

 

Caso seu ID for contado pelo ID por conta, faça assim :


addCommandHandler("curar", function(source, cmd, id)
   local player = getPlayerFromID(id)
   if player then
   end
end)

function getPlayerFromID ( id )
   for _, player in ipairs ( getElementsByType ( "player" ) ) do
   local id_account = getAccountID(getPlayerAccount(player)) 
      if ( id_account == tonumber(id) ) then
         player_nick = getPlayerName ( player )
         return player_nick
      end
   end		
end  

 

te mandei pedido de amizade no dc aceita ae 

! ๖ۣۜζ͜͡Gustaz#1201 esse é o meu dc

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