Jump to content

Problem with a script.


Jumba'

Recommended Posts

Posted

Ok, so I made a script to start a map vote on join if there's no map and it works, but it also starts a vote when there IS a map loaded.

here's the script.

  
function startVote( ) 
     local joinedPlayerName = getClientName ( source ) 
     local mode = getGameType () 
     if( mode == nil ) then 
     executeCommandHandler ( "votemode", source ) 
     outputChatBox ( "Welcome to the server" .. joinedPlayerName .. ". There's currently no map running so choose one. " , source, 255, 255, 0 ) 
    end 
end 
  
addEventHandler ( "onPlayerJoin", getRootElement(), startVote ) 
  

-edit-

i think it always starts the vote because it told me that mode was nil even thought i was running fallout. any idea what could be causing this?

Posted
I think it's because there is only one map for fallout and that is the default one. Don't hold me to it though.

yea, i thought aout that so I changed it from getMapType to getGameType which should detect a gamemode.

Posted

Yea, I tried using call but I couldn't get it to work. To get executeCommandHandler to work i added it to the acl, but im just trying to figure out why it starts the vote even if the map is loaded. that's the biggest problem now.

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