Dimos7 Posted August 6, 2014 Posted August 6, 2014 local marker = createMarker (1555.5 , -1675.6 , 16.9, "arrow", 1.5, 0, 150, 255, 255) state = 0 function interior() if state == 0 then setElementInterior(source, 6 ,246.7, 63.3, 1003.6) marker2 = createMarker (246.8, 62.2, 1004.6 , "arrow", 1.5, 0, 150, 255, 255) outputChatBox("You've entering Los Santos Police Derpartment (ID:6) Owner:State",getRootElement(), 0 , 255, 150) state = 1 else setElementInterior(source, 0, 1553.7, -1675.5, 16.1) state = 0 end end addEventHandler("onMarkerHit", marker, interior) addEventHandler("onMarkerHit", marker2, interior) No put the interior only aprears the message help
Max+ Posted August 6, 2014 Posted August 6, 2014 ---serverside local marker = createMarker (1555.5 , -1675.6 , 16.9, "arrow", 1.5, 0, 150, 255, 255) local marker2 = createMarker (246.8, 62.2, 1004.6 , "arrow", 1.5, 0, 150, 255, 255) state = 0 addEventHandler("onMarkerHit",marker, function ( player ) if (getElementType (player) == 'player' and state == 0 ) then setElementInterior(player, 6 ,246.7, 63.3, 1003.6) outputChatBox("You've enterd Los Santos Police Derpartment (ID:6) Owner:State",player, 0 , 255, 150) state = 1 end end ) addEventHandler("onMarkerHit",marker2, function ( player ) if (getElementType (player) == 'player' and state == 1 ) then setElementInterior(player, 0, 1553.7, -1675.5, 16.1) state = 0 end end ) /debugscript 3 to see if there is any errors .. - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
Dimos7 Posted August 6, 2014 Author Posted August 6, 2014 [12:44:52] WARNING: rp\test.lua:3: Bad argument @ 'addEventHandler' [Expected function at argument 3, got nil] [12:44:52] WARNING: rp\test.lua:16: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil]
Max+ Posted August 6, 2014 Posted August 6, 2014 still the same no put interior nothing event the message now not appear what do you mean by state = 1 or state = 0 what is state ? also show your meta.xml - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
Dimos7 Posted August 6, 2014 Author Posted August 6, 2014 <meta> <info author="Dimos_Rosso" type="gamemode" name="rp 2.0" description="My first MTA server"/> <map src="rp.map"/> <script src="rp.lua" /> <script src="object.lua"/> <script src="test.lua"/> </meta> Well the state i put it to move object and worked WARNING: rp\test.lua:3: Bad argument @ 'addEventHandler' [Expected function at argument 3, got nil] WARNING: rp\test.lua:16: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil]
Max+ Posted August 6, 2014 Posted August 6, 2014 <meta> <info author="Dimos_Rosso" type="gamemode" name="rp 2.0" description="My first MTA server"/> <map src="rp.map"/> <script src="rp.lua" /> <script src="object.lua"/> <script src="test.lua"/> </meta> Well the state i put it to move object and worked WARNING: rp\test.lua:3: Bad argument @ 'addEventHandler' [Expected function at argument 3, got nil] WARNING: rp\test.lua:16: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] post the full code of it , - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
Dimos7 Posted August 6, 2014 Author Posted August 6, 2014 (edited) local marker = createMarker (1555.5 , -1675.6 , 16.9, "arrow", 1.5, 0, 150, 255, 255) local marker2 = createMarker (246.8, 62.2, 1004.6 , "arrow", 1.5, 0, 150, 255, 255) addEventHandler("onMarkerHit", marker, interior) function interior (player) if (getElementType(player) == 'player' ) then setElementInterior(source, 6 ,246.7, 63.3, 1003.6) outputChatBox("You've entered Los Santos Police Derpartment (ID:6) Owner:State",player, 0 , 255, 150) end end addEventHandler("onMarkerHit", marker2, world) function world(player) if (getElementType(player) == 'player') then setElementInterior(source, 0, 1553.7, -1675.5, 16.1) end end Edited August 6, 2014 by Guest
Et-win Posted August 6, 2014 Posted August 6, 2014 You are adding the addEventHandlers before the functions. Post them after the functions or put the functions in it. ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Dimos7 Posted August 6, 2014 Author Posted August 6, 2014 local marker = createMarker (1555.5 , -1675.6 , 16.9, "arrow", 1.5, 0, 150, 255, 255) local marker2 = createMarker (246.8, 62.2, 1004.6 , "arrow", 1.5, 0, 150, 255, 255) function interior (player) if (getElementType(player) == 'player' ) then setElementInterior(source, 6 ,246.7, 63.3, 1003.6) outputChatBox("You've entered Los Santos Police Derpartment (ID:6) Owner:State",player, 0 , 255, 150) end end addEventHandler("onMarkerHit", marker, interior) function world(player) if (getElementType(player) == 'player') then setElementInterior(source, 0, 1553.7, -1675.5, 16.1) end end addEventHandler("onMarkerHit", marker2, world) now apreas the message again but not interior
Et-win Posted August 6, 2014 Posted August 6, 2014 Are you sure it are the right positions? ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Et-win Posted August 6, 2014 Posted August 6, 2014 setElementInterior(source, 6 ,246.7, 63.3, 1003.6) You are setting the marker to the interior. ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Et-win Posted August 6, 2014 Posted August 6, 2014 Set source to player... Look what 'onMarkerHit' even returns. https://wiki.multitheftauto.com/wiki/OnMarkerHit "The source of this event is the marker that got hit by the element." ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Dimos7 Posted August 6, 2014 Author Posted August 6, 2014 you mean that i need make addEventHandler("onMarkerLeave",marker , interior) and after for marker2 and world?
Et-win Posted August 6, 2014 Posted August 6, 2014 Set source to player @ setElementInterior... setElementInterior(player, 6 ,246.7, 63.3, 1003.6) You had source instead of player. The source = the marker which got hit, not the element. Do this by both setElementInterior codes. ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
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