Jump to content

[HELP] Take Money And Interior


xXGhostXx

Recommended Posts

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

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
-- 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 by MrKAREEM
Link to comment
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 .

4PUXzCy.png

Edited by Simple.
Link to comment
16 hours ago, Simple. said:

4PUXzCy.png

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
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
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
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 by JeViCo
Link to comment
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)

 

  • Like 1
  • Confused 1
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...