Best-Killer Posted December 18, 2015 Posted December 18, 2015 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 !
1LoL1 Posted December 18, 2015 Posted December 18, 2015 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)
1LoL1 Posted December 18, 2015 Posted December 18, 2015 not work In my server this code working perfect. here you used your own x, y, z? markerlocation1 = createMarker (x,y,z, "cylinder", 4, 238, 44, 44, 255)
1LoL1 Posted December 18, 2015 Posted December 18, 2015 ye And what not work? In my server when i take this marker i have + 5,000$. And blip + marker is destroyed.
Best-Killer Posted December 18, 2015 Author Posted December 18, 2015 the problem not geting localPlayer - say to some one test with u u will see
1LoL1 Posted December 19, 2015 Posted December 19, 2015 the problem not geting localPlayer -say to some one test with u u will see What?
Captain Cody Posted December 20, 2015 Posted December 20, 2015 Pay event does not need to be added client side. - And he's asking you to get another player to test with you, and you will see -- Have to deal with a lot of low English people --
Captain Cody Posted December 20, 2015 Posted December 20, 2015 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..
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