Jump to content

Need help please


oldnag

Recommended Posts

Posted

hi there im making a simple fish script but can seem to get it to work i have try many ways of doin this

client 
  
function goFishing (thePlayer, matchingDimensions) 
  
          if not (fishTank) then 
           fishTank = createMarker  (-205.80000305176, -573.29998779297, 1, "cylinder", 260, 255, 0, 0, 150) 
           
          addEvent("goFishing", true) 
          addEventHandler("goFishing", getRootElement(), goFishing) 
            
           function MarkerHit ( hitPlayer, matchingDimension ) 
           outputChatBox ("You can /fish here.", thePlayer, 255, 0, 0, 0) 
          
           
       end 
      end 
         
         addEvent ("onClientMarkerHit")   
         addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit )  
    end   
     
           -- triggerServerEvent ("castOutput", getRootElement()) 

server 
function startFishing(thePlayer, command) 
            if not(exports.global:hasItem(thePlayer, 49)) then 
             outputChatBox("You need a rod to fish.", thePlayer, 255, 0, 0) 
            else 
            triggerClientEvent(thePlayer, "goFishing", getRootElement()) 
            end 
        end 
  
addCommandHandler("fish", startFishing, false, false) 
addEvent("fish") 
addEventHandler("fish", getRootElement(), startFishing) 

Posted (edited)

Hi, thats quite a mess, try this:

client:

 local fishTank = createMarker(-205.8, -573.3, 1, "cylinder", 260, 255, 0, 0, 150) 
addEventHandler ( "onClientMarkerHit", fishTank, markerHit ) 
  
  
function markerHit(player) 
    if player == getLocalPlayer() then 
        outputChatBox ("You can /fish here.",0,255, 0) 
    end 
end 
  
  
addEvent("goFishing", true) 
function goFish() 
  
    if isElementWithinMarker (source,fishTank) then 
        triggerServerEvent ("castOutput", source) 
    else 
        outputChatBox ("You cant /fish here!",255, 0, 0) 
    end 
  
end 
addEventHandler("goFishing", root, goFish) 

server:

function startFishing(player) 
  
    if not exports.global:hasItem(player, 49) then 
        outputChatBox("You need a rod to fish.", player, 255, 0, 0) 
    else 
        triggerClientEvent(player, "goFishing", player) 
    end 
end 
addCommandHandler("fish", startFishing) 
  
  
addEvent("castOutput",true) 
function playerCastOut() 
    outputChatBox("You Cast Out......",source,0,255,0) 
end 
addEventHandler("castOutput",root,playerCastOut) 

its kinda late here so i dont have time to test it... sorry,

let me know how it turns out or if u get errors and if so what they are with /debugscript 3

Edited by Guest

ScoobySig.gif

[UVA]Scooby

Founder Of UVA - Ultimate Vice Assassins

http://www.uvaclan.com/

Posted

Kind of unfinished script I see.

Client-side

local fishTank = createMarker(-205.8, -573.3, 1, "cylinder", 260, 255, 0, 0, 150) 
  
addEventHandler("onClientMarkerHit", fishTank, 
    function(hitElement, matchingDimension) 
        if getElementType(hitElement) == "player" then 
            if matchingDimension then 
                outputChatBox("You can /fish here.", 0, 255, 0, false) 
            end 
        end 
    end 
) 
  
addEvent("goFishing", true) 
addEventHandler("goFishing", root, 
    function() 
        if isElementWithinMarker(source, fishTank) then 
            triggerServerEvent("castOutput", source) 
        else 
            outputChatBox("You can't /fish here!", 255, 0, 0, false) 
        end 
    end 
) 

Server-side

addCommandHandler("fish", 
    function(player, cmd) 
        if not exports.global:hasItem(player, 49) then 
            outputChatBox("You need a rod to fish.", player, 255, 0, 0, false) 
        else 
            triggerClientEvent(player, "goFishing", player) 
        end 
    end 
) 
  
addEvent("castOutput", true) 
addEventHandler("castOutput", root, 
    function() 
        outputChatBox("You cast out...", source, 0, 255, 0, false) 
    end 
) 

If I helped you, please click the like button on the right ;) Thanks!

Posted
ok thanks for your reply, i tryed it out and the script still does not register at all when marker has been hit

ah sorry, my bad, a couple of errors.. this will work.

client:

local fishTank = createMarker(-205.8, -573.3, 1, "cylinder", 260, 255, 0, 0, 150) 
  
function markerHit(player,dim) 
    if player == getLocalPlayer() and dim then 
        outputChatBox ("You can /fish here.",0,255, 0) 
    end 
end 
addEventHandler ( "onClientMarkerHit", fishTank, markerHit ) 
  
  
addEvent("goFishing", true) 
function goFish() 
  
    if isElementWithinMarker (source,fishTank) then 
        triggerServerEvent ("castOutput", source) 
    else 
        outputChatBox ("You cant /fish here!",255, 0, 0) 
    end 
end 
addEventHandler("goFishing", root, goFish)   

server:

function startFishing(player) 
  
    if not exports.global:hasItem(player, 49) then 
        outputChatBox("You need a rod to fish.", player, 255, 0, 0) 
    else 
        triggerClientEvent(player, "goFishing", player) 
    end 
end 
addCommandHandler("fish", startFishing) 
  
  
addEvent("castOutput",true) 
function playerCastOut() 
    outputChatBox("You Cast Out......",source,0,255,0) 
end 
addEventHandler("castOutput",root,playerCastOut) 

ScoobySig.gif

[UVA]Scooby

Founder Of UVA - Ultimate Vice Assassins

http://www.uvaclan.com/

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