Jump to content

script not working after update


SinaAmp

Recommended Posts

hi why i got these errors for this code

inside = createMarker( -1883.283203125, 865.4765625, 35.171875,56.0,"arrow",4.0,0,255,255)

function createmymarker()
	local inhouse = createMarker( -1883.283203125, 865.4765625, 35.171875,56.0,"arrow",4.0,0,255,255)
	setElementPosition(theplayer,-1883.283203125, 865.4765625, 35.171875)
	setElementInterior(theplayer, 18)
end

addEventHandler("onMarkerHit",inhouse, createmymarker)

errors:

https://imgur.com/a/Efrr0To

Link to comment
  • Moderators

inside = createMarker( -1883.283203125, 865.4765625, 35.171875,56.0,"arrow",4.0,0,255,255) -- Removed
local inhouse = createMarker( -1883.283203125, 865.4765625, 35.171875,56.0,"arrow",4.0,0,255,255) -- Moved to here.

function createmymarker()

    local inhouse = createMarker( -1883.283203125, 865.4765625, 35.171875,56.0,"arrow",4.0,0,255,255)  -- Moved from here.

    setElementPosition(theplayer,-1883.283203125, 865.4765625, 35.171875) 

    setElementInterior(theplayer, 18)

end

addEventHandler("onMarkerHit", inhouse, createmymarker) -- Now is the inhouse variable available here and the warning shouldn't show up any more.

@SinaAmp

local inhouse = createMarker( -1883.283203125, 865.4765625, 35.171875,56.0,"arrow",4.0,0,255,255)

function createmymarker()
	setElementPosition(theplayer,-1883.283203125, 865.4765625, 35.171875)
	setElementInterior(theplayer, 18)
end

addEventHandler("onMarkerHit", inhouse, createmymarker)

 

  • Like 2
Link to comment
local inhouse = createMarker(-1883.283203125, 865.4765625, 35.171875,"arrow",4.0,0,255,255)

function createmymarker(hitElement)
    setElementPosition(hitElement,-1883.283203125, 865.4765625, 35.171875)
    setElementInterior(hitElement, 18)
end

addEventHandler("onMarkerHit", inhouse, createmymarker)

now it is better

  • Like 1
Link to comment
Just now, Burak5312 said:

If you have any other problems, open a new topic, I will be happy to help you. :)

thank you

also i have another issue

i dont know why my code doesent work and show any error in debugscript

marker1 = createMarker(163.017578125, -89.5458984375, 1000.8046875,"cylinder",1.0)
setElementInterior(marker1, 18)
marker2 = createMarker(159.3408203125, -89.36328125, 1000.8046875,"cylinder",1.0)
setElementInterior(marker2, 18)
marker3 = createMarker(153.2841796875, -78.6357421875, 1000.8046875,"cylinder",1.0)
setElementInterior(marker3, 18)

function skin159 (theplayer)
	if getPlayerMoney(theplayer) >= 4999 then
		takePlayerMoney(theplayer, 5000)
		outputChatBox("pooletkamshod")
	end
end
addEventHandler("onMarkerHit", marker1, skin159)

 

Edited by SinaAmp
Link to comment
  • Moderators
4 minutes ago, SinaAmp said:

thank you

also i have another issue

i dont know why my code doesent work and show any error in debugscript

marker1 = createMarker(163.017578125, -89.5458984375, 1000.8046875,"cylinder",1.0)
setElementInterior(marker1, 18)
marker2 = createMarker(159.3408203125, -89.36328125, 1000.8046875,"cylinder",1.0)
setElementInterior(marker2, 18)
marker3 = createMarker(153.2841796875, -78.6357421875, 1000.8046875,"cylinder",1.0)
setElementInterior(marker3, 18)

function skin159 (theplayer)
	if getPlayerMoney(theplayer) >= 4999 then
		takePlayerMoney(theplayer, 5000)
		outputChatBox("pooletkamshod")
	end
end
addEventHandler("onMarkerHit", marker1, skin159)

 

Does your code only take money when entering the marker1?
And you want all markers to do the same thing?
If yes, take a look at this tutorial:

(If that is not the case, please be a bit more specific.)

  • Like 3
Link to comment

I tested your code and didn't see any problem. As IIYAMA said, do you want to do this to all of these markers?

edit:

actually, there is another bug here, because of the size of the marker, onMarkerHit event is not triggered, it only triggers when teleported, so I changed the size of the marker to 2.0 and the problem was resolved.

Is your problem something related to this?

Edited by Burak5312
  • Like 1
Link to comment
15 minutes ago, IIYAMA said:

Does your code only take money when entering the marker1?
And you want all markers to do the same thing?
If yes, take a look at this tutorial:

(If that is not the case, please be a bit more specific.)

I want to take money from player but that does not work for no reason

No I don't want to do same thing to all of them

I tested my code to output something in chat box but that doesn't work too!

Link to comment
  • Moderators

If the problem is indeed with the size of the marker as Burak said.

And you want to keep your smaller marker,

Spoiler

 the following code might help with improving hit registration.

addEventHandler("onColShapeHit", getElementColShape (marker1), skin159)

https://wiki.multitheftauto.com/wiki/GetElementColShape

Else create a new colShape on top of it and use that one for the event:

https://wiki.multitheftauto.com/wiki/CreateColSphere

 

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