Template:Server client function
Jump to navigation
Jump to search
Code
function getPlayerFromAccountName(name) if name then for i,player in ipairs ( getElementsByType ("player") ) do local acc = getPlayerAccount (player) if not isGuestAccount (acc) then if getAccountName (acc) == name then return player end else return false end end else return false end end
Example
This example get player from account name by command
addCommandHandler ("getPlayerName", function (player,_,name) if name then local thePlayer = getPlayerFromAccountName (name) if thePlayer then outputChatBox (getPlayerName (thePlayer),player,255,255,255,true) else outputChatBox ("player not found !",player,255,0,0) end else outputChatBox ("type account name frist !",player,255,255,0) end end )
Author: ,#Na[W]aF'1000.