ID:148540
 
Hello everyone, hope you have all been well. I was wondering if there may be a demo out for after a certain "class" is chosen, the game would checks to see if they can be it due to the ammount of that class already in the game. I figured it just be using a list, where when a certain # of people of that class log on that class then would be taken off the list. If theres a demo out there that does this or something to do with this it would help my much thank you.

-Kalzimere
var/Warriors = list()
for(var/mob/M in world)
if(M.class == "Warrior")
if(M != src)
L += M
if(length(Warriors) < 5)
//There is not enough warriors! He/She may join.
else
src << "Sorry, there is to many warriors here."
sleep(5) //If you delete immediatly, src won't see the above message.
del(src)


Put this in your login procedure after they choose their class.

It's amazing how many people ask for help and the simple for procedure adding to a list is the answer.
In response to Kunark
THANKS KUNARK! Help me alot and i got to read some info on the length proc, so got to learn something else new. Just a note too after the src<<"sorry to many warriors" and 5 sec delay instead of deleteing the mob its easier just to have the "class select" list i have running just re run that way have chance to change their role. (just a little extra info for other people who might use this). Thanks again kunark!

peace
-Kalzimere
In response to Kalzimere
Yeah it is... Thats not the way I do it though hehe, I'm so used to just deleting the person off so they gotta log back in :P