Jump to content

some help ?


Best-Killer

Recommended Posts

function Location1() 
    markerlocation1 = createMarker (2661.95, -1429.37, 29.49, "cylinder", 4, 238, 44, 44, 255) 
    blipLS = createBlipAttachedTo (markerlocation1, 51) 
    addEventHandler( "onClientMarkerHit", markerlocation1, 
        function ( hitPlayer, d) 
                if isElement(markerlocation1) then 
                    destroyElement(markerlocation1) 
                    destroyElement(blipLS) 
                end 
            triggerServerEvent("Pay", hitPlayer, localPlayer) 
        end 
    ) 
end 
  
  
function Location2() 
    markerlocation2 = createMarker (-2642.98, 1371.07, 7.16, "cylinder", 4,238, 44, 44, 255) 
    blipSF = createBlipAttachedTo (markerlocation2, 51) 
    addEventHandler( "onClientMarkerHit", markerlocation2, 
        function ( hitPlayer, d ) 
                if isElement(markerlocation2) then 
                    destroyElement(markerlocation2) 
                    destroyElement(blipSF) 
                end 
            triggerServerEvent("pay2", hitPlayer, localPlayer) 
        end 
    ) 
end 
  
  
function Location3() 
    markerlocation3 = createMarker (1064.73, 2342.83, 9.82, "cylinder", 4, 238, 44, 44, 255) 
    blipLV = createBlipAttachedTo (markerlocation3, 51) 
    addEventHandler( "onClientMarkerHit", markerlocation3, 
        function ( hitPlayer, d) 
                if isElement(markerlocation3) then 
                    destroyElement(markerlocation3) 
                    destroyElement(blipLV) 
                end 
            triggerServerEvent("pay3", hitPlayer, localPlayer) 
        end 
    ) 
end 

when player hit marker he get the money but other players the marker + blip destroy what is the problem !

Link to comment

Try this:

Client:

  
markerlocation1 = createMarker (x,y,z, "cylinder", 4, 238, 44, 44, 255) 
blipLS = createBlipAttachedTo (markerlocation1, 51) 
  
addEvent("Pay", true) 
addEventHandler("onClientMarkerHit", markerlocation1, 
function (hitPlayer, d) 
if isElement(markerlocation1) then 
destroyElement(markerlocation1) 
destroyElement(blipLS) 
triggerServerEvent("Pay", hitPlayer, localPlayer) 
end 
end) 

Server:

addEvent("Pay", true) 
addEventHandler("Pay", getRootElement(),  
function (hitPlayer, d) 
givePlayerMoney(hitPlayer, 5000) 
end) 

Link to comment

As for your script

--Client

   
        mL1 = createMarker (2661.95, -1429.37, 29.49, "cylinder", 4, 238, 44, 44, 255) 
        blipLS = createBlipAttachedTo (mL1, 51) 
        addEventHandler( "onClientMarkerHit", mL1, 
            function ( hitPlayer ) 
                        destroyElement(mL1) 
                        destroyElement(blipLS) 
                triggerServerEvent("Pay", hitPlayer ) 
            end 
        ) 
    
      
      
        mL2 = createMarker (-2642.98, 1371.07, 7.16, "cylinder", 4,238, 44, 44, 255) 
        blipSF = createBlipAttachedTo (mL2, 51) 
        addEventHandler( "onClientMarkerHit", mL2, 
            function ( hitPlayer ) 
                        destroyElement(mL2) 
                        destroyElement(blipSF) 
                triggerServerEvent("pay2", hitPlayer ) 
            end 
        ) 
  
      
    
        mL3 = createMarker (1064.73, 2342.83, 9.82, "cylinder", 4, 238, 44, 44, 255) 
        blipLV = createBlipAttachedTo (mL3, 51) 
        addEventHandler( "onClientMarkerHit", mL3, 
            function ( hitPlayer ) 
                        destroyElement(mL3) 
                        destroyElement(blipLV) 
                triggerServerEvent("pay3", hitPlayer ) 
            end 
        )   
--Btw Server side replace localPlayer or what not, with client 
  

--Server

    addEvent("Pay", true) 
    addEventHandler("Pay", getRootElement(), 
    function () 
    givePlayerMoney(client, 5000) 
    end) 

Try das, usually changing the cases of the letters works. And I removed some unneeded stuff, verifying if the marker you just hit is there??...

-Edit, changed some more, should work..

Link to comment

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