Jorgito'Molina Posted March 31, 2013 Posted March 31, 2013 function resourceStart () setGlitchEnabled ( "quickreload", true ) setGlitchEnabled ( "fastmove", true ) setGlitchEnabled ( "fastfire", true ) setGlitchEnabled ( "crouchbug", true ) if not allow[weapon] then setPedWeaponSlot ( source, 1 ) end end addEventHandler ( "onResourceStart", getResourceRootElement ( ), resourceStart ) function resourceStop () setGlitchEnabled ( "quickreload", false ) setGlitchEnabled ( "fastmove", false ) setGlitchEnabled ( "fastfire", false ) setGlitchEnabled ( "crouchbug", false ) end addEventHandler ( "onResourceStop", getResourceRootElement ( ), resourceStop ) allow = { [24] = true, [25] = true, [33] = true, [34] = true } what is the problem, is not allow all weapons.
Jaysds1 Posted March 31, 2013 Posted March 31, 2013 Try this: local allow = { [24] = true, [25] = true, [33] = true, [34] = true } function resourceStart () setGlitchEnabled ( "quickreload", true ) setGlitchEnabled ( "fastmove", true ) setGlitchEnabled ( "fastfire", true ) setGlitchEnabled ( "crouchbug", true ) end addEventHandler ( "onResourceStart",resourceRoot, resourceStart ) function resourceStop () setGlitchEnabled ( "quickreload", false ) setGlitchEnabled ( "fastmove", false ) setGlitchEnabled ( "fastfire", false ) setGlitchEnabled ( "crouchbug", false ) end addEventHandler ( "onResourceStop",resourceRoot, resourceStop ) addEventHandler("onPlayerWeaponSwitch",root,function(pWep,nWep) if not allow[pWep] or not allow[nWep] then setPedWeaponSlot ( source, 1 ) end end) My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Jaysds1 Posted March 31, 2013 Posted March 31, 2013 What do you want in the script??? I added if you switch your weapon, then it will set the players current weapon to melee. My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Jorgito'Molina Posted March 31, 2013 Author Posted March 31, 2013 setGlitchEnabled allow following weapons 24,25,33,34 other weapons not allow.
Perfect Posted April 1, 2013 Posted April 1, 2013 Try. (Not Tested) local allow = { [24] = true, [25] = true, [33] = true, [34] = true } function resourceStart () if allow then setGlitchEnabled ( "quickreload", true ) setGlitchEnabled ( "fastmove", true ) setGlitchEnabled ( "fastfire", true ) setGlitchEnabled ( "crouchbug", true ) end end addEventHandler ( "onResourceStart",resourceRoot, resourceStart ) function resourceStop () setGlitchEnabled ( "quickreload", false ) setGlitchEnabled ( "fastmove", false ) setGlitchEnabled ( "fastfire", false ) setGlitchEnabled ( "crouchbug", false ) end addEventHandler ( "onResourceStop",resourceRoot, resourceStop ) Multi Theft Auto Player since middle of 2011. Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.
Ludo Posted April 1, 2013 Posted April 1, 2013 You can't just do that. Because that you need has to be triggered with "onPedWeaponSwitch", but if someone switches his weapon to a non-allowed one, then the glitch will be disabled for ALL THE PLAYERS, also for ones who have an allowed weapon, because setGlitchEnabled is a server-side function.
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