LucasBaker Posted May 15, 2013 Share Posted May 15, 2013 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 ) Link to comment
iPrestege Posted May 15, 2013 Share Posted May 15, 2013 -- # 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? Link to comment
Mega9 Posted May 15, 2013 Share Posted May 15, 2013 You are using two same command handlers for two different functions. And there is no need in getting player money (Line 13). Link to comment
LucasBaker Posted May 15, 2013 Author Share Posted May 15, 2013 -- # 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? Link to comment
iPrestege Posted May 15, 2013 Share Posted May 15, 2013 Do you mean you want to add the command handler 'pescar' just if you are on 493 boat ? Link to comment
LucasBaker Posted May 15, 2013 Author Share Posted May 15, 2013 Do you mean you want to add the command handler 'pescar' just if you are on 493 boat ? yes Link to comment
iPrestege Posted May 15, 2013 Share Posted May 15, 2013 -- # 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 ) Link to comment
LucasBaker Posted May 15, 2013 Author Share Posted May 15, 2013 -- # 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) Link to comment
LucasBaker Posted May 15, 2013 Author Share Posted May 15, 2013 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 ) Link to comment
iPrestege Posted May 15, 2013 Share Posted May 15, 2013 No i mean where's the / fish off command ?! Link to comment
LucasBaker Posted May 15, 2013 Author Share Posted May 15, 2013 No i mean where's the / fish off command ?! no :\\\ Link to comment
iPrestege Posted May 15, 2013 Share Posted May 15, 2013 Sorry but i can't understand you ! Link to comment
LucasBaker Posted May 15, 2013 Author Share Posted May 15, 2013 Sorry but i can't understand you ! resolved Link to comment
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