Jump to content

What is wrong ?


FuriouZ

Recommended Posts

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

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

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