5150 Posted August 13, 2015 Share Posted August 13, 2015 hi, i have an issue and i wanna see if the people of the internet can help.... i was wondering if someone could make me a script that blocks: minigun rocket launcher rocket launcher (HS) desert eagle grenade combat shotgun country rifle tec9 mp5 ak47 i am new to scripting still, and it would e really awesome having someone help. also, please tell me where i place the script after its made. is it the same process for vehicles too? ive looked in lots of places and its hard to find a simple answer Link to comment
nasserdfdd Posted August 13, 2015 Share Posted August 13, 2015 go go go toggleControl onClientPlayerWeaponSwitch Link to comment
Danz Posted August 13, 2015 Share Posted August 13, 2015 go go go toggleControl onClientPlayerWeaponSwitch Instead of being a "know-it-all" why don't you help him, give him an example of how to do what he requested when your "Scripting skill is 92%"? hi, i have an issue and i wanna see if the people of the internet can help.... i was wondering if someone could make me a script that blocks:minigun rocket launcher rocket launcher (HS) desert eagle grenade combat shotgun country rifle tec9 mp5 ak47 i am new to scripting still, and it would e really awesome having someone help. also, please tell me where i place the script after its made. is it the same process for vehicles too? ive looked in lots of places and its hard to find a simple answer Anyway here, this should block all of the weapons you requested (Taken from the Wiki, i just added some more IDs) WeaponID = { [38] = true, --Minigun [35] = true, --Rocket Launcher [36] = true, --HS Rocker Launcher [24] = true, --Deagle [16] = true, --Grenade [27] = true, --Combat Shotgun [33] = true, --Country Rifle [29] = true, --MP5 [32] = true, --Tec9 [30] = true, --AK-47 } function blockWeaponsOnSwitch (previousWeaponID, currentWeaponID) if WeaponID[currentWeaponID] then toggleControl(source, "aim_weapon", false) toggleControl(source, "fire", false) else toggleControl(source, "aim_weapon", true) toggleControl(source, "fire", true) end end addEventHandler("onPlayerWeaponSwitch", root, blockWeaponsOnSwitch) Make sure to place this script in a SERVER-SIDE script/file I could not find a way to block vehicles, do you want to block vehicles from being spawned, or block them from being entered? Link to comment
Wumbaloo Posted August 13, 2015 Share Posted August 13, 2015 I think i got you to block vehicles, check this out: https://forum.multitheftauto.com/viewtopic.php?f=91&t=91367 Link to comment
5150 Posted August 15, 2015 Author Share Posted August 15, 2015 go go go toggleControl onClientPlayerWeaponSwitch Instead of being a "know-it-all" why don't you help him, give him an example of how to do what he requested when your "Scripting skill is 92%"? hi, i have an issue and i wanna see if the people of the internet can help.... i was wondering if someone could make me a script that blocks:minigun rocket launcher rocket launcher (HS) desert eagle grenade combat shotgun country rifle tec9 mp5 ak47 i am new to scripting still, and it would e really awesome having someone help. also, please tell me where i place the script after its made. is it the same process for vehicles too? ive looked in lots of places and its hard to find a simple answer Anyway here, this should block all of the weapons you requested (Taken from the Wiki, i just added some more IDs) WeaponID = { [38] = true, --Minigun [35] = true, --Rocket Launcher [36] = true, --HS Rocker Launcher [24] = true, --Deagle [16] = true, --Grenade [27] = true, --Combat Shotgun [33] = true, --Country Rifle [29] = true, --MP5 [32] = true, --Tec9 [30] = true, --AK-47 } function blockWeaponsOnSwitch (previousWeaponID, currentWeaponID) if WeaponID[currentWeaponID] then toggleControl(source, "aim_weapon", false) toggleControl(source, "fire", false) else toggleControl(source, "aim_weapon", true) toggleControl(source, "fire", true) end end addEventHandler("onPlayerWeaponSwitch", root, blockWeaponsOnSwitch) Make sure to place this script in a SERVER-SIDE script/file I could not find a way to block vehicles, do you want to block vehicles from being spawned, or block them from being entered? i want then to only be spawned by admins. i want them enterable if they are spawned though. so basically i want a block on spawning them. and by the way thanks for the script. i add it in like any other resource right? server/mods/deathmatch/resources? Link to comment
HUNGRY:3 Posted August 15, 2015 Share Posted August 15, 2015 Which gamemode you're using freeroam? If so edit the resource Link to comment
Danz Posted August 15, 2015 Share Posted August 15, 2015 (edited) go go go toggleControl onClientPlayerWeaponSwitch Instead of being a "know-it-all" why don't you help him, give him an example of how to do what he requested when your "Scripting skill is 92%"? hi, i have an issue and i wanna see if the people of the internet can help.... i was wondering if someone could make me a script that blocks:minigun rocket launcher rocket launcher (HS) desert eagle grenade combat shotgun country rifle tec9 mp5 ak47 i am new to scripting still, and it would e really awesome having someone help. also, please tell me where i place the script after its made. is it the same process for vehicles too? ive looked in lots of places and its hard to find a simple answer Anyway here, this should block all of the weapons you requested (Taken from the Wiki, i just added some more IDs) WeaponID = { [38] = true, --Minigun [35] = true, --Rocket Launcher [36] = true, --HS Rocker Launcher [24] = true, --Deagle [16] = true, --Grenade [27] = true, --Combat Shotgun [33] = true, --Country Rifle [29] = true, --MP5 [32] = true, --Tec9 [30] = true, --AK-47 } function blockWeaponsOnSwitch (previousWeaponID, currentWeaponID) if WeaponID[currentWeaponID] then toggleControl(source, "aim_weapon", false) toggleControl(source, "fire", false) else toggleControl(source, "aim_weapon", true) toggleControl(source, "fire", true) end end addEventHandler("onPlayerWeaponSwitch", root, blockWeaponsOnSwitch) Make sure to place this script in a SERVER-SIDE script/file I could not find a way to block vehicles, do you want to block vehicles from being spawned, or block them from being entered? i want then to only be spawned by admins. i want them enterable if they are spawned though. so basically i want a block on spawning them. and by the way thanks for the script. i add it in like any other resource right? server/mods/deathmatch/resources? Yes, but make sure that resource is Server-Sided in the meta.xml file EDIT: This should do the trick for you function restrictVehicleSpawn (player, command, id) local accountName = getAccountName(getPlayerAccount(player)) if not isObjectInACLGroup("user."..accountName, aclGetGroup("Admin")) then outputChatBox("This feature is restricted to Admins only", player, 255, 0, 0) else if not id or not tonumber(id) then outputChatBox("Usage: /createveh ") return false end local id = math.floor(tonumber(id)) --Yet these 2 IDs do not exist, i just used them so that you can spawn the vehicle ID: 400 and 611 if id and id > 399 and id < 612 then local x, y, z = getElementPosition(player) local _, _, rz = getElementRotation(player) vehicle = createVehicle(id, x, y, z, _, _, rz) setVehicleColor(vehicle, 255, 255, 255) warpPedIntoVehicle(player, vehicle) outputChatBox("You have created a "..getVehicleNameFromModel(id).." (ID: "..id..")", player, 0, 255, 0) else outputChatBox("Invalid ID Entered, use IDs from 400 to 611", player, 255, 0, 0) end end end addCommandHandler("createveh", restrictVehicleSpawn) function restrictVehicleEntering (player) local accountName = getAccountName(getPlayerAccount(player)) if not isElement(vehicle) then return end if not isObjectInACLGroup("user."..accountName, aclGetGroup("Admin")) then outputChatBox("You cannot enter this vehicle", player, 255, 0, 0) cancelEvent() end end addEventHandler("onVehicleStartEnter", root, restrictVehicleEntering) Edited August 15, 2015 by Guest Link to comment
5150 Posted August 15, 2015 Author Share Posted August 15, 2015 (edited) ok. resources/freeroam/______? sorry im pretty much brand new to freeroam resource editing NEVERMIND Edited August 15, 2015 by Guest Link to comment
5150 Posted August 15, 2015 Author Share Posted August 15, 2015 OH i think i found it thanks guys Link to comment
Danz Posted August 15, 2015 Share Posted August 15, 2015 anyway check my edited post, i've done what you asked Link to comment
5150 Posted August 18, 2015 Author Share Posted August 18, 2015 all you have to do is go to admin panel (p), click the settings on the freeroam resource, and find weapons (or vehicles)/disallowed, then delete the [ [ ] ] and add the IDs of what you want blocked Link to comment
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