Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function startFishingJob(player)
- x=math.random(0,750)
- y=math.random(0,750)
- fishingMarker=createMarker(x-3000,y-3750,0,"cylinder",30,0,0,120,150)
- sellFishMarker=createMarker(0,0,0,"cylinder",2,0,0,120,150)
- outputChatBox("Go to the marked fishing spot and go do some fishing")
- addEventHandler("onMarkerHit",fishingMarker,
- function(player)
- if player==getLocalPlayer() and getElementData(player,"playerType")=="fisherman" then
- vehicle=getPedOccupiedVehicle(player)
- if vehicle~=false then
- setElementFrozen(vehicle,true)
- setElementData(getLocalPlayer(),"playerFishingBoat",vehicle,true)
- setElementData(getLocalPlayer(),"isFishing",true,true)
- end
- end
- end)
- addEventHandler("onMarkerHit",sellFishmarker,
- function(player)
- if player==getLocalPlayer() and getElementData(getLocalPlayer(),"ammountOfFish")>0 then
- fishes=getElementData(getLocalPlayer(),"ammountOfFish")
- fishMoney=fishes*math.random(1,25)
- setElementData(getLocalPlayer(),"FGNMoney",getElementData(getLocalPlayer(),"FGNMoney")+fishMoney)
- setElementData(getLocalPlayer(),"ammountOfFish",0)
- end
- end)
- end
- function checkFishingProgress()
- fishingProgress=getElementData(getLocalPlayer,()"fishingProgress")
- if fishingProgress<100 then
- fishingProgress=fishingProgress+10
- setElementData(getLocalPlayer(),"fishingProgress",fishingProgress)
- else
- boat=getElementData(getLocalPlayer(),"playerFishingBoat")
- setElementFrozen(boat,false)
- ammountOfFish=getElementData(getLocalPlayer(),"ammountOfFish")
- if ammountOfFish==false then
- ammountOfFish=0
- end
- fishCaught=math.random(0,100)
- ammountOfFish=ammountOfFish+fishCaught
- setElementData(getLocalPlayer(),"ammountOfFish",ammountOfFish)
- if fishCaught==0 then
- outputChatBox("You caught no fish at all!",100,0,0)
- else
- outputChatBox("You caught "..ammountOfFish.." fish!",100,0,0)
- end
- destroyElement(fishingMarker)
- destroyElement(sellFishMarker)
- startFishingJob(getLocalPlayer())
- end
- end
- function stopFishingJob()
- destroyElement(fishingMarker)
- destroyElement(sellFishMarker)
- outputChatBox("Your job has been canceled",255,0,0)
- end
- function playerEnteredBoat(vehicle,seat)
- player=source
- if getElementModel(vehicle)==453 and getElementData(player,"playerType")=="fisherman" then
- startFishingJob(player)
- end
- end
- addEventHandler("onPlayerVehicleEnter",getRootElement(),playerEnteredBoat)
- function drawFishingStuff()
- screenx,screeny=guiGetScreenSize()
- if getElementData(player,"isFishing") then
- dxDrawRectangle(screenx*0.05-5,screeny*0.4-5,310,60,tocolor(255,255,255,100),true)
- dxDrawRectangle(screenx*0.05,screeny*0.4,getElementData(getLocalPlayer(),"fishingProgress")*3,50,tocolor(255,255,255,100),true)
- end
- if getElementData(player,"playerType")=="fisherman" then
- dxDrawRectangle(screenx*0.9,screeny*0.4,screenx*0.1,screeny*0.1,tocolor(200,200,200,150),true)
- dxDrawImage(screenx*0.94,screeny*0.405,screenx*0.08,screeny*0.04,"images/fish.png")
- dxDrawText(math.floor(getElementData(getLocalPlayer(),"ammountOfFish")+0.5),screenx*0.91,screeny*0.425,screenx,screeny,tocolor(0,0,0,255),2,"default")
- end
- end
- addEventHandler("onClientRender",getRootElement(),drawFishingStuff)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement