Mr. Marston Posted July 29, 2012 Share Posted July 29, 2012 addEventHandler ( "onPlayerJoin", getRootElement(), crosshairhide ) function crosshairhide ( text ) showPlayerHudComponent ( source, "crosshair", false ) setTimer ( crosshairhide, 1, 1, "." ) end this is my first script but does not work.I know scm(cleo language for gta sa) and visual basic but I dont understand lua language :C what is wrong with my script? Link to comment
Castillo Posted July 29, 2012 Share Posted July 29, 2012 1: Event should go after function. 2: The timer is useless. function crosshairhide ( ) showPlayerHudComponent ( source, "crosshair", false ) end addEventHandler ( "onPlayerJoin", getRootElement(), crosshairhide ) Link to comment
Mr. Marston Posted July 29, 2012 Author Share Posted July 29, 2012 but still does not hide crosshair Link to comment
Castillo Posted July 29, 2012 Share Posted July 29, 2012 Post your "meta.xml" content. Link to comment
Mr. Marston Posted July 29, 2012 Author Share Posted July 29, 2012 <meta> <info author="marston" name="chc" version="1.0.0" type="script" /> <script src="client.lua" type="client" /> </meta> Link to comment
Castillo Posted July 29, 2012 Share Posted July 29, 2012 As I supposed, the script is set as client side, but onPlayerJoin event is server side. "marston" name="chc" version="1.0.0" type="script" /> Link to comment
Mr. Marston Posted July 29, 2012 Author Share Posted July 29, 2012 But still crosshair shows up. Link to comment
Andreas. Posted July 29, 2012 Share Posted July 29, 2012 (edited) that's impossible, it have to work but you could try and make it client sided again: function disableCrosshair() showPlayerHudComponent("crosshair", false) end addEventHandler("onClientPlayerJoin", root, disableCrosshair) and meta.xml <meta> <info author="marston" name="chc" version="1.0.0" type="script" /> <script src="client.lua" type="client" /> </meta> Edited July 29, 2012 by Guest Link to comment
Castillo Posted July 29, 2012 Share Posted July 29, 2012 @Andreas: The event onClientPlayerJoin is triggered for remote players, not for the local player, he should use onClientResourceStart if he wants it client side. Link to comment
Mr. Marston Posted July 29, 2012 Author Share Posted July 29, 2012 I've closed and started server and still same problem.Resource started but does not hide crosshair. Link to comment
TAPL Posted July 29, 2012 Share Posted July 29, 2012 You may have other resources showing the crosshair again. Link to comment
Mr. Marston Posted July 30, 2012 Author Share Posted July 30, 2012 I'll try disable all resources. Link to comment
Jaysds1 Posted August 2, 2012 Share Posted August 2, 2012 ok, post us your whole script, your meta.xml so we could see what you have right now. Link to comment
qaisjp Posted August 2, 2012 Share Posted August 2, 2012 CLIENT SIDE! addEventHandler('onClientResourceStart',resourceRoot,function() showPlayerHudComponent('crosshair',false) end) .. If that doesn't work: 1) You are conflicting with another script 2) You are doing something wrong. 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