andrex123 Posted July 24, 2012 Posted July 24, 2012 policias = createTeam ("Policias", 0, 0, 255) function apuertap () local equipo = getPlayersInTeam ( policias ) if (equipo) then outputChatBox("hola", source) else outputChatBox("No eres policia", source) end end addCommandHandler ("app", apuertap) La idea de este script es que: -Al escrivir /app Le muestre el mensaje ("Hola") a un jugador que esta en el team policia, si no lo es, le diga " No eres policia" El error: Le dise Hola a todo el mundo no importa el team... Que esta mal?
Castillo Posted July 24, 2012 Posted July 24, 2012 1: 'source' no esta definido, osea que enviara el mensaje a todo el servidor. 2: getPlayersInTeam no se usa para saber si un jugador esta en ese team, para eso necesitas obtener el team del jugador con: getPlayerTeam y compararlo.
andrex123 Posted July 24, 2012 Author Posted July 24, 2012 :c e intentado pero no se como compararlo..., Hasta ahora se que tengo que usar : equipo = getPlayersInTeam ( policias) jugadore = getPlayerTeam ( thePlayer ) ... como comparo si el jugador esta en el Team o no?...
andrex123 Posted July 24, 2012 Author Posted July 24, 2012 Pero como sabre que jugadores estan el equipo?, y como lo podre comparar?
NodZen Posted July 25, 2012 Posted July 25, 2012 Y como hago esa cosa de compararlo ?... Con getPlayerTeam , obtiene el team del player... algo asi ... local playerTeam = getPlayerTeam ( source ) -- obtiene el team del jugador if ( playerTeam ) then
JuanM27 Posted July 26, 2012 Posted July 26, 2012 function apuertap () local equipo = getPlayerTeam ( source ) --obtienes el team del player if (equipo == "Policias") then --el policia es el tean a comprobar que sea el player outputChatBox("hola", source) --si es policia le dice hola else outputChatBox("No eres policia", source) --si no es policia le dice que no es... end end addCommandHandler ("app", apuertap)
andrex123 Posted July 26, 2012 Author Posted July 26, 2012 aaaa no sabia lo del if (equipo == "Policias") then Gracias
Recommended Posts