stormchaser206 Posted August 11, 2012 Posted August 11, 2012 Hello, When ever i use this code, even if i add a number to the argument gaID, it always says "Usage: /garage (Garage ID)". function garageOpenOrClose(sourcePlayer, gaID) --Open Verdeant Meadows garage local gaID = tonumber(gaID) if(gaID) then if(type(gaID ) == "number") then if gaID < 0 or gaID > 49 then if not isGarageOpen(gaID) then setGarageOpen(gaID, true) outputChatBox("Garage opened!", sourcePlayer) else setGarageOpen(gaID, false) outputChatBox("Garage closed!", sourcePlayer) end end end else outputChatBox("Usage: /garage (Garage ID)", sourcePlayer, 255, 0, 0) end end Please help. For a Sample meta code from MTA SA Server Manual:
Castillo Posted August 11, 2012 Posted August 11, 2012 Because the second argument of addCommandHandler is the command used. function garageOpenOrClose(sourcePlayer, gaID) should be: function garageOpenOrClose(sourcePlayer, command, gaID) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
stormchaser206 Posted August 11, 2012 Author Posted August 11, 2012 Still didn't work For a Sample meta code from MTA SA Server Manual:
Castillo Posted August 11, 2012 Posted August 11, 2012 function garageOpenOrClose ( sourcePlayer, command, gaID ) --Open Verdeant Meadows garage local gaID = tonumber ( gaID ) if ( gaID ) then if ( gaID > 0 and gaID < 50 ) then local state = ( not isGarageOpen ( gaID ) ) setGarageOpen ( gaID, state ) outputChatBox ( "Garage ".. ( state and "opened" or "closed" ) .."!", sourcePlayer ) end else outputChatBox ( "Usage: /garage (Garage ID)", sourcePlayer, 255, 0, 0 ) end end addCommandHandler ( "garage", garageOpenOrClose ) That works. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
stormchaser206 Posted August 11, 2012 Author Posted August 11, 2012 function garageOpenOrClose ( sourcePlayer, command, gaID ) --Open Verdeant Meadows garage local gaID = tonumber ( gaID ) if ( gaID ) then if ( gaID > 0 and gaID < 50 ) then local state = ( not isGarageOpen ( gaID ) ) setGarageOpen ( gaID, state ) outputChatBox ( "Garage ".. ( state and "opened" or "closed" ) .."!", sourcePlayer ) end else outputChatBox ( "Usage: /garage (Garage ID)", sourcePlayer, 255, 0, 0 ) end end addCommandHandler ( "garage", garageOpenOrClose ) That works. Thanks For a Sample meta code from MTA SA Server Manual:
Castillo Posted August 11, 2012 Posted August 11, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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