K4stic Posted January 6, 2013 Posted January 6, 2013 addEventHandler("onMarkerHit", finish, function (thePlayer) if ( getElementType ( thePlayer)) == "player" then local fishes = getElementData( thePlayer, "fishes") outputChatBox ( "You have sold "..fishes.." fishes and earned #00FF00$"..fishes * 3,thePlayer) givePlayerMoney ( thePlayer,fishes* 3 ) setElementData ( thePlayer, "fishes", 0, false) end end ) it's output me error => server.lua:5: attempt to concatenate local 'fishes' (a boolean value) Giving a Fuck? Nope, That isn't in My Skill Set
Alexs Posted January 6, 2013 Posted January 6, 2013 Maybe the player haven't fishes. addEventHandler("onMarkerHit", finish, function (thePlayer) if ( getElementType ( thePlayer)) == "player" then local fishes = getElementData( thePlayer, "fishes") or 0 outputChatBox ( "You have sold "..fishes.." fishes and earned #00FF00$"..fishes * 3,thePlayer) givePlayerMoney ( thePlayer,fishes* 3 ) setElementData ( thePlayer, "fishes", 0, false) end end ) Developer @ MYVAL
K4stic Posted January 6, 2013 Author Posted January 6, 2013 (edited) thx Alexs_Steel that part work Now new problem --client side function getheVehicleSpeed() return (x^2 + y^2 + z^2) ^ 0.5 end addEvent ("enableFishermanMission",true) addEventHandler ("enableFishermanMission",getRootElement(), function() if (source == getLocalPlayer()) then addEventHandler ("onClientRender",getRootElement(),FishermanGUIText) end checkfishesbleh = setTimer( function() kmh = math.floor( getheVehicleSpeed( getPedOccupiedVehicle(getLocalPlayer()), getElementVelocity (getPedOccupiedVehicle(getLocalPlayer())) ) * 100 * 1.61 ) curfish = getElementData(getPedOccupiedVehicle(getLocalPlayer()),"fishes") if curfish > 499 then setElementData(getPedOccupiedVehicle(getLocalPlayer()),"fishes",500) else if kmh >= 20 then setElementData(getPedOccupiedVehicle(getLocalPlayer()),"fishes",curfish + math.random(1,4)) end end end ,5000,0) end ) No error's just it not give fishes Edited January 6, 2013 by Guest Giving a Fuck? Nope, That isn't in My Skill Set
abu5lf Posted January 6, 2013 Posted January 6, 2013 (edited) thx Alexs_Steel that part workNow new problem --client side function getheVehicleSpeed() return (x^2 + y^2 + z^2) ^ 0.5 end addEvent ("enableFishermanMission",true) addEventHandler ("enableFishermanMission",getRootElement(), function() if (source == getLocalPlayer()) then addEventHandler ("onClientRender",getRootElement(),FishermanGUIText) end checkfishesbleh = setTimer( function() kmh = math.floor( getheVehicleSpeed( getPedOccupiedVehicle(getLocalPlayer()), getElementVelocity (getPedOccupiedVehicle(getLocalPlayer())) ) * 100 * 1.61 ) curfish = getElementData(getPedOccupiedVehicle(getLocalPlayer()),"fishes") if curfish > 499 then setElementData(getPedOccupiedVehicle(getLocalPlayer()),"fishes",500) else if kmh >= 20 then setElementData(getPedOccupiedVehicle(getLocalPlayer()),"fishes",curfish + math.random(1,4)) end end end ,5000,0) end ) ) No error's just it not give fishes You have a '(' extra, and 'getheVehicleSpeed' There are no argument. Edited January 6, 2013 by Guest ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
K4stic Posted January 6, 2013 Author Posted January 6, 2013 don't see it and sorry i make wrong code is with one ')' but who i have say is no give fish Giving a Fuck? Nope, That isn't in My Skill Set
abu5lf Posted January 6, 2013 Posted January 6, 2013 function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end addEvent( 'enableFishermanMission', true ) addEventHandler( 'enableFishermanMission', getRootElement( ), function( ) if ( source == localPlayer ) then addEventHandler( 'onClientRender', getRootElement( ), FishermanGUIText ) Timer = setTimer( checkfishesbleh, 5000, 0 ) end end ) function checkfishesbleh( ) local vehicle = getPedOccupiedVehicle( localPlayer ) if ( vehicle ) then local aSpeed = getElementSpeed( vehicle, 'kph' ) local curfish = getElementData( vehicle, 'fishes' ) or 0 if ( curfish > 499 ) then setElementData( vehicle, 'fishes', 500 ) else if ( aSpeed >= 20 ) then setElementData( vehicle, 'fishes', ( curfish + math.random( 4 ) ) ) end end end end Try This, not tested. ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
K4stic Posted January 6, 2013 Author Posted January 6, 2013 same problem not give a fish and no error's Giving a Fuck? Nope, That isn't in My Skill Set
abu5lf Posted January 6, 2013 Posted January 6, 2013 same problem not give a fish and no error's Show your trigger ''enableFishermanMission'' . ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
K4stic Posted January 6, 2013 Author Posted January 6, 2013 --Server side local index,theBoat; for index,theBoat in ipairs ( getElementsByType ( "vehicle" ) ) do if ( model == 453 ) then setElementData(theBoat, "fishboat", true) setElementData(theBoat, "fishes", 0) end end finish = createMarker( 971.8, -2103.6, 2.2,"cylinder", 2, 0, 0, 255, 155) FishingMinigameBlip = createBlipAttachedTo ( finish, 9, 2, 0, 0, 255, 255, 0, 250, getRootElement() ) addEventHandler("onMarkerHit", finish, function (thePlayer) if ( getElementType ( thePlayer)) == "player" then local fishes = getElementData( thePlayer, "fishes") or 0 outputChatBox ( "You have sold "..fishes.." fishes and earned $"..fishes * 3,thePlayer) givePlayerMoney ( thePlayer,fishes* 3 ) setElementData ( thePlayer, "fishes", 0, false) end end ) addEventHandler ( "onVehicleEnter", getRootElement(), function(thePlayer) if getElementData(getPedOccupiedVehicle(thePlayer),"fishboat") then triggerClientEvent(thePlayer, "enableFishermanMission",thePlayer) end end ) addEventHandler ( "onVehicleExit", getRootElement(), function(thePlayer) if getElementData(source,"fishboat") then triggerClientEvent(thePlayer, "disableFishermanMission",thePlayer) end end ) --Client side LINE NUMBER ON/OFF | EXPAND/CONTRACT | SELECT ALL function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end addEvent( 'enableFishermanMission', true ) addEventHandler( 'enableFishermanMission', getRootElement( ), function( ) if ( source == localPlayer ) then addEventHandler( 'onClientRender', getRootElement( ), FishermanGUIText ) Timer = setTimer( checkfishesbleh, 5000, 0 ) end end ) function checkfishesbleh( ) local vehicle = getPedOccupiedVehicle( localPlayer ) if ( vehicle ) then local aSpeed = getElementSpeed( vehicle, 'kph' ) local curfish = getElementData( vehicle, 'fishes' ) or 0 if ( curfish > 499 ) then setElementData( vehicle, 'fishes', 500 ) else if ( aSpeed >= 20 ) then setElementData( vehicle, 'fishes', ( curfish + math.random( 4 ) ) ) end end end end addEvent ("disableFishermanMission",true) addEventHandler ("disableFishermanMission",getRootElement(), function() if (source == getLocalPlayer()) then removeEventHandler ("onClientRender",getRootElement(),FishermanGUIText) killTimer(checkfishesbleh) end end ) Giving a Fuck? Nope, That isn't in My Skill Set
abu5lf Posted January 6, 2013 Posted January 6, 2013 Client Side Timer = {} function getElementSpeed(element,unit) if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.61 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end addEvent( 'enableFishermanMission', true ) addEventHandler( 'enableFishermanMission', getRootElement( ), function( ) if ( source == localPlayer ) then addEventHandler( 'onClientRender', getRootElement( ), FishermanGUIText ) Timer[localPlayer] = setTimer( checkfishesbleh, 5000, 0 ) end end ) function checkfishesbleh( ) local vehicle = getPedOccupiedVehicle( localPlayer ) if ( vehicle ) then local aSpeed = getElementSpeed( vehicle, 'kph' ) local curfish = getElementData( vehicle, 'fishes' ) or 0 if ( curfish > 499 ) then setElementData( vehicle, 'fishes', 500 ) else if ( aSpeed >= 20 ) then setElementData( vehicle, 'fishes', ( curfish + math.random( 4 ) ) ) end end end end addEvent( 'disableFishermanMission', true ) addEventHandler( 'disableFishermanMission', getRootElement( ), function() if ( source == localPlayer ) then removeEventHandler( 'onClientRender', getRootElement( ),FishermanGUIText ) killTimer( Timer[localPlayer] ) end end ) Server Side local index, theBoat; for index,theBoat in ipairs ( getElementsByType ( "vehicle" ) ) do if ( getElementModel( theBoat ) == 453 ) then setElementData( theBoat, 'fishboat', true ) setElementData( theBoat, 'fishes', 0 ) end end finish = createMarker( 971.8, -2103.6, 2.2,"cylinder", 2, 0, 0, 255, 155) FishingMinigameBlip = createBlipAttachedTo ( finish, 9, 2, 0, 0, 255, 255, 0, 250, getRootElement() ) addEventHandler( 'onMarkerHit', finish, function (thePlayer) if ( getElementType( thePlayer) == 'player' ) then local fishes = getElementData( getPedOccupiedVehicle( thePlayer ), 'fishes' ) or 0 outputChatBox( 'You have sold '..fishes..' fishes and earned $'..fishes * 3,thePlayer) givePlayerMoney( thePlayer,fishes* 3 ) setElementData( thePlayer, 'fishes', 0, false ) end end ) addEventHandler( 'onVehicleEnter', getRootElement( ), function( thePlayer ) if getElementData( source,'fishboat' ) then triggerClientEvent( thePlayer, 'enableFishermanMission', thePlayer ) end end ) addEventHandler ( "onVehicleExit", getRootElement(), function( thePlayer ) if getElementData( source, 'fishboat' ) then triggerClientEvent( thePlayer, 'disableFishermanMission',thePlayer ) end end ) ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
K4stic Posted January 6, 2013 Author Posted January 6, 2013 same no fishes Giving a Fuck? Nope, That isn't in My Skill Set
abu5lf Posted January 6, 2013 Posted January 6, 2013 (edited) local index, theBoat; for index, theBoat in ipairs ( getElementsByType 'vehicle' ) do if ( getElementModel( theBoat ) == 453 ) then setElementData( theBoat, 'fishboat', true ) setElementData( theBoat, 'fishes', 0 ) end end finish = createMarker( 971.8, -2103.6, 2.2,"cylinder", 2, 0, 0, 255, 155) FishingMinigameBlip = createBlipAttachedTo ( finish, 9, 2, 0, 0, 255, 255, 0, 250, getRootElement() ) addEventHandler( 'onMarkerHit', finish, function( hit ) if ( getElementType( hit ) == 'player' ) then local fishes = getElementData( hit , 'FishPlayer' ) or 0 outputChatBox( 'You have sold '..fishes..' fishes and earned $'.. fishes * 3, thePlayer ) givePlayerMoney( hit, fishes * 3 ) setElementData( hit, 'FishPlayer', 0 ) end end ) addEventHandler( 'onVehicleEnter', getRootElement( ), function( thePlayer ) if getElementData( source, 'fishboat' ) then triggerClientEvent( thePlayer, 'enableFishermanMission', thePlayer ) end end ) addEventHandler ( 'onVehicleExit', getRootElement( ), function( thePlayer ) if getElementData( source, 'fishboat' ) then triggerClientEvent( thePlayer, 'disableFishermanMission', thePlayer ) setElementData( thePlayer, 'FishPlayer', getElementData( source , 'fishes' ) or 0 ) setElementData( source, 'fishes', 0 ) end end ) Edited January 6, 2013 by Guest ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
K4stic Posted January 6, 2013 Author Posted January 6, 2013 thx work but i need to player hit it and sell the fish Giving a Fuck? Nope, That isn't in My Skill Set
abu5lf Posted January 6, 2013 Posted January 6, 2013 thx work but i need to player hit it and sell the fish Copy code again. ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
Anderl Posted January 6, 2013 Posted January 6, 2013 Btw, there's no need to declare variables of the for loop. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
K4stic Posted January 6, 2013 Author Posted January 6, 2013 BIG thx 3ɑsн8 ɑʟsнɾq Giving a Fuck? Nope, That isn't in My Skill Set
abu5lf Posted January 6, 2013 Posted January 6, 2013 You're welcome. ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
K4stic Posted January 7, 2013 Author Posted January 7, 2013 work's good but how make it to take first the job and the spawn boat and go to fishing because now is :need have spawned the boat and then take the job to get fish Giving a Fuck? Nope, That isn't in My Skill Set
K4stic Posted January 7, 2013 Author Posted January 7, 2013 and another help pls it's says error => attempt to perform arithmetic on a boolean value setElementData ( source, "cans", (getElementData(source, "cans") + cans), false ) Giving a Fuck? Nope, That isn't in My Skill Set
Vision Posted January 7, 2013 Posted January 7, 2013 setElementData ( source, "cans", tonumber(getElementData(source, "cans") or 0) + cans, false )
K4stic Posted January 7, 2013 Author Posted January 7, 2013 Thx Castro Giving a Fuck? Nope, That isn't in My Skill Set
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