kamani Posted February 23, 2010 Share Posted February 23, 2010 Hello forum. I set this marker code: local JobMarker = createMarker( -1985.6575927734, 476.59652709961, 34.021896362305, 'cylinder', 1.0, 0, 255, 0, 150 ) function MarkerHit( source, matchingDimension ) outputChatBox("Text on marker", source) end addEventHandler( "InMarker", JobMarker, MarkerHit ) But when i go in marker (Inside) , don't show this outputchatbox text.. JobMarker in game set, but don't show text when inside in this marker.. Link to comment
dzek (varez) Posted February 23, 2010 Share Posted February 23, 2010 theres no "InMarker" event (until you create one) Server and Client Events: https://wiki.multitheftauto.com/wiki/Server_Scripting_Events https://wiki.multitheftauto.com/wiki/Client_Scripting_Events You should use onMarkerHit if this is server side and onClientMarkerHit if this is client side (your scripts looks like server side, so you will need to use onMarkerHit) Link to comment
kamani Posted February 23, 2010 Author Share Posted February 23, 2010 I changed this, but don't show text when i go to in created marker. Link to comment
Aibo Posted February 23, 2010 Share Posted February 23, 2010 double check then, it works. though you probably better use "hitter", "hitElement" or some other variable instead of "source". because "source" is already sent and it's your marker element. this way you just discarding it by replacing with element that hit the marker. and you may need it later. even if you won't it can be confusing. (50p already discussed that somewhere in this forum) and you should place a check before outputChatBox, whether it's player element who hit the marker. function MarkerHit(hitElement, matchingDimension) if getElementType(hitElement) == "player" then outputChatBox("Text on marker", hitElement) end end addEventHandler( "onMarkerHit", JobMarker, MarkerHit ) anyway, it's all in the wiki Link to comment
kamani Posted February 24, 2010 Author Share Posted February 24, 2010 Thanks, but issue was in CreateMarker size (1.0 = don't work, i changed in 1.5 = worked fine.. ) Link to comment
kamani Posted February 24, 2010 Author Share Posted February 24, 2010 hi, New problem with markers + gui , but don't show menu when i go in marker, mh, i watch examples but can't be worked fine. Server: local myMarker = createMarker( -1985.6575927734, 476.59652709961, 34.021896362305, 'cylinder', 1.5, 0, 255, 0, getRootElement()) addEvent ("RodytiLanga", true) function MarkerHit(hitElement, matchingDimension) if getElementType(hitElement) == "player" then triggerServerEvent ( "RodytiLanga",getRootElement(),"Hello World!") end end addEventHandler( "onMarkerHit", myMarker , MarkerHit ) Client: function ijungtilangus() PradinisLangas = guiCreateWindow(386,330,519,363,"UNIVERSITETO SISTEMA",false) TabLaukas = guiCreateTabPanel(37,58,442,213,false,PradinisLangas) Tabas1 = guiCreateTab("Informacija",TabLaukas) TaboTekstas1 = guiCreateLabel(0,3,442,179,"TEKSTAS APIE INFORMACIJA",false,Tabas1) guiLabelSetColor(TaboTekstas1,255,255,255) guiLabelSetVerticalAlign(TaboTekstas1,"top") guiLabelSetHorizontalAlign(TaboTekstas1,"left",false) Tabas2 = guiCreateTab("Darbuotojai",TabLaukas) TaboTekstas2 = guiCreateLabel(1,4,440,175,"TEKSTAS APIE DARBUOTOJUS",false,Tabas2) guiLabelSetColor(TaboTekstas2,255,255,255) guiLabelSetVerticalAlign(TaboTekstas2,"top") guiLabelSetHorizontalAlign(TaboTekstas2,"left",false) Tabas3 = guiCreateTab("Taisykles",TabLaukas) TaboTekstas3 = guiCreateLabel(0,7,442,175,"TEKSTAS APIE TAISYKLES",false,Tabas3) guiLabelSetColor(TaboTekstas3,255,255,255) guiLabelSetVerticalAlign(TaboTekstas3,"top") guiLabelSetHorizontalAlign(TaboTekstas3,"left",false) ApatinisTekstas = guiCreateLabel(39,274,310,33,"Jai viska jau perskaitete ir norite istoti, pasirinkite Istoti",false,PradinisLangas) guiLabelSetColor(ApatinisTekstas,255,255,255) guiLabelSetVerticalAlign(ApatinisTekstas,"top") guiLabelSetHorizontalAlign(ApatinisTekstas,"left",false) MygtIstoti = guiCreateButton(44,318,121,29,"Istoti",false,PradinisLangas) MygtUzdaryti = guiCreateButton(196,319,121,27,"Uzdaryti Langa",false,PradinisLangas) MygtNutraukti = guiCreateButton(354,319,121,29,"Nutraukti Mokyma",false,PradinisLangas) end addEventHandler( "onClientGUIClick", MygtUzdaryti, uzdaryti) function rodyti() ijungtilangus() guiSetVisible (PradinisLangas, true) showCursor (true) end addEvent ("RodytiLanga", true) addEventHandler( "RodytiLanga", getRootElement(), rodyti ) function uzdaryti() guiSetVisible( PradinisLangas, false ) showCursor( false ) end Link to comment
dzek (varez) Posted February 24, 2010 Share Posted February 24, 2010 addEvent ("RodytiLanga", true) on serverside isnt needed and clientside probably hangs on 28 line becouse of adding event handler to unexisting button (MygtUzdaryti dont exist at time of firing up the script). so the rest not working on client: you should create window, hide it, and just showing when somebody hits the marker, now, if this will be corrected, it will be creating more and more windows, staying in client RAM when somebody hit marker more than once.. ingame open console (f8) and type "debugscript 3" .. it will help you ps. and you can create a marker client-side too ps2. nad it is good idea to make english name of variables and functions (im not talking about the gui messages) Link to comment
Aibo Posted February 24, 2010 Share Posted February 24, 2010 triggerServerEvent ( "RodytiLanga",getRootElement(),"Hello World!") triggerServerEvent is client-only function, and you use it in server-side script. *) if you want to trigger some event from server for particular player, use triggerClientEvent: triggerClientEvent ( hitElement, "RodytiLanga", getRootElement(), "Hello World!") Link to comment
kamani Posted February 24, 2010 Author Share Posted February 24, 2010 thanks, worked fine 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