Mr. Marston Posted July 29, 2012 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?
Castillo Posted July 29, 2012 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 )
Mr. Marston Posted July 29, 2012 Author Posted July 29, 2012 <meta> <info author="marston" name="chc" version="1.0.0" type="script" /> <script src="client.lua" type="client" /> </meta>
Castillo Posted July 29, 2012 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" />
Andreas. Posted July 29, 2012 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
Castillo Posted July 29, 2012 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.
Mr. Marston Posted July 29, 2012 Author Posted July 29, 2012 I've closed and started server and still same problem.Resource started but does not hide crosshair.
TAPL Posted July 29, 2012 Posted July 29, 2012 You may have other resources showing the crosshair again.
Jaysds1 Posted August 2, 2012 Posted August 2, 2012 ok, post us your whole script, your meta.xml so we could see what you have right now.
MTA Team qaisjp Posted August 2, 2012 MTA Team 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.
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