Mateuswiesner Posted March 4, 2014 Posted March 4, 2014 Queria saber se existe algum resource que permite que o jogador use o comando apenas dentro de algum marker Por exemplo: Para trabalhar em algum emprego queria q a pessoa tivesse que ir na Prefeitura, e lá eu iria colocar um marker, e apenas dentro desse marker a pessoa iria poder usar o comando "/taxista" , "/piloto" entre outros...
manawydan Posted March 4, 2014 Posted March 4, 2014 essa função é tudo o que voce precisa: isElementWithinMarker ela checa se um elemento esta em um marker
RenanPG Posted March 4, 2014 Posted March 4, 2014 Use esse script obtido da MTA wiki como base. dutymarker = createMarker(126.56, 254.98, 78.9, 'cylinder', 2.0, 255, 0, 0, 150) -------isso aqui forma um marker, coloque as coordenadas function duty(thePlayer, matchingDimension) if isElementWithinMarker(thePlayer, dutymarker) then ---- substitua essa parte pela sua função giveWeapon(thePlayer, 22, 100, 1) else outputChatBox("You are not at the right place!", thePlayer, 255, 0, 0) end end addCommandHandler("duty", duty) ------ aqui coloque o event ou command que quiser.
Mateuswiesner Posted March 4, 2014 Author Posted March 4, 2014 Mesmo assim a pessoa ainda pode usar o comando fora do marker
Mateuswiesner Posted March 4, 2014 Author Posted March 4, 2014 local posicoes = { { -1310.5999755859, -173.69999694824, 1090.0999755859 }, { -1310.5999755859, -173.69999694824, 1090.0999755859 }, { -1310.5999755859, -173.69999694824, 1090.0999755859 }, } function PosicaoPlayer ( thePlayer, command ) local azar = math.random ( #posicoes ) local veh = getPedOccupiedVehicle(thePlayer) if (veh) then setElementPosition(veh, unpack ( posicoes [ azar ] ) ) else setElementPosition(thePlayer, unpack ( posicoes [ azar ] ) ) end outputChatBox ( "#FFFFFF[#00FF00Tele#FFFFFF] ".. getPlayerName(thePlayer) .." #FFFFFFfoi para Mega Salto! (#00FF00/salto#FFFFFF)", root, 0, 255, 0, true ) end addCommandHandler ( "salto", PosicaoPlayer )
RenanPG Posted March 4, 2014 Posted March 4, 2014 local posicoes = { { -1310.5999755859, -173.69999694824, 1090.0999755859 }, { -1310.5999755859, -173.69999694824, 1090.0999755859 }, { -1310.5999755859, -173.69999694824, 1090.0999755859 }, } function PosicaoPlayer ( thePlayer, command ) local azar = math.random ( #posicoes ) local veh = getPedOccupiedVehicle(thePlayer) ------- aki o problema if (veh) then -------- aki tem que ser is ao inves de get setElementPosition(veh, unpack ( posicoes [ azar ] ) ) else setElementPosition(thePlayer, unpack ( posicoes [ azar ] ) ) end outputChatBox ( "#FFFFFF[#00FF00Tele#FFFFFF] ".. getPlayerName(thePlayer) .." #FFFFFFfoi para Mega Salto! (#00FF00/salto#FFFFFF)", root, 0, 255, 0, true ) end addCommandHandler ( "salto", PosicaoPlayer ) esse script provavalmente ira funcionar: (não testei) dutymarker = createMarker(126.56, 254.98, 78.9, 'cylinder', 2.0, 255, 0, 0, 150) local posicoes = { { -1310.5999755859, -173.69999694824, 1090.0999755859 }, { -1310.5999755859, -173.69999694824, 1090.0999755859 }, { -1310.5999755859, -173.69999694824, 1090.0999755859 }, } function PosicaoPlayer ( hitPlayer, commandName ) local azar = math.random ( #posicoes ) if isElementWithinMarker(hitPlayer, dutymarker) then if isPlayerInVehicle (hitPlayer) then setElementPosition(getPlayerOccupiedVehicle(hitPlayer), unpack ( posicoes [ azar ] )) else setElementPosition(hitPlayer, unpack ( posicoes [ azar ] ) ) end outputChatBox ('#ff0000[tele]' .. getPlayerName(hitPlayer) .. ' Foi para mega-salto', root, 255, 255, 255, true) else outputChatBox ('Comando disponivel somente dentro da marcação!', root, 255, 255, 255, true) end end addCommandHandler ( "salto", PosicaoPlayer ) agora so coloque para que funcione so dentro do marker.
DNL291 Posted March 4, 2014 Posted March 4, 2014 Use isPedInVehicle em vez de isPlayerInVehicle, pois esta função já é ultrapassada, como cita no MTA Wiki.
RenanPG Posted March 4, 2014 Posted March 4, 2014 Use isPedInVehicle em vez de isPlayerInVehicle, pois esta função já é ultrapassada, como cita no MTA Wiki. Valeu DNL, esqueci de mencionar isso. retirei de antigo script de teleportes. So tira Player e por Ped
RenanPG Posted March 4, 2014 Posted March 4, 2014 Testei aqui e esta funcionando, tanto com teleporte de carro ou player. dutymarker = createMarker(126.56, 254.98, 78.9, 'cylinder', 2.0, 255, 0, 0, 150) local posicoes = { { -1310.5999755859, -173.69999694824, 1090.0999755859 }, { -1310.5999755859, -173.69999694824, 1090.0999755859 }, { -1310.5999755859, -173.69999694824, 1090.0999755859 }, } function PosicaoPlayer ( hitPlayer, commandName ) local azar = math.random ( #posicoes ) if isElementWithinMarker(hitPlayer, dutymarker) then if isPedInVehicle (hitPlayer) then setElementPosition(getPedOccupiedVehicle(hitPlayer), unpack ( posicoes [ azar ] )) else setElementPosition(hitPlayer, unpack ( posicoes [ azar ] ) ) end outputChatBox ('#ff0000[tele]' .. getPedName(hitPlayer) .. ' Foi para mega-salto', root, 255, 255, 255, true) else outputChatBox ('Comando disponivel somente dentro da marcação!', root, 255, 255, 255, true) end end addCommandHandler ( "salto", PosicaoPlayer )
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