Dont tell me there is a ulx command to do it because im looking for a way to do it in lua.
With [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/surface/PlaySound]surface.PlaySound[/url] and the [URL="http://wiki.garrysmod.com/page/Category:net"]net library[/URL]
[lua]
for _,v in ipairs(player.GetAll()) do -- loop through all player entities
v:SendLua("surface.PlaySound('Pistol.Reload')") -- Send lua to players
end -- end the loop
[/lua]
I would recommend however using the net library, but this is the easy method to get this done.
[QUOTE=mcNuggets1;52273757][lua]
for _, v in ipairs(player.GetAll()) do -- loop through all player entities
v:SendLua( [[surface.PlaySound("weapons/pistol_reload.wav")]] ) -- Send lua to players
end -- end the loop
[/lua][/QUOTE]
If you're gonna advise SendLua (Which you never should really), at least use brackets for the string, not quotation marks
[QUOTE=JasonMan34;52273762]If you're gonna advise SendLua (Which you never should really), at least use brackets for the string, not quotation marks[/QUOTE]
For such a simple thing, it isn't wrong to use SendLua here.
[QUOTE=mcNuggets1;52273772]For such a simple thing, it isn't wrong to use SendLua here.[/QUOTE]
It's never better to use SendLua, even for simple things, so why do it?
Sorry, you need to Log In to post a reply to this thread.