BriGhtx3 Posted April 2, 2012 Posted April 2, 2012 function keineAutosBeiMarkern(hitElement) if getElementType(hitElement) == "vehicle" then cancelEvent() end end addEventHandler("onMarkerHit",getRootElement(),keineAutosBeiMarkern) This is my serverside script. When I enter a marker with a vehicle i still get teleported.. How can I change the script that I don't get teleported when entering a marker with a vehicle? Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
Alpha Posted April 2, 2012 Posted April 2, 2012 Post the code where you warp the player. My Resources: [REL] Support System v1.0.2
BriGhtx3 Posted April 2, 2012 Author Posted April 2, 2012 I know how to cancel the event in the function, but this would be too much work since I have a lot of markers... So I want to create a general function. Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
myonlake Posted April 2, 2012 Posted April 2, 2012 I get what you mean, I am not so sure why that script didn't work, though you can try this, which is almost the same. addEventHandler("onMarkerHit", root, function(hitElement, matchingDimension) if getElementType(hitElement) == "vehicle" and matchingDimension then return end end ) If I helped you, please click the like button on the right Thanks!
BriGhtx3 Posted April 2, 2012 Author Posted April 2, 2012 Doesn't work But thanks anyway Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
Kenix Posted April 2, 2012 Posted April 2, 2012 addEventHandler( 'onMarkerHit', root, function( uHitElement, bMatchingDimension) if getElementType( uHitElement ) == 'player' and isPedInVehicle( uHitElement ) then return end end ) http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
BriGhtx3 Posted April 2, 2012 Author Posted April 2, 2012 Still doesn't work. Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
Kenix Posted April 2, 2012 Posted April 2, 2012 It should work. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
BriGhtx3 Posted April 2, 2012 Author Posted April 2, 2012 But it doesn't Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
Castillo Posted April 2, 2012 Posted April 2, 2012 You are trying to cancel functions of all markers if the player is on a vehicle? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
BriGhtx3 Posted April 2, 2012 Author Posted April 2, 2012 Yes. Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
Kenix Posted April 2, 2012 Posted April 2, 2012 If you not understand .. addEventHandler( 'onMarkerHit', root, function( uHitElement, bMatchingDimension) if getElementType( uHitElement ) == 'player' and isPedInVehicle( uHitElement ) then return end -- Doing something! -- .... end ) http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
BriGhtx3 Posted April 2, 2012 Author Posted April 2, 2012 I know how to do it within the marker function. But I want a GENERAL function where I check it for every marker, because I have too much markers to paste it everywhere For example: I have MarkerXY and when I hit it, I get teleported to interior XX I have MarkerYZ and when I hit it, I get teleported to interior YY I have MarkerAA and when I hit it, I get teleported to interior ZZ Now if I am in a vehicle and hit MarkerXY or MarkerYZ or MarkerAA or any other marker and I am IN a vehicle, the event gets cancelled Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
Kenix Posted April 2, 2012 Posted April 2, 2012 (edited) Set element data your marker( s ). Add one event handler ( onMarkerHit ) and check if marker have this data. Create table position for all markers. ... P.S Long ago i did write my interior system only 31lines in client side and 153 lines + comments. Also you can make it in map editor, move interior markers create text and etc. Edited April 2, 2012 by Guest http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
BriGhtx3 Posted April 2, 2012 Author Posted April 2, 2012 If I set the element data for every marker it is the same like pasting it everywhere. But this are simply too much So I need a general function Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
DNL291 Posted April 2, 2012 Posted April 2, 2012 maybe it works local _markers = getElementsByType("marker") for i,marker in ipairs(_markers) do Please do not PM me with scripting related question nor support, use the forums instead.
BriGhtx3 Posted April 3, 2012 Author Posted April 3, 2012 Doesn't work either Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
X-SHADOW Posted April 3, 2012 Posted April 3, 2012 (edited) addEventHandler( 'onMarkerHit', root, function( uHitElement, bMatchingDimension) if getElementType( uHitElement ) == 'player' and isPedInVehicle( uHitElement ) then local _markers = getElementsByType("marker") for i,marker in ipairs(_markers) do cancelEvent() end end end) Updated ! Edited April 3, 2012 by Guest My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
BriGhtx3 Posted April 3, 2012 Author Posted April 3, 2012 Thank you but: I need to check whether he is in a vehicle or not. So this script can't work for me. And I also can't work with tables, because then I have to copy each marker to the table. Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
X-SHADOW Posted April 3, 2012 Posted April 3, 2012 i have Update My Post check it . My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
BriGhtx3 Posted April 3, 2012 Author Posted April 3, 2012 Still the same. I also tried to change it like this: addEventHandler( 'onMarkerHit', root, function( uHitElement, bMatchingDimension) if getElementType( uHitElement ) == 'vehicle' then local _markers = getElementsByType("marker") for i,marker in ipairs(_markers) do cancelEvent() end end end) Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
X-SHADOW Posted April 3, 2012 Posted April 3, 2012 1 thing to try make it clientSide in meta.xml addEventHandler ( "onClientMarkerHit", getRootElement(), cancelEvent ) My ingame nickname : Ops! -DeathMatch GameMode By Ops! : 5%
BriGhtx3 Posted April 3, 2012 Author Posted April 3, 2012 Also doesn't work Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
drk Posted April 3, 2012 Posted April 3, 2012 Will never work because X-SHADOW only COPY code and paste and think will work. See: https://wiki.multitheftauto.com/wiki/OnMarkerHit There is nothing about cancel onMarkerHit cancel event affection. Try this: Server-side: for _, marker in ipairs ( getElementsByType 'marker' ) do addEventHandler ( 'onMarkerHit', marker, cancelEnter ) end function cancelEnter ( player ) if ( getElementType ( player ) == 'vehicle' or isPedInVehicle ( player ) ) then return end end EPT Team Server Development: 0% Learning C++ | C++ is amazing
BriGhtx3 Posted April 3, 2012 Author Posted April 3, 2012 This also doesn't work But thanks anyway Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
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