Jump to content

Chat de Vehiculo


Serginix

Recommended Posts

Posted

Hola gente, estaba tratando de hacer un chat, para la gente q este en X Vehiculo, pero la verdad quede trabado, y no me da, quiero decir, se habre el chat, a el jugador q manda el mensaje, pero solo el... me pueden ayudar?...

habia hecho esto, los Binds estan por aparte xD

    
    function onChat(player,_,...) 
      local msg = table.concat({...}, " ") 
      local nick = getPlayerName(player) 
      local r,g,b = getTeamColor(getPlayerTeam(player)) 
      local gente = getVehicleOccupant (player) 
      for _,v in ipairs(getElementsByType("player")) do 
        if isPedInVehicle (player) then 
          outputChatBox("#FF00FF(VV)"..nick..": #FF0000"..msg.." *", player, r, g, b, true) -- intente con "gente" y con "_" pero nada.... 
        else 
          outputChatBox("Nesesitas estar en un Vehiculo para usar el Vehicle Chat", player, 255, 0, 0) 
        end 
      end 
    end 
    addCommandHandler("vv",onChat) 

La otra cosa, esq el mensaje q mandas, se habre 4 Veces en el chat.... haciendo un terrible Spam q dice lo mismo xD

Posted

Aver si te entiendo, este script tiene que enviar los menajes que el jugador X a todos los ocupantes del vehiculo que el jugador X este?

Posted

no exactamente Castillo.

digamos, tenemos X Vehiculo, en el Vehiculo tenemos 3 Jugadores... todo Ok?

Los jugadores del Vehiculo quieren hablar entre si, sin q nadie los vea, entonces usas el comando /vv y el mensaje q envia, solo se les vea a esos 3 Jugadores q estan ADENTRO del X Vehiculo.

no se si me exprese bien xD

Posted

Eso es lo que yo dije, no?

Proba con esto:

function onChat(player,_,...) 
    local msg = table.concat({...}, " ") 
    local nick = getPlayerName(player) 
    local r,g,b = getPlayerNametagColor(player) 
    local vehicle = getPedOccupiedVehicle(player) 
    local occupants = getVehicleOccupants(vehicle) 
    local seats = getVehicleMaxPassengers(vehicle) 
    if isPedInVehicle (player) then  
        for seat = 0, seats do 
        local occupant = occupants[seat] 
            if occupant and getElementType(occupant)=="player" then 
                outputChatBox("#FF00FF(VV)"..tostring(nick)..": #FF0000"..tostring(msg).." *", occupant, r, g, b, true) 
            end 
        end 
        else 
        outputChatBox("Nesesitas estar en un Vehiculo para usar el Vehicle Chat", player, 255, 0, 0) 
    end 
end 
addCommandHandler("vv",onChat) 

Posted

Pzzz, entonces lo q yo dije es mas bien lo q vos dijiste en otras palabras xDDDD

Y si funciono de JOya, gracias men, como siempre, eres la Hostia :D!

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...