xXGhostXx Posted September 19, 2018 Share Posted September 19, 2018 Hi guys ! i have a problem ! in this code player have 100$ money and can go to interior but dont have money cant go to interior ! what is problem ? function enter (thePlayer) setElementPosition(thePlayer, 834.66796875, 7.431640625, 1004.1870117188 ) setElementInterior(thePlayer, 3) if (getPlayerMoney(thePlayer)>= 100) then takePlayerMoney(thePlayer, 100) else outputChatBox("#ff0000You Dont Have Enough Money!",thePlayer,255,255,255,true) end end addEventHandler("onMarkerHit",markerJoin,enter) Link to comment
Dimos7 Posted September 19, 2018 Share Posted September 19, 2018 The problem is you put position and interior at benging put it when take the player money Link to comment
Storm-Hanma Posted September 19, 2018 Share Posted September 19, 2018 make sure you have add marker correctly and instead of the player function use source at server side which will work function enter (source) if getPlayerMoney ( source ) > 100 then takePlayerMoney (source, 100) setElementPosition(source, 834.66796875, 7.431640625, 1004.1870117188 ) setElementInterior(source, 3) else outputChatBox("#ff0000You Dont Have Enough Money!",source,255,255,255,true) end end addEventHandler("onMarkerHit",markerJoin,enter) test this Link to comment
MrKAREEM Posted September 19, 2018 Share Posted September 19, 2018 (edited) -- Arrange Your Codes -- -- You Forget Make Check IF The Hit Element Is Source OR not -- function enter (thePlayer) if ( thePlayer == source ) then if getPlayerMoney(thePlayer) > 99 then takePlayerMoney (thePlayer, 100) setElementPosition(thePlayer, 834.66796875, 7.431640625, 1004.1870117188 ) setElementInterior(thePlayer, 3) else outputChatBox("#ff0000You Dont Have Enough Money!",thePlayer,255,255,255,true) end end end addEventHandler("onMarkerHit",markerJoin,enter) Check That . Edited September 19, 2018 by MrKAREEM Link to comment
Simple. Posted September 20, 2018 Share Posted September 20, 2018 (edited) 13 hours ago, MrKAREEM said: -- Arrange Your Codes -- -- You Forget Make Check IF The Hit Element Is Source OR not -- function enter (thePlayer) if ( thePlayer == source ) then if getPlayerMoney(thePlayer) > 99 then takePlayerMoney (thePlayer, 100) setElementPosition(thePlayer, 834.66796875, 7.431640625, 1004.1870117188 ) setElementInterior(thePlayer, 3) else outputChatBox("#ff0000You Dont Have Enough Money!",thePlayer,255,255,255,true) end end end addEventHandler("onMarkerHit",markerJoin,enter) Check That . Edited September 20, 2018 by Simple. Link to comment
xXGhostXx Posted September 20, 2018 Author Share Posted September 20, 2018 16 hours ago, Simple. said: Dont work On 19/09/2018 at 17:40, KINGKHAN said: make sure you have add marker correctly and instead of the player function use source at server side which will work function enter (source) if getPlayerMoney ( source ) > 100 then takePlayerMoney (source, 100) setElementPosition(source, 834.66796875, 7.431640625, 1004.1870117188 ) setElementInterior(source, 3) else outputChatBox("#ff0000You Dont Have Enough Money!",source,255,255,255,true) end end addEventHandler("onMarkerHit",markerJoin,enter) test this Dont work Link to comment
Dimos7 Posted September 20, 2018 Share Posted September 20, 2018 function enter (thePlayer) if (getPlayerMoney(thePlayer)>= 100) then setElementPosition (thePlayer, 834.66796875,7.431640625,1004.1870117188) setElementInterior(thePlayer, 3) takePlayerMoney(thePlayer, 100) else outputChatBox("#ff0000You Dont Have Enough Money!",thePlayer,255,255,255,true) end end addEventHandler("onMarkerHit",markerJoin,enter) Link to comment
Erknneto Posted September 20, 2018 Share Posted September 20, 2018 function interiorEnter (element) if ( getElementType(element) == "player" ) then if ( getPlayerMoney(element) >= 100 ) then takePlayerMoney(element,100) setElementPosition(element,834.6,7.4,1004.1) setElementInterior(element,3) else outputChatBox("#ff0000You don't have enough money!",element,255,255,255,true) end end end addEventHandler("onMarkerHit",markerJoin,interiorEnter) Try this, m8. Link to comment
JeViCo Posted September 21, 2018 Share Posted September 21, 2018 (edited) function enter (thePlayer, dim) if getElementType(thePlayer) == "player" then if not getPedIccupiedVehicle(thePlayer) and dim then --setElementPosition(thePlayer, 834.66796875, 7.431640625, 1004.1870117188 ) setElementInterior(thePlayer, 3, 834.66796875, 7.431640625, 1004.1870117188) if (getPlayerMoney(thePlayer)>= 100) then takePlayerMoney(thePlayer, 100) else outputChatBox("#ff0000You Don't Have Enough Money!",thePlayer,255,255,255,true) end end end end addEventHandler("onMarkerHit",markerJoin,enter) Use optional arguments @xXGhostXx Edited September 21, 2018 by JeViCo Link to comment
iMr.WiFi..! Posted September 21, 2018 Share Posted September 21, 2018 2 hours ago, JeViCo said: function enter (thePlayer, dim) if getElementType(thePlayer) == "player" then if not getPedIccupiedVehicle(thePlayer) and dim then --setElementPosition(thePlayer, 834.66796875, 7.431640625, 1004.1870117188 ) setElementInterior(thePlayer, 3, 834.66796875, 7.431640625, 1004.1870117188) if (getPlayerMoney(thePlayer)>= 100) then takePlayerMoney(thePlayer, 100) else outputChatBox("#ff0000You Don't Have Enough Money!",thePlayer,255,255,255,true) end end end end addEventHandler("onMarkerHit",markerJoin,enter) Use optional arguments @xXGhostXx You have problem with line 4, because no function called like this. Try this: function enter (thePlayer, dim) if getElementType(thePlayer) == "player" then if not isPedInVehicle(thePlayer) and dim then if (getPlayerMoney(thePlayer)>= 100) then takePlayerMoney(thePlayer, 100) setElementInterior(thePlayer, 3, 834.66796875, 7.431640625, 1004.1870117188) else outputChatBox("#ff0000You Don't Have Enough Money!",thePlayer,255,255,255,true) end end end end addEventHandler("onMarkerHit",markerJoin,enter) 1 1 Link to comment
JeViCo Posted September 21, 2018 Share Posted September 21, 2018 1 hour ago, iMr.WiFi..! said: You have problem with line 4, because no function called like this oops misspelled that Link to comment
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