Jump to content

[Ayuda] Privatizad autos por team


Atouk

Recommended Posts

Posted

Hola, queria saber como privatizar los autos por team, no por jugador, por team.

ejemplo: que al apretar el enter, sino sos del team no podes entrar al vehiculo.

que te diga tambien. No eres del clan (nombre del clan)

Posted

asi esta bien?

vehicle1 = createVehicle( 411, -3207.15234375, 404.6005859375, 1.4312574863434, 0, 0, 0 ) 
function private() 
    if ( source == vehicle1 ) then 
local playerTeam = getPlayerTeam ( source ) 
team = getTeamName  (  E.P.A.Z ) 
cancelEvent() 
outputChatBox("Este vehiculo esta reservado para el clan: E.P.A.Z . ", player, 255, 0, 0, false) 
else 
outputChatBox("Bienvenido al vehiculo de E.P.A.Z.", player, 0, 255, 0, false) 
end 
end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), private ) 

Posted
team = getTeamName  (  E.P.A.Z ) 

'getTeamName' te pide un elemento de team.

local playerTeam = getPlayerTeam ( source ) 

'source' es un vehiculo, no un jugador.

outputChatBox("Bienvenido al vehiculo de E.P.A.Z.", player, 0, 255, 0, false) 

'player' no esta definido.

Posted

no entendi mucho pero asi esta bien?

vehicle1 = createVehicle( 411, -3207.15234375, 404.6005859375, 1.4312574863434, 0, 0, 0 ) 
function private() 
    if ( source == vehicle1 ) then 
local playerTeam = getPlayerTeam ( player ) 
team = getTeamName  (  E.P.A.Z ) 
local player = getLocalPlayer ( ) 
cancelEvent() 
outputChatBox("Este vehiculo esta reservado para el clan: E.P.A.Z . ", player, 255, 0, 0, false) 
end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), private ) 

tenganme paciencia porfavor no soy tan bueno.

Posted

No, esta mal en varias cosas.

1: "player" no esta definido.

2: getTeamName se usa con un elemento de team.

3: getLocalPlayer es solo client side y tu script es server side.

Posted

Intenta así

vehicle1 = createVehicle( 411, -3207.15234375, 404.6005859375, 1.4312574863434, 0, 0, 0 ) 
  
function private ( thePlayer, seat, jacked ) 
    if ( source == vehicle1  ) and ( getPlayerTeam(thePlayer) and getTeamName(getPlayerTeam(thePlayer)) ~= "E.P.A.Z" ) then 
      outputChatBox("Este vehiculo esta reservado para el clan: E.P.A.Z", thePlayer, 255,90,0, true) 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), private) 

Posted
Intenta así
vehicle1 = createVehicle( 411, -3207.15234375, 404.6005859375, 1.4312574863434, 0, 0, 0 ) 
  
function private ( thePlayer, seat, jacked ) 
    if ( source == vehicle1  ) and ( getPlayerTeam(thePlayer) and getTeamName(getPlayerTeam(thePlayer)) ~= "E.P.A.Z" ) then 
      outputChatBox("Este vehiculo esta reservado para el clan: E.P.A.Z", thePlayer, 255,90,0, true) 
    end 
end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), private) 

Y donde cancelas el evento cuando el player entra al auto?.

Posted

Si lo creaste desde un mapa puedes usar:

getElementByID 

o si quieres privatizar todos los de un mismo mapa:

getResourceMapRootElement 
getElementsByType 

  • Recently Browsing   0 members

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