[QUOTE=Vipes;45583576]Where exactly do I put the DM script? I guess not lua/autorun/server[/QUOTE]
lua/autorun
Thats badass that you are devoting time to making scripts for people!
[QUOTE=Exho;45584085]Thats badass that you are devoting time to making scripts for people![/QUOTE]
Thanks! It's good to just listen to music and code, distracts me from other things and it feels great to hear positive feedback from people and give a positive influence.
[QUOTE=AnonTakesOver;45583968]lua/autorun[/QUOTE]
It's not working for some reason. +gamemode sandbox right?
And trying to host a server with the script if it makes a difference.
And I have a few more script requests
1) A varient of the DM that only allows two weapons on a person. If a person wants to get a new weapon, they must push E on a weapon they want, while holding a weapon they don't want. Could you prehaps add a kill/frag limit to both this DM and the other DM, and once reached, map voting starts? Ties in to request 3.
2) A script that plays a song on repeat, depending on what map is played. For example, Map A would loop Song 1, Map C would loop song 3.
3) Something like the Fretta Mapvoting on the Workshop, but instead of using prefixes, it uses a map whitelist. Example
if.gamemode = sandbox maps {
gm_flatgrass
ttt_clue_se
ctf_2fort
}
Really nice of you to be doing this!
Thanks for your help it's amazing!
Wondering if there was a way you could make a DarkRP tool or command to set a location where a random weapon will spawn.
The gamemode is DarkRP, I know TTT has a swep like this.
I have a gamemode thats using DarkRP as the base but i've edited the theme to be a Mad Max TDM type setup using various addons for leveling, managing teams.
I want to be able to set locations for weapons to spawn into the world for certain periods of time that's set by an admin.
So I left click a spot, type in the weapon name and then the time that it exists for and also the time that needs to elapse before it respawns again (or even randomize it)
That would be cool!
[QUOTE=nzkfc;45584659]Thanks for your help it's amazing!
Wondering if there was a way you could make a DarkRP tool or command to set a location where a random weapon will spawn.
The gamemode is DarkRP, I know TTT has a swep like this.
I have a gamemode thats using DarkRP as the base but i've edited the theme to be a Mad Max TDM type setup using various addons for leveling, managing teams.
I want to be able to set locations for weapons to spawn into the world for certain periods of time that's set by an admin.
So I left click a spot, type in the weapon name and then the time that it exists for and also the time that needs to elapse before it respawns again (or even randomize it)
That would be cool![/QUOTE]
Yep easy, I'm at school right now, I'll do it once I'm at home.
[editline]4th August 2014[/editline]
[QUOTE=Vipes;45584277]It's not working for some reason. +gamemode sandbox right?
And trying to host a server with the script if it makes a difference.
And I have a few more script requests
1) A varient of the DM that only allows two weapons on a person. If a person wants to get a new weapon, they must push E on a weapon they want, while holding a weapon they don't want. Could you prehaps add a kill/frag limit to both this DM and the other DM, and once reached, map voting starts? Ties in to request 3.
2) A script that plays a song on repeat, depending on what map is played. For example, Map A would loop Song 1, Map C would loop song 3.
3) Something like the Fretta Mapvoting on the Workshop, but instead of using prefixes, it uses a map whitelist. Example
if.gamemode = sandbox maps {
gm_flatgrass
ttt_clue_se
ctf_2fort
}[/QUOTE]
Hmm seems easy, I'll see what I can do once I get home
[editline]4th August 2014[/editline]
[QUOTE=code_gs;45584591]Really nice of you to be doing this![/QUOTE]
Thanks :)
Do you happen to know if anyone made a permanent entity/prop remover? Say like you start up a map that has weapons, use the tool, and save what you did, each time it starts up, what you used the tool on won't be there.
[QUOTE=Vipes;45586199]Do you happen to know if anyone made a permanent entity/prop remover? Say like you start up a map that has weapons, use the tool, and save what you did, each time it starts up, what you used the tool on won't be there.[/QUOTE]
You could use [URL="http://wiki.garrysmod.com/page/ents/FindByClass"]ents.FindByClass[/URL] on map initialization and remove them.
[editline]3rd August 2014[/editline]
[code]if ( game.GetMap() == "map_whatever" ) then
for k, v in pairs( ents.FindByClass( "weapon_whatever" ) ) do
v:Remove()
end
end
[/code]
[QUOTE=code_gs;45586209]You could use [URL="http://wiki.garrysmod.com/page/ents/FindByClass"]ents.FindByClass[/URL] on map initialization and remove them.
[editline]3rd August 2014[/editline]
[code]if ( game.GetMap() == "map_whatever" ) then
for k, v in pairs( ents.FindByClass( "weapon_whatever" ) ) do
v:Remove()
end
end
[/code][/QUOTE]
Supports wildcard. So I'm guessing I can put "weapon_*" ?
Save as .lua in where? Autorun? Because I saved it there, started up the map, and everything was still there.
[code]if ( game.GetMap() == "dm_chiron" ) then
for k, v in pairs( ents.FindByClass( "weapon_357" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_alyxgun" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_annabelle" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_ar2" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_brickbat" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_bugbait" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_crossbow" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_crowbar" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_frag" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_physcannon" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_pistol" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_rpg" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_shotgun" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_smg1" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_striderbuster" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_stunstick" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_slam" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_357" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_357_large" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_ar2" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_ar2_altfire" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_ar2_large" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_crate" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_crossbow" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_pistol" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_pistol_large" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_smg1" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_smg1_grenade" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_smg1_large" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_battery" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_box_buckshot" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_healthcharger" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_healthkit" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_healthvial" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_rpg_round" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_suitcharger" ) ) do
v:Remove()
end
end[/code]
Yeah, so now /cnpc works but /spawncnpc does nothing still.
And I have the group "superadmin" on the server.
Can you make a drive by mod that allows people to use weapons in vehicles? Excluding physgun of course or just have a configurable table what weapons you can use.
[QUOTE=nickster50;45586715]Can you make a drive by mod that allows people to use weapons in vehicles? Excluding physgun of course or just have a configurable table what weapons you can use.[/QUOTE]
[url]http://wiki.garrysmod.com/page/Player/SetAllowWeaponsInVehicle[/url]
Literally just a single function.
[QUOTE=Blade_;45586677]Yeah, so now /cnpc works but /spawncnpc does nothing still.
And I have the group "superadmin" on the server.[/QUOTE]
it uses the exact same check for both.
[editline]4th August 2014[/editline]
[QUOTE=nzkfc;45584659]Thanks for your help it's amazing!
Wondering if there was a way you could make a DarkRP tool or command to set a location where a random weapon will spawn.
The gamemode is DarkRP, I know TTT has a swep like this.
I have a gamemode thats using DarkRP as the base but i've edited the theme to be a Mad Max TDM type setup using various addons for leveling, managing teams.
I want to be able to set locations for weapons to spawn into the world for certain periods of time that's set by an admin.
So I left click a spot, type in the weapon name and then the time that it exists for and also the time that needs to elapse before it respawns again (or even randomize it)
That would be cool![/QUOTE]
[URL="http://www.mediafire.com/download/ut44wz8dk7ssg23/permanentWeapons.zip"][Direct][/URL] [URL="http://steamcommunity.com/sharedfiles/filedetails/?id=295716129"][Workshop][/URL]
[QUOTE=AnonTakesOver;45586751]it uses the exact same check for both.[/QUOTE]
It's probably because your admin check has the or operators (||) where you should've used and (&&).
Since with your current check, the user needs to be all ranks at once.
[QUOTE=ms333;45587084]It's probably because your admin check has the || where you should've used &&.
Since with your current check, the user needs to be all ranks at once.[/QUOTE]
I used || so you can be anything of those, this is the check (Too lazy to make a table)
[code]
if ply:IsUserGroup("admin") || ply:IsUserGroup("superadmin") || ply:IsUserGroup("moderator") || ply:IsUserGroup("owner") || ply:IsAdmin() then
[/code]
So if the player is any one of those groups it'll work.
Yes, if you perform the entity spawning in the if statement, it should work.
[QUOTE=ms333;45587100]Yes, if you perform the entity spawning in the if statement, it should work.[/QUOTE]
But that's my current check, what were you saying? If I change it to && then it would be checking if the player is all the groups?
That's what my check has been the whole time.
[QUOTE=AnonTakesOver;45587107]But that's my current check, what were you saying? If I change it to && then it would be checking if the player is all the groups?
That's what my check has been the whole time.[/QUOTE]
Well the version I just download (direct) has this check in the PlayerSay hook:
[lua]
if !ply:IsUserGroup("admin") || !ply:IsUserGroup("superadmin") || !ply:IsUserGroup("moderator") || !ply:IsUserGroup("owner") || !ply:IsAdmin() then return "" end
[/lua]
[editline]4th August 2014[/editline]
Where I suggested you change it to && operators.
[QUOTE=ms333;45587113]Well the version I just download (direct) has this check in the PlayerSay hook:
[lua]
if !ply:IsUserGroup("admin") || !ply:IsUserGroup("superadmin") || !ply:IsUserGroup("moderator") || !ply:IsUserGroup("owner") || !ply:IsAdmin() then return "" end
[/lua]
[editline]4th August 2014[/editline]
Where I suggested you change it to && operators.[/QUOTE]
Oh shit, forgot to update direct, sorry, my fault.
I fixed this as soon as I re-read it yesterday, but only updated workshop :v:.
[editline]4th August 2014[/editline]
Fixed, thanks for the heads up.
[editline]4th August 2014[/editline]
[QUOTE=Vipes;45586545]Supports wildcard. So I'm guessing I can put "weapon_*" ?
Save as .lua in where? Autorun? Because I saved it there, started up the map, and everything was still there.
[code]if ( game.GetMap() == "dm_chiron" ) then
for k, v in pairs( ents.FindByClass( "weapon_357" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_alyxgun" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_annabelle" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_ar2" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_brickbat" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_bugbait" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_crossbow" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_crowbar" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_frag" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_physcannon" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_pistol" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_rpg" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_shotgun" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_smg1" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_striderbuster" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_stunstick" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "weapon_slam" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_357" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_357_large" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_ar2" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_ar2_altfire" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_ar2_large" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_crate" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_crossbow" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_pistol" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_pistol_large" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_smg1" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_smg1_grenade" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_ammo_smg1_large" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_battery" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_box_buckshot" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_healthcharger" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_healthkit" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_healthvial" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_rpg_round" ) ) do
v:Remove()
end
for k, v in pairs( ents.FindByClass( "item_suitcharger" ) ) do
v:Remove()
end
end[/code][/QUOTE]
Oh my god, there is a better way of doing that, I'm sure it supports wildcards.
Wrap it in a this [URL="http://wiki.garrysmod.com/page/GM/InitPostEntity"]hook[/URL]
Just loop through all entities and check if it the class matches a table.
Like this:
[lua]
local deleteList = {
['item_ammo_smg1'] = true,
['item_battery'] = true
// and so on
}
hook.Add('InitPostEntity', 'DeleteWeirdStuff', function()
local deletedents = 0
for k, v in pairs(ents.GetAll()) do
if deleteList[v:GetClass()] then
deletedents = deletedents + 1
v:Remove()
end
end
MsgC(Color(255,0,0), 'Deleted '..deletedents..' map entities\n')
end)
[/lua]
Also, everything I have done so far is pretty much new to me, I have never done STOOLS before.
Make sure to tell me if there are errors.
Using the OnEntityCreated hook will be much better. If you want to remove spawned weapons, just do:
[lua]
local myMap = 'your_map'
hook.Add('OnEntityCreated','radnom name',function(ent)
if game.GetMap() != myMap or !IsValid(ent) or !string.find(ent:GetClass(),'weapon_') or IsValid(ent.Owner) then return end
//don't do anything if the entity is not valid or is not a weapon or has an owner (carried by a player)
ent:Remove()
end
[/lua]
Serverside.
Your addons pictures are awesome :D And this is really nice of you!
May you try to fix this tool? [url]http://steamcommunity.com/sharedfiles/filedetails/?id=106609141[/url]
Someone tried to port it over GM 13 but it didn't fixed the code (All options are broken, it spams a shitload of errors).
Still don't know why I can't get the DM script working.
Got it working somewhat now. It locks out Q and C, but players still spawn with every weapon.
[QUOTE=Vipes;45591818]Still don't know why I can't get the DM script working.
Got it working somewhat now. It locks out Q and C, but players still spawn with every weapon.[/QUOTE]
What does it do?
[editline]4th August 2014[/editline]
[QUOTE=Icejjfish;45590233]Your addons pictures are awesome :D And this is really nice of you![/QUOTE]
Haha I thought they were shitty :v: I guess not then.
[editline]4th August 2014[/editline]
[QUOTE=Vipes;45591818]Still don't know why I can't get the DM script working.
Got it working somewhat now. It locks out Q and C, but players still spawn with every weapon.[/QUOTE]
Fixed :)
Redownload.
[editline]4th August 2014[/editline]
I appreciate all the positive feedback guys <3
Works like a charm now. Now small question, I changed the crowbar to another weapon, but how do I make it spawn with more than one?
[code]local weapons = { "hr_swep_assault_rifle", "halo_swep_magnum_2", } [/code]
It'll spawn with the Assault Rifle, but not the Magnum.
Would you be willing to make a script that can kick people if they don't have a certain amount of hours? With the ability to set the amount of hours of course.
[editline]<3[/editline]
Thank you so much
[QUOTE=IAOEGIJaKe;45595140]Would you be willing to make a script that can kick people if they don't have a certain amount of hours? With the ability to set the amount of hours of course.[/QUOTE]
Once I get home (2 hours)
Sure :)
Sorry, you need to Log In to post a reply to this thread.