Pedro Colto Posted March 30, 2015 Posted March 30, 2015 Como poderia criar um script assim tipo, "Quando o grupo POLICIA MILITAR entrar no carro o carro funcionaria normal, mais se algum player que não esteja no grupo POLICIA MILITAR entrasse no carro o motor não funcionar no caso não ligar", me ajudem ^^
manawydan Posted March 30, 2015 Posted March 30, 2015 voce pode fazer uma checagem por time: getPlayerTeam, e então se não for policia militar use um toggleControl, para retirar os controles de manipulacao de veiculo. "Querer não é poder, mas tentar é avançar"!
#RooTs Posted March 30, 2015 Posted March 30, 2015 Editado mana voce pode fazer uma checagem por time: getPlayerTeam , e então se não for policia militar use um toggleControl , para retirar os controles de manipulacao de veiculo.
Pedro Colto Posted March 30, 2015 Author Posted March 30, 2015 eu fis tipo assim está correto? ID_VEHICULO02 = 497 Vehiculo02 = createVehicle( ID_VEHICULO02, X02, Y02, Z02, RX02, RY02, RZ02) X02,Y02,Z02 = 1562.2846679688,-1613.2075195313,13.3828125 RX02,RY02,RZ02 = 0,0,0 function onClientPlayerEnterVehicle ( theVehicle, seat, jacked ) local team = getPlayerTeam(thePlayer) if team and getTeamName(team) == "Policia Militar" then toggleControl ( "accelerate", false ) -- disable the accelerate key toggleControl ( "brake_reverse", false ) -- disable the brake_reverse key toggleControl ( "handbrake", false ) -- disable the handbrake key setControlState ( "accelerate", false ) -- force the accelerate key on end addEventHandler ( "onClientPlayerVehicleEnter", Vehiculo02,onClientPlayerEnterVehicle )
#RooTs Posted March 30, 2015 Posted March 30, 2015 Não há necessidade de usar tantas variaveis desse jeito, apenas uma linha basta Vehiculo02 = createVehicle( 497, 1562.2846679688, -1613.2075195313, 13.3828125, 0, 0, 0) tente isso, ( não testado ) Vehiculo02 = createVehicle( 497, 1562.2846679688, -1613.2075195313, 13.3828125, 0, 0, 0) function EnterVehicle ( theVehicle, seat, jacked ) local team = getPlayerTeam(thePlayer) if team and getTeamName(team) == "Policia Militar" then toggleControl ( "accelerate", false ) -- disable the accelerate key toggleControl ( "brake_reverse", false ) -- disable the brake_reverse key toggleControl ( "handbrake", false ) -- disable the handbrake key setControlState ( "accelerate", false ) -- force the accelerate key on else toggleControl ( "accelerate", true ) toggleControl ( "brake_reverse", true ) toggleControl ( "handbrake", true ) setControlState ( "accelerate", true ) end addEventHandler ( "onClientPlayerVehicleEnter", Root, EnterVehicle )
xeon17 Posted March 30, 2015 Posted March 30, 2015 Você teve alguns erros em seu código RooTs, eu corrigi-los para você. Além disso, use o codigo no server side para evitar alguns problemas de sincronização. Vehiculo02 = createVehicle( 497, 1562.2846679688, -1613.2075195313, 13.3828125, 0, 0, 0) function EnterVehicle ( theVehicle, seat, jacked ) if getPlayerTeam(thePlayer) ~= getTeamFromName("Policia Militar") then toggleControl (thePlayer, "accelerate", false ) -- disable the accelerate key toggleControl ( thePlayer,"brake_reverse", false ) -- disable the brake_reverse key toggleControl ( thePlayer,"handbrake", false ) -- disable the handbrake key setControlState (thePlayer, "accelerate", false ) -- force the accelerate key on else toggleControl ( thePlayer,"accelerate", true ) toggleControl (thePlayer, "brake_reverse", true ) toggleControl (thePlayer, "handbrake", true ) setControlState ( thePlayer,"accelerate", true ) end end addEventHandler ( "onVehicleEnter", root, EnterVehicle ) A unique GangWar gamemode waiting for you!Click here for more information.
#RooTs Posted March 30, 2015 Posted March 30, 2015 Não tinha notado local theTeam = getPlayerTeam(thePlayer,getTeamFromName("Policia Militar")) if theTeam then e esqueci de fechar a if end
xeon17 Posted March 30, 2015 Posted March 30, 2015 Não tinha notado local theTeam = getPlayerTeam(thePlayer,getTeamFromName("Policia Militar")) if theTeam then e esqueci de fechar a if end Sobre que você está falando? A unique GangWar gamemode waiting for you!Click here for more information.
Banex Posted March 30, 2015 Posted March 30, 2015 tente isso Vehiculo02 = createVehicle( 497, 1562.2846679688, -1613.2075195313, 13.3828125, 0, 0, 0) function onVehicleEnter(player,seat,jacked) if seat == 0 and not jacked and getPlayerTeam(player) and getPlayerTeam(player) ~= getTeamFromName("Policia Militar") then setVehicleEngineState(source, false) end end addEventHandler("onVehicleEnter", Vehiculo02, onVehicleEnter) Not worry about the future. Very soon it will come.
#RooTs Posted March 30, 2015 Posted March 30, 2015 @Banex, não tem valor verdadeiro ou Falso se ele for ou não do Grupo ? Exemplo: if seat == 0 and not jacked and getPlayerTeam(player) and getPlayerTeam(player) ~= getTeamFromName("Policia Militar") then setVehicleEngineState(source, false) else setVehicleEngineState(source, true) end me corrija se eu estiver errado, por é errando que agente aprende
Banex Posted March 31, 2015 Posted March 31, 2015 @Banex, não tem valor verdadeiro ou Falso se ele for ou não do Grupo ? Sim, mas não tem necessidade de ligar o motor do veiculo se ele estiver no team, porque o padrão é ligar o motor quando entra em um veiculo. @~#Pedro, eu esqueci que o player podia não ter um team, tente isso Vehiculo02 = createVehicle( 497, 1562.2846679688, -1613.2075195313, 13.3828125, 0, 0, 0) function onVehicleEnter(player,seat,jacked) if seat == 0 and not jacked and getPlayerTeam(player) ~= getTeamFromName("Policia Militar") then setVehicleEngineState(source, false) end end addEventHandler("onVehicleEnter", Vehiculo02, onVehicleEnter) Not worry about the future. Very soon it will come.
#RooTs Posted March 31, 2015 Posted March 31, 2015 kkkkkk @Banex Só rindo mesmo, Xeon não entende as coisas e quer me zoar kkkkkkk tadinho, precisa aprender mais, pior que ele passa mais tempo que eu aqui no forum LOLLLLLL posso não saber o que é OOP mais eu do uma surra no Xeon em LUA VOLTANDO O ASSUNDO PARA NÃO IR TOPICOFF...... entendi Banex
Pedro Colto Posted March 31, 2015 Author Posted March 31, 2015 i man, ele pode ser melhor mais tbm não é assim vamos aprendendo né, sem tentar você não consegue criar ^^
xeon17 Posted March 31, 2015 Posted March 31, 2015 User has been banned for this post. A unique GangWar gamemode waiting for you!Click here for more information.
#RooTs Posted April 1, 2015 Posted April 1, 2015 i man, ele pode ser melhor mais tbm não é assim vamos aprendendo né, sem tentar você não consegue criar ^^ Verdade.
Pedro Colto Posted April 1, 2015 Author Posted April 1, 2015 @Banex, não tem valor verdadeiro ou Falso se ele for ou não do Grupo ? Sim, mas não tem necessidade de ligar o motor do veiculo se ele estiver no team, porque o padrão é ligar o motor quando entra em um veiculo. @~#Pedro, eu esqueci que o player podia não ter um team, tente isso Vehiculo02 = createVehicle( 497, 1562.2846679688, -1613.2075195313, 13.3828125, 0, 0, 0) function onVehicleEnter(player,seat,jacked) if seat == 0 and not jacked and getPlayerTeam(player) ~= getTeamFromName("Policia Militar") then setVehicleEngineState(source, false) end end addEventHandler("onVehicleEnter", Vehiculo02, onVehicleEnter) Tbm não funcionou.
RenanPG Posted April 1, 2015 Posted April 1, 2015 Finalmente baniram esses dois favelados, chega de off-topic. server-side veh = createVehicle( 497, 1562.2846679688, -1613.2075195313, 13.3828125, 0, 0, 0) addEventHandler("onVehicleEnter", veh, function(client, seat) if(seat == 0) then if(getPlayerTeam(client)) and (getPlayerTeam(client) == getTeamFromName("PM")) then setVehicleEngineState(source, true) else setVehicleEngineState(source, false) outputChatBox("Somente PMs são autorizados a utilizar este veiculo!", client, 255, 255, 255, true) end end end)
Banex Posted April 1, 2015 Posted April 1, 2015 não funcionou. ... Eu testei e funcionou bem. Algum erro no debugscript? Not worry about the future. Very soon it will come.
Pedro Colto Posted April 1, 2015 Author Posted April 1, 2015 não funcionou. ... Eu testei e funcionou bem. Algum erro no debugscript? vou rever e te falo ok.
Pedro Colto Posted April 1, 2015 Author Posted April 1, 2015 Ae, muito obrigado a vocês que me ajudaram (todos vocês do tópico na verdade ^^)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now