Jump to content

help script fishing


Recommended Posts

Posted

I am somewhat new on the scripts for mta, well this script makes anyone in a boat and type / fishing, will earn $ 500, but I think there's something wrong, I'm still new at it could someone help me?

Vehicles = { [493]=true } 
  
function marinha (thePlayer) 
    if ( Vehicles[getElementModel(source)] ) 
        cancelEvent() 
        outputChatBox ( "#B03060Você precisa estar dentro de um Barco para usar este comando ( /pescar )",thePlayer, 255, 255, 255, true ) 
     end 
  end 
  addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) 
addCommandHandler ( "pescar", marinha ) 
  
function gdinheiro (thePlayer) 
        getPlayerMoney(thePlayer) 
        givePlayerMoney ( thePlayer, 500 ) 
        outputChatBox ( "#FFFF00Você pescou um Peixe e ganhou R$500",thePlayer, 255, 255, 255, true ) 
end 
addCommandHandler ( "pescar", gdinheiro ) 

Posted

-- # Server Side 
function marinha (thePlayer) 
    if ( getElementModel ( source ) == 493 ) then 
         outputChatBox ( "#B03060Você precisa estar dentro de um Barco para usar este comando ( /pescar )",thePlayer, 255, 255, 255, true ) 
        cancelEvent( true ) 
     end 
  end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), marinha ) 
  
function gdinheiro (thePlayer) 
        getPlayerMoney(thePlayer) 
        givePlayerMoney ( thePlayer, 500 ) 
        outputChatBox ( "#FFFF00Você pescou um Peixe e ganhou R$500",thePlayer, 255, 255, 255, true ) 
end 
addCommandHandler ( "pescar", gdinheiro ) 

Does that what are you trying to do?

Posted

You are using two same command handlers for two different functions. And there is no need in getting player money (Line 13).

Posted
-- # Server Side 
function marinha (thePlayer) 
    if ( getElementModel ( source ) == 493 ) then 
         outputChatBox ( "#B03060Você precisa estar dentro de um Barco para usar este comando ( /pescar )",thePlayer, 255, 255, 255, true ) 
        cancelEvent( true ) 
     end 
  end 
addEventHandler ( "onVehicleStartEnter", getRootElement(), marinha ) 
  
function gdinheiro (thePlayer) 
        getPlayerMoney(thePlayer) 
        givePlayerMoney ( thePlayer, 500 ) 
        outputChatBox ( "#FFFF00Você pescou um Peixe e ganhou R$500",thePlayer, 255, 255, 255, true ) 
end 
addCommandHandler ( "pescar", gdinheiro ) 

Does that what are you trying to do?

I'm not trying to make a script that makes the player can only use the command / fish if you are in a boat, I'm newbie that could help me?

Posted

-- # Server Side 
addCommandHandler ( "pescar",  
function  ( player ) 
    local vehicle = getPedOccupiedVehicle ( player ) 
    if not vehicle then return end 
    if ( getElementModel ( vehicle ) == 493 ) then 
        givePlayerMoney ( player, 500 ) 
        outputChatBox ( "#FFFF00Você pescou um Peixe e ganhou R$500",player, 255, 255, 255, true ) 
    else 
        outputChatBox ( "#B03060Você precisa estar dentro de um Barco para usar este comando ( /pescar )",player, 255, 255, 255, true ) 
    end 
end 
) 
  
Posted
-- # Server Side 
addCommandHandler ( "pescar",  
function  ( player ) 
    local vehicle = getPedOccupiedVehicle ( player ) 
    if not vehicle then return end 
    if ( getElementModel ( vehicle ) == 493 ) then 
        givePlayerMoney ( player, 500 ) 
        outputChatBox ( "#FFFF00Você pescou um Peixe e ganhou R$500",player, 255, 255, 255, true ) 
    else 
        outputChatBox ( "#B03060Você precisa estar dentro de um Barco para usar este comando ( /pescar )",player, 255, 255, 255, true ) 
    end 
end 
) 
  

yes it worked now when I type / fish off the vehicle id 493 was displayed for outputChatBox ("# B03060Você must be within a boat for use this command (/ fish)," Player, 255, 255, 255, true)

Posted
Where's this command ?
outputChatBox ( "#FFFF00Você pescou um Peixe e ganhou R$500",player, 255, 255, 255, true ) 
    else 
        outputChatBox ( "#B03060Você precisa estar dentro de um Barco para usar este comando ( /pescar )",player, 255, 255, 255, true ) 
    end 
end 
) 

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