ViRuZGamiing Posted December 31, 2012 Posted December 31, 2012 Hello Community, I have 2 Gates and "apart" they work 100% but... Together only 1 Opens and after that nothing happens. My 2 Gate scripts: local gate = createObject(971, -2182.5, 1009.3994140625, 82.599998474121, 0, 0, 0) megusta = false addCommandHandler("gate", function (source) if ( getTeamName ( getPlayerTeam ( source ) ) == "West Coast Cribs" ) then if (megusta == false) then moveObject(gate, 2500, -2182.5, 1009.3994140625, 82.599998474121, 0, 0, 0 ) megusta = true elseif (megusta == true) then moveObject(gate, 2500, -2176.5, 1009.3994140625, 82.599998474121, 0, 0, 0 ) megusta = false else outputChatBox( "you're not a member of the West Coast Cribs!", source, 0, 255, 0, true ) end end end) local gate = createObject(971, -2191.2998046875, 1009.3994140625, 82.599998474121, 0, 0, 0) megusta = false addCommandHandler("gate", function (source) if ( getTeamName ( getPlayerTeam ( source ) ) == "West Coast Cribs" ) then if (megusta == false) then moveObject(gate, 2500, -2191.2998046875, 1009.3994140625, 82.599998474121, 0, 0, 0 ) megusta = true elseif (megusta == true) then moveObject(gate, 2500, -2198.2998046875, 1009.3994140625, 82.599998474121, 0, 0, 0 ) megusta = false else outputChatBox( "you're not a member of the West Coast Cribs!", source, 0, 255, 0, true ) end end end) I want they both to open when I write /gate Thanks, Greetings Billy "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
3NAD Posted December 31, 2012 Posted December 31, 2012 -- Try this gate1 = createObject(971, -2182.5, 1009.3994140625, 82.599998474121, 0, 0, 0) gate2 = createObject(971, -2191.2998046875, 1009.3994140625, 82.599998474121, 0, 0, 0) megusta = false addCommandHandler ( "gate", function ( source ) if ( getPlayerTeam ( source ) == getTeamFromName ( "West Coast Cribs" ) ) then if ( megusta ~= true ) then moveObject ( gate1, 2500, -2182.5, 1009.3994140625, 82.599998474121 ) moveObject ( gate2, 2500, -2191.2998046875, 1009.3994140625, 82.599998474121 ) megusta = true else moveObject ( gate1, 2500, -2176.5, 1009.3994140625, 82.599998474121 ) moveObject ( gate2, 2500, -2198.2998046875, 1009.3994140625, 82.599998474121 ) megusta = false end else outputChatBox( "you're not a member of the West Coast Cribs!", source, 0, 255, 0, true ) end end )
ViRuZGamiing Posted December 31, 2012 Author Posted December 31, 2012 Thanks "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
ViRuZGamiing Posted December 31, 2012 Author Posted December 31, 2012 Also here; local gate = createObject(971, -1530.1999511719, 482.20001220703, 8.8000001907349, 0, 0, 0) megusta = false addCommandHandler("gate", function (source) if ( getTeamName ( getPlayerTeam ( source ) ) == "Army" ) then if (megusta == false) then moveObject(gate, 2500, -1530.1999511719, 482.20001220703, 1.9, 0, 0, 0 ) megusta = true elseif (megusta == true) then moveObject(gate, 2500, -1530.1999511719, 482.20001220703, 8.8000001907349, 0, 0, 0 ) megusta = false else outputChatBox( "you're not a member of the Army!", source, 0, 255, 0, true ) end end end) It's possible to open this only as Army know but i want the MP also be able to open it "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
3NAD Posted December 31, 2012 Posted December 31, 2012 Lol, i didn't see any Changes at the code, Only the position of gate and the team !! You can do it by your self.
ViRuZGamiing Posted December 31, 2012 Author Posted December 31, 2012 I meant can I just do behind Army a "," and then write MP "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
AhmadQTR Posted December 31, 2012 Posted December 31, 2012 Maybe if ( getTeamName ( getPlayerTeam ( source ) ) == "Army" or "MP" ) then Nobody is perfect , I'm nobody. Skype : ahmad.nasser37
abu5lf Posted December 31, 2012 Posted December 31, 2012 (edited) Maybe if ( getTeamName ( getPlayerTeam ( source ) ) == "Army" or "MP" ) then Wrong. aTeamName = { [ 'Army' ] = true ; [ 'MP' ] = true ; } if aTeamName[ getTeamName( getPlayerTeam( source ) ) ] then -- etc.. end Edited December 31, 2012 by Guest ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
AhmadQTR Posted December 31, 2012 Posted December 31, 2012 Then make a table with the team names. Nobody is perfect , I'm nobody. Skype : ahmad.nasser37
ViRuZGamiing Posted December 31, 2012 Author Posted December 31, 2012 @3ɑsн8 ɑʟsнɾq How then? "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
ViRuZGamiing Posted December 31, 2012 Author Posted December 31, 2012 This in Complete? aTeamName = { [ 'Army' ] = true ; [ 'MP' ] = true ; } if aTeamName[ getTeamName( getPlayerTeam( source ) ) ] then local gate = createObject(971, -1530.1999511719, 482.20001220703, 8.8000001907349, 0, 0, 0) megusta = false addCommandHandler("gate", function (source) if ( getTeamName ( getPlayerTeam ( source ) ) == "Army" ) then if (megusta == false) then moveObject(gate, 2500, -1530.1999511719, 482.20001220703, 1.9, 0, 0, 0 ) megusta = true elseif (megusta == true) then moveObject(gate, 2500, -1530.1999511719, 482.20001220703, 8.8000001907349, 0, 0, 0 ) megusta = false else outputChatBox( "you're not a member of the Army!", source, 0, 255, 0, true ) end end end) end Correct me if i'm wrong "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
abu5lf Posted December 31, 2012 Posted December 31, 2012 aTeamName = { [ 'Army' ] = true ; [ 'MP' ] = true ; } local gate = createObject(971, -1530.1999511719, 482.20001220703, 8.8000001907349, 0, 0, 0) megusta = false addCommandHandler("gate", function (source) if aTeamName[ getTeamName( getPlayerTeam( source ) ) ] then if (megusta == false) then moveObject(gate, 2500, -1530.1999511719, 482.20001220703, 1.9, 0, 0, 0 ) megusta = true elseif (megusta == true) then moveObject(gate, 2500, -1530.1999511719, 482.20001220703, 8.8000001907349, 0, 0, 0 ) megusta = false else outputChatBox( "you're not a member of the Army!", source, 0, 255, 0, true ) end end end ) ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
ViRuZGamiing Posted December 31, 2012 Author Posted December 31, 2012 Problem solve the "Army" or "MP" worked, Thanks to keep it short "α7мα∂qтя" @3ɑsн8 ɑʟsнɾq why you said it was wrong? You didn't try it "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
abu5lf Posted December 31, 2012 Posted December 31, 2012 if 'H' == 'S' or 'M' then print( 'true' ) else print( 'false' ) end Because this always return 'true', Although not equal. ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
TAPL Posted December 31, 2012 Posted December 31, 2012 Maybe if ( getTeamName ( getPlayerTeam ( source ) ) == "Army" or "MP" ) then should be local TeamName = getTeamName(getPlayerTeam(source)) if (TeamName == "Army") or (TeamName == "MP") then
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