gokalpfirat Posted July 1, 2011 Posted July 1, 2011 --server side g_Root = getRootElement() function visible (thePlayer) acc = getPlayerAccount (thePlayer) if (getAccountData(acc,"drive")==1) then triggerClientEvent ( "onDriving", g_Root ) else triggerClientEvent ( "onElse", g_Root ) end end --client side g_Root = getRootElement() function setVisible() local player = getLocalPlayer() setElementVisibleTo(marker1,player,true) end addEvent("onDriving",true) addEventHandler("onDriving",g_Root,setVisible) function elsev() local player = getLocalPlayer() setElementVisibleTo(marker1,player,false) end addEvent("onElse",true) addEventHandler("onElse",g_Root,elsev) I havent got error at debug dont ask.
JR10 Posted July 1, 2011 Posted July 1, 2011 setElementVisibleTo is server side only. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
MTA Team qaisjp Posted July 1, 2011 MTA Team Posted July 1, 2011 --server side g_Root = getRootElement() function visible (thePlayer) acc = getPlayerAccount (thePlayer) if (getAccountData(acc,"drive")==1) then triggerClientEvent ( "onDriving", g_Root ) else triggerClientEvent ( "onElse", g_Root ) end end --client side g_Root = getRootElement() function setMarkerAlpha(marker,a) local r,g,b,_ = getMarkerColor(marker) setMarkerColor(marker, r,g,b, tonumber(a)) end function setVisible() local player = getLocalPlayer() setMarkerAlpha(marker1, 255) end addEvent("onDriving",true) addEventHandler("onDriving",g_Root,setVisible) function elsev() local player = getLocalPlayer() setMarkerAlpha(marker1, 0) end addEvent("onElse",true) addEventHandler("onElse",g_Root,elsev)
gokalpfirat Posted July 1, 2011 Author Posted July 1, 2011 function visible (thePlayer) acc = getPlayerAccount (thePlayer) if (getAccountData(acc,"drive")==1) then setElementVisibleTo(marker1,thePlayer,false) else setElementVisibleTo(marker1,thePlayer,true) end end I use this too but doesnt works.
JR10 Posted July 1, 2011 Posted July 1, 2011 Where is marker1 defined? Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
gokalpfirat Posted July 1, 2011 Author Posted July 1, 2011 function onResourceStart(res) createBlip (-1942.72265625,667.845703125,46.5625,56) marker1 = createMarker (-1917.5,671.4345703125,45.5625,"cylinder",1.2,0,255,0) end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),onResourceStart) function visible (thePlayer) acc = getPlayerAccount (thePlayer) if (getAccountData(acc,"drive")==1) then setElementVisibleTo(marker1,thePlayer,false) else setElementVisibleTo(marker1,thePlayer,true) end end
MTA Team qaisjp Posted July 1, 2011 MTA Team Posted July 1, 2011 I know, the marker is server sided, if you tell me where you trigger the client event you could add the marker as a parameter there triggerClientEvent("...", getRootElement(), maker1) etc.
gokalpfirat Posted July 1, 2011 Author Posted July 1, 2011 function onResourceStart(res) createBlip (-1942.72265625,667.845703125,46.5625,56) marker1 = createMarker (-1917.5,671.4345703125,45.5625,"cylinder",1.2,0,255,0) end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),onResourceStart) function visible (thePlayer) acc = getPlayerAccount (thePlayer) if (getAccountData(acc,"drive")==1) then setElementVisibleTo(marker1,thePlayer,false) else setElementVisibleTo(marker1,thePlayer,true) end end I write in server side and not working can you fix it?
Jaysds1 Posted July 1, 2011 Posted July 1, 2011 try this: function onResourceStart(res) createBlip (-1942.72265625,667.845703125,46.5625,56) marker1 = createMarker (-1917.5,671.4345703125,45.5625,"cylinder",1.2,0,255,0) end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),onResourceStart) function visible (player) acc = getPlayerAccount (player) if (getAccountData(acc,"drive")==1) then setElementVisibleTo(marker1,player,false) else setElementVisibleTo(marker1,player,true) end end My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
JR10 Posted July 1, 2011 Posted July 1, 2011 Jaysds1, changind the variable to thePlayer won't differ. And where is visible function used. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
gokalpfirat Posted July 2, 2011 Author Posted July 2, 2011 setElementVisibleTo(marker1,thePlayer,false) There is visible function
JR10 Posted July 2, 2011 Posted July 2, 2011 No i mean the function: function visible (player) Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
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