Jump to content

guiSetVisible Help


Xeno

Recommended Posts

I'm making a GUI for a certain team on marker hit, and only that team can use it. It all works expect for when I hit the marker it shows up for everyone in the team, heres the code...

  
function onMarkerHitGiveVehicle() 
if getPlayerTeam(lp) == getTeamFromName("Teamname") then 
showCursor(true)   
guiSetVisible(window,true) 
end 
end 
for i,marker in ipairs(markers) do 
addEventHandler("onClientMarkerHit",marker,onMarkerHitGiveVehicle) 
end 

Please help me? :/

Link to comment

You are not checking if the player who hit it is the localPlayer, must be that.

function onMarkerHitGiveVehicle(hitPlayer) 
if (hitPlayer == localPlayer) then 
      if getPlayerTeam(hitPlayer) == getTeamFromName("Teamname") then 
           showCursor(true) 
           guiSetVisible(window,true) 
           end 
     end 
end 
  
for i,marker in ipairs(markers) do 
      addEventHandler("onClientMarkerHit",marker,onMarkerHitGiveVehicle) 
end 

Try it.

Link to comment
You are not checking if the player who hit it is the localPlayer, must be that.
function onMarkerHitGiveVehicle(hitPlayer) 
if (hitPlayer == localPlayer) then 
      if getPlayerTeam(hitPlayer) == getTeamFromName("Teamname") then 
           showCursor(true) 
           guiSetVisible(window,true) 
           end 
     end 
end 
  
for i,marker in ipairs(markers) do 
      addEventHandler("onClientMarkerHit",marker,onMarkerHitGiveVehicle) 
end 

I THINK it works, I have to wait till a USSA person comes on to test it with me. Ill let you know tonight :)

Thanks for your help!

Try it.

Link to comment
His code is fine, and no missing ends, so it must be something else in the rest of the code.

Post it.

Your absolutely right. I missed an end Hah. Thank you Castillo for your help. And thank you JR10 For your advice ;3

1 more thing... How do you get something to check ACL? Like... How would I make it so it checks ACL on marker hit?

Link to comment

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...