SinaAmp Posted January 26, 2022 Share Posted January 26, 2022 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 IIYAMA Posted January 26, 2022 Moderators Share Posted January 26, 2022 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) 2 Link to comment
The_GTA Posted January 26, 2022 Share Posted January 26, 2022 inside = createMarker( -1883.283203125, 865.4765625, 35.171875, "arrow", 4.0, 0, 255, 255 ) Removed the 56.0 because that argument to createMarker made no sense. 3 Link to comment
βurak Posted January 26, 2022 Share Posted January 26, 2022 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 1 Link to comment
SinaAmp Posted January 26, 2022 Author Share Posted January 26, 2022 thank you guys problem solved Link to comment
βurak Posted January 26, 2022 Share Posted January 26, 2022 If you have any other problems, open a new topic, I will be happy to help you. Link to comment
SinaAmp Posted January 26, 2022 Author Share Posted January 26, 2022 (edited) 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 January 26, 2022 by SinaAmp Link to comment
Moderators IIYAMA Posted January 26, 2022 Moderators Share Posted January 26, 2022 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.) 3 Link to comment
βurak Posted January 26, 2022 Share Posted January 26, 2022 (edited) 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 January 26, 2022 by Burak5312 1 Link to comment
SinaAmp Posted January 26, 2022 Author Share Posted January 26, 2022 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
βurak Posted January 26, 2022 Share Posted January 26, 2022 (edited) marker1 = createMarker(163.017578125, -89.5458984375, 1000.8046875,"cylinder",1.5) try increasing the size of the marker a little bit 1.5 Edited January 26, 2022 by Burak5312 1 Link to comment
Moderators IIYAMA Posted January 26, 2022 Moderators Share Posted January 26, 2022 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 1 Link to comment
SinaAmp Posted January 26, 2022 Author Share Posted January 26, 2022 thank you so much @IIYAMA and @Burak5312 changing size worked 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