• limiting weapon pickups (1 primary, 1 secondary)
    10 replies, posted
i renamed all of my sweps that i use in my server to css's sweps to make them spawnable my the map and not missing anyways if u care heres the code how i renamed them [CODE]AddCSLuaFile( "weapon_placer.lua" ) _G.weapons_OnLoaded = _G.weapons_OnLoaded or weapons.OnLoaded function weapons.OnLoaded(...) local overrides = { weapon_deagle= "tfa_csgo_deagle", weapon_hegrenade= "tfa_csgo_frag", weapon_flashbang= "tfa_csgo_flash", weapon_smokegrenade= "tfa_csgo_smoke", weapon_scout= "tfa_csgo_ssg08", weapon_awp= "tfa_csgo_awp", weapon_g3sg1= "tfa_csgo_g3sg1", weapon_sg550= "tfa_csgo_scar20", weapon_elite= "tfa_csgo_elite", weapon_mp5navy= "tfa_csgo_mp5", weapon_galil= "tfa_csgo_galil", weapon_ak47= "tfa_csgo_ak47", weapon_m4a1= "tfa_csgo_m4a1", weapon_tmp= "tfa_csgo_mp9", weapon_p90= "tfa_csgo_p90", weapon_m249= "tfa_csgo_m249", weapon_p228= "tfa_csgo_p250", weapon_m3= "tfa_csgo_nova", weapon_xm1014= "tfa_csgo_xm1014", weapon_famas= "tfa_csgo_famas", weapon_aug= "tfa_csgo_aug", weapon_usp= "tfa_csgo_usp", weapon_sg552= "tfa_csgo_sg556", weapon_mac10= "tfa_csgo_mac10", weapon_glock= "tfa_csgo_glock18", weapon_fiveseven= "tfa_csgo_fiveseven", weapon_knife= "csgo_default_golden", } for old, new in pairs(overrides) do local newt = weapons.GetStored(new) local oldt = table.Copy(newt) if SERVER then print("Fixed - Replacing "..old.." with "..new) end oldt.AutoSpawnable = true, weapons.Register(oldt, old) newt.AutoSpawnable = false, weapons.Register(newt, new) end return _G.weapons_OnLoaded(...) end --tfa_csgo_bizon --tfa_csgo_frag --tfa_csgo_m4a4 --tfa_csgo_mag7 --tfa_csgo_mp7 --tfa_csgo_negev --tfa_csgo_sawedoff --tfa_csgo_cz75 --tfa_csgo_p2000 --tfa_csgo_revolver --tfa_csgo_tec9[/CODE] the code is working better than great, but it broke something else for me that i have no idea on how to fix it, i tried to fix it by my self and guess what?.. :hammered: so one of the most important things on my server is to limit the primary and secondary weapons to 1 each category including the knives and grenades so heres the code i was using to limit them (which was working perfect) [CODE]i lost the code cuze i wasnt using it anymore :(, anyways i tried to use all the codes/addons u can find online and none of them was working for me cuze i get somekinda conflict with the renamed sweps. it couldnt find the name of the swep(i have no clue why, i tried to use the old name with the new or just the old or new names) but it didint work[/CODE]
bumo
You have to make your own weapon menu(wich pops up when pressing 1-9), and check for the categories etc.
[QUOTE=whitestar;50801350]You have to make your own weapon menu(wich pops up when pressing 1-9), and check for the categories etc.[/QUOTE] you know anykind of menu i can use to start with?
ehhh as far as I know, theres no "public" menu here.
[QUOTE=whitestar;50801512]ehhh as far as I know, theres no "public" menu here.[/QUOTE] thanks. whats the point of Sir TE5T? he makes everything as dump all the time
Sir Te5t? I dont know what/who you mean.
[QUOTE=whitestar;50804076]Sir Te5t? I dont know what/who you mean.[/QUOTE] he was puting dumb ratings in all of his posts
[QUOTE=whitestar;50801350]You have to make your own weapon menu(wich pops up when pressing 1-9), and check for the categories etc.[/QUOTE] You don't have to do that, to accomplish the same thing i made tables with weapon class names i defined 1 table has primary and another as secondary. Before picking up a weapon i would check the type of weapon im picking up along with the weapons that I currently have. If I had a weapon that was in the same table, i would return false in the weapon pickup function.
Like dannyf127 said you can check PlayerCanPickupWeapon if a player already has a primary or secondary weapon. You can work with this function: [url]http://wiki.garrysmod.com/page/GM/PlayerCanPickupWeapon[/url] If you want I or maybe someone else can post a example.
[QUOTE=dannyf127;50804692]You don't have to do that, to accomplish the same thing i made tables with weapon class names i defined 1 table has primary and another as secondary. Before picking up a weapon i would check the type of weapon im picking up along with the weapons that I currently have. If I had a weapon that was in the same table, i would return false in the weapon pickup function.[/QUOTE] i know, i already tried to do it but it wont work cuze i renamed my sweps. it wont find the swep for some reason i will try to rip the code from a jailbreak gamemode or something like that
Sorry, you need to Log In to post a reply to this thread.