FuriouZ Posted September 11, 2013 Share Posted September 11, 2013 Hey, what is wrong with it ? client: local Freeroam = "Freeroam Arena" local freeroamPlayer = getLocalPlayer () - - - - function showVehiclesGui() if not freeroamPlayer then outputChatBox ( "Vehicles are only allowed in Freeroam Arena.", 255, 0, 0, true ) else if ( getTeamName( getPlayerTeam( freeroamPlayer ) ) == Freeroam ) then if guiGetVisible(GUIEditor_Window[1]) == true then guiSetVisible(GUIEditor_Window[1], false) showCursor(false) else guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end end end function bindVehiclesGui() bindKey("F2", "down", showVehiclesGui) end addEventHandler("onClientResourceStart", resourceRoot, bindVehiclesGui) addEventHandler("onPlayerJoin", resourceRoot, bindVehiclesGui) It works, but only problem is that, if i am in another arena and press F2 then it doesn't appear in chatbox("Vehicles are only allowed in Freeroam Arena."). Thanks Link to comment
TAPL Posted September 11, 2013 Share Posted September 11, 2013 function showVehiclesGui() local team = getPlayerTeam(localPlayer) local FreeroamTeam = getTeamFromName("Freeroam Arena") if team and FreeroamTeam and team == FreeroamTeam then if guiGetVisible(GUIEditor_Window[1]) then guiSetVisible(GUIEditor_Window[1], false) showCursor(false) else guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end else outputChatBox("Vehicles are only allowed in Freeroam Arena.", 255, 0, 0, true) end end bindKey("F2", "down", showVehiclesGui) Link to comment
FuriouZ Posted September 12, 2013 Author Share Posted September 12, 2013 Thanks ! But if i want add two teams there,who can use cars, then how should i do ? I tryed,but this doesn't work, with it i can use cars in all teams function showVehiclesGui() local team = getPlayerTeam(localPlayer) local FreeroamTeam = getTeamFromName("Freeroam Arena") local StuntageTeam = getTeamFromName("Stuntage Arena") if team and FreeroamTeam or StuntageTeam and team == FreeroamTeam or StuntageTeam then if guiGetVisible(GUIEditor_Window[1]) then guiSetVisible(GUIEditor_Window[1], false) showCursor(false) else guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end else outputChatBox("Vehicles are only allowed in Freeroam and -Stuntage Arena.", 255, 0, 0, true) end end bindKey("F2", "down", showVehiclesGui) Link to comment
FuriouZ Posted September 13, 2013 Author Share Posted September 13, 2013 Can someone help ? Link to comment
Blaawee Posted September 13, 2013 Share Posted September 13, 2013 function showVehiclesGui() local team = getPlayerTeam(localPlayer) local FreeroamTeam = getTeamFromName("Freeroam Arena") local StuntageTeam = getTeamFromName("Stuntage Arena") if team and FreeroamTeam and StuntageTeam and team == FreeroamTeam or team == StuntageTeam then if guiGetVisible(GUIEditor_Window[1]) then guiSetVisible(GUIEditor_Window[1], false) showCursor(false) else guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end else outputChatBox("Vehicles are only allowed in Freeroam and -Stuntage Arena.", 255, 0, 0, true) end end bindKey("F2", "down", showVehiclesGui) 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