ID:268020
 
I Came up with the idea to make a mob play a certian song a user wants, i want to make it so they cant play wavs or big files to lag the game

could anyone tell me how to do this or point me in the right direction? Thank you.
Nope. You can't check file sizes. Of course, in reality, this thing doesn't add anything to the game, and is a great tool for being annoying, so why even bother?
In response to Garthor
oh.
In response to Vash_616
Read my post, I edited it.
If you're going to be making a game and playing it with an untrustable crowd, its best to leave uploading of files out totally. There are always people who just want to ruin the game, and allowing them to upload files provides an easy means of doing that.

BYOND doesn't have any way to check filesizes that I'm aware of.
In response to Garthor
well if i cant block off a certian size is there a way to make it so they cant play a certian file such as .wav's?
In response to Vash_616
You can use findtext() to check if .mid is found in the filename. But a malicious player will just change the name of a large .wav and play it anyway.
In response to Garthor
Actually, I believe length(file) would bring its size. =P
In response to Goku72
It does! It didn't used to...
In response to Foomer
[deleted]
In response to Foomer
However, I can't think of any way for a player to check the size of a file without uploading it first :P
In response to Foomer
Foomer wrote:
However, I can't think of any way for a player to check the size of a file without uploading it first :P

well then can you help me with the code i posted above? :)
In response to Vash_616
Vash_616 wrote:
>       if(findtext("[S].mid"))


Ok, what is the first thing you do when the compiler says there's an error? Especially when it tells you exactly what's wrong?

Right, you press F1 to go to the built in help file.
There we will find that findtext does indeed take two to four arguments. The required two are the text to search, and the text to search for.
In other words, findtext looks for text_to_find in text_to_search.
Let's look at an example using those variable names:

findtext(text_to_search,text_to_find)


Seem a bit clearer now? You'll want to use
findtext("[S]",".mid")


However, even then I don't think it will work. S as sound is calling for a file object, not a text value.

Try using file(), a text variable for a file name, and the sound() proc.

Also, as a side note, you'll want to close all those open HTML tags in the text, and possible keep your capital letters restricted to the beginning of a sentence and proper nouns.
In response to sapphiremagus
its clear and its now working thank you so much sapphiremagus. but one last thing
            for(var/mob/M in world)
M.musicplaying=1

i want all the players in the worlds vars to change and that code isnt doing it,any ideas why?
In response to Vash_616
Vash_616 wrote:
its clear and its now working thank you so much sapphiremagus. but one last thing
>           for(var/mob/M in world)
> M.musicplaying=1

i want all the players in the worlds vars to change and that code isnt doing it,any ideas why?

run time errors or what?
In response to Dark-Kaka
not an error or anything its just the var wont change please help if you can
In response to Vash_616
Vash_616 wrote:
not an error or anything its just the var wont change please help if you can

no clue lol sorry.
In response to Dark-Kaka
I rememeber when you posted your code (which I can't see for some reason??), just below that for loop you had another one which made it set back to 0 so it would be 1 for about... 0.001 seconds or so.So that means that it wouldn't change, that's your problem.
In response to Wanabe
Wanabe wrote:
I rememeber when you posted your code (which I can't see for some reason??), just below that for loop you had another one which made it set back to 0 so it would be 1 for about... 0.001 seconds or so.So that means that it wouldn't change, that's your problem.
                M.musicplaying=1
sleep(3000)
for(var/mob/M in world)
M.musicplaying=0


i dont believe thats 0.001 seconds =/
In response to Vash_616
It could be, because you didn't show us enough to be sure.
Page: 1 2