• How to make a server-side script.
    7 replies, posted
I have a script, but I don't know where to put it. Where's the location of server-side scripts within the Garry's Mod folders?
lua/autorun/server
Just tried it, it doesn't work. Is there a specific name I'm supposed to give it?
Show us your code.
[code] local RLSound = CreateConVar( "ReloadingSounds", 1, { FCVAR_REPLICATED, FCVAR_ARCHIVE, FCVAR_NOTIFY } ) local RLDelay = CreateConVar( "ReloadingDelay", 5, { FCVAR_REPLICATED, FCVAR_ARCHIVE, FCVAR_NOTIFY } ) local JUSTLIKEMW2 = CreateConVar( "ITSJUSTLIKEMW2", 0, { FCVAR_REPLICATED, FCVAR_ARCHIVE, FCVAR_NOTIFY } ) function _R.Player:CanSayReload(WEPON) if JUSTLIKEMW2:GetBool() then return true end if not RLSound:GetBool() then return false end if IsValid(WEPON) and WEPON.CanReload and not WEPON:CanReload() then return false end if IsValid(WEPON) and WEPON.Primary and WEPON:Clip1() >= WEPON.Primary.ClipSize then return false end if IsValid(WEPON) and (WEPON:GetPrimaryAmmoType() <= -1 or (WEPON.Primary and WEPON.Primary.ClipSize <= -1)) then return false end if self.RLSpam and CurTime() <= self.RLSpam then return false end return true end local ReloadSND = { "weapons/reload/us/reload-1.wav", "weapons/reload/us/reload-2.wav", "weapons/reload/us/reload-3.wav", "weapons/reload/us/reload-4.wav", "weapons/reload/us/reload-5.wav", "weapons/reload/us/reload-6.wav", "weapons/reload/us/reload-7.wav", "weapons/reload/us/reload-8.wav", "weapons/reload/us/reload-9.wav", "weapons/reload/us/reload-10.wav", "weapons/reload/us/reload-11.wav", "weapons/reload/us/reload-12.wav", "weapons/reload/us/reload-13.wav", "weapons/reload/us/reload-14.wav", "weapons/reload/us/reload-15.wav", "weapons/reload/us/reload-16.wav", "weapons/reload/us/reload-17.wav", "weapons/reload/british/reload-1.wav", "weapons/reload/british/reload-2.wav", "weapons/reload/british/reload-3.wav", "weapons/reload/british/reload-4.wav", "weapons/reload/british/reload-5.wav", "weapons/reload/british/reload-6.wav"} function ImReloading(ply,key) if key == IN_RELOAD then local WEPON = ply:GetActiveWeapon() if ply:CanSayReload(WEPON) then ply.RLSpam = CurTime() + RLDelay:GetFloat() ply:EmitSound(table.Random(ReloadSND),75,math.random(96,104)) end end end hook.Add("KeyPress","Imatelltheworldimreloading",ImReloading) [/code]
So is there no errors?
No errors, it just doesn't emit the sounds.
Try running the file using the [B]lua_openscript[/B] console command report back any errors.
Sorry, you need to Log In to post a reply to this thread.