Tonyx97 Posted December 8, 2012 Share Posted December 8, 2012 Hola a todos, tengo una duda, quiero que con un comando, le salga un mensage a la persona especifica, y si el player que definimos no existe que ponga en chatbox "This player doesn't exist", yo lo consegui, pero me salia tantos mensages como players habia en el server. function llamar (thePlayer,commandName,player,text) if player then --Aqui debe de ir el codigo que les pido a ustedes, La ayuda. outputChatBox ("..(text)..", player, 255, 0, 0) end end addCommandHandler ("llamar", llamar) Link to comment
NodZen Posted December 8, 2012 Share Posted December 8, 2012 Usa isElement -- para saber si el player está o no getElementsByType -- para obtener el player Link to comment
BorderLine Posted December 8, 2012 Share Posted December 8, 2012 podrias usar esta funcion. Ve si funciona esa o remoldealo function llamar(player,cmd,playername,text) if playername and text then local player2 = findPlayerByName(playername) if player2 then outputChatBox ("..(text)..", player2, 255, 0, 0) end end end addCommandHandler("llamar",llamar) function findPlayerByName (name) local player = getPlayerFromName(name) if player then return player end for i, player in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(player):lower(),"#%x%x%x%x%x%x", ""), name:lower(), 1, true) then return player end end return false end Link to comment
Castillo Posted December 8, 2012 Share Posted December 8, 2012 @Tony: En este caso deberias usar getPlayerFromName, pero la funcion que Yakuza posteo sirve tambien. Link to comment
Recommended Posts