Jump to content

Hide Crosshair


Recommended Posts

Posted
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?

Posted

1: Event should go after function.

2: The timer is useless.

function crosshairhide ( ) 
    showPlayerHudComponent ( source, "crosshair", false ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), crosshairhide ) 

Posted

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" /> 
  

Posted (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 by Guest
  • MTA Team
Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...