Jump to content

[AJUDA] Comandos no marker


Recommended Posts

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...

Link to comment

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. 

Link to comment
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  ) 

Link to comment
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.

Link to comment

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  ) 
  
  

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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