Hook it to this: Player.SetTeam - GMod Wiki ?
EDIT: Also this will be useful for team naming etc. http://wiki.garrysmod.com/wiki/?title=Team
So I'm new to lua. In order to learn it, I wanted to try something kind of simple and work from there. I'm making a rather simple gamemode, just a team based sandbox. Everything I've found for teams involves the gamemode automatically choosing a random team for a player when they start. However, I want people to be able to choose their team, and then be able to choose again anytime in the future. I've manged to set up a simple derma, with 3 buttons, each relating to a team. How would I translate the click of a button to choosing a team?
<Anticept>Will sex for food.
<Beer>peanus, I like that
<nath2008uk>I must play with black peanus
<Jat Goodwin>i like the underage one
<Black Phoenix>He's a good pedo
Hook it to this: Player.SetTeam - GMod Wiki ?
EDIT: Also this will be useful for team naming etc. http://wiki.garrysmod.com/wiki/?title=Team
Against stupidity the Gods themselves contend in vain.
-Friedrich Schiller
The flame puts me in the mood to "Do it!".
-Dart, Legend of Dragoon
So I would have
?Code:function ChooseRed ( ) Player.SetTeam(1) end DermaButton.DoClick = hook.Add( "DoClick", ChooseRed )
I'm not so sure of hooks yet...
<Anticept>Will sex for food.
<Beer>peanus, I like that
<nath2008uk>I must play with black peanus
<Jat Goodwin>i like the underage one
<Black Phoenix>He's a good pedo
Making a gamemode is one of the most advanced things you could do in GMod Lua, I suggest learning the language itself before making a gamemode.
Mainly because as I can see from your code above, you are just throwing things together.
Alright then.
What would you suggest I try to help me learn it?
<Anticept>Will sex for food.
<Beer>peanus, I like that
<nath2008uk>I must play with black peanus
<Jat Goodwin>i like the underage one
<Black Phoenix>He's a good pedo
What we need is a team combat sandnox gamemode where there are buildtimes , proplimits and combat times.
While I do try to suggest that people start with something they want to make it can be beneficial to do something before a gamemode. Try making some SENTs or SWEPs if you have any ideas for them.
I'm actually also helping (or trying my best at least) to help turck3 learn lua:
Learning Lua
Some of the info there might prove useful to you.
I'd help you with the gamemode but I've never made dermas or gamemodes yet. What did you have in mind? Team sandbox implies people building on a team, but to make what? Is it competitive? Point allocation?
Against stupidity the Gods themselves contend in vain.
-Friedrich Schiller
The flame puts me in the mood to "Do it!".
-Dart, Legend of Dragoon
What I wanted to do was three teams, Red, Blue, and Neutral (Grey).
Red and Blue are against each other, while Grey is with and against both.
Disable weapon/entity spawning for Red and Blue, and make a system where they order through Grey. I dunno if you've messed with the SBEP, but it would basically be the SEnts from there (ships, weapons, turret mounts, etc.).
You get money from killing the other team, lose money for killing Grey.
In the long run, it's turn into a RP-type game, but I wanted to just try and get bits and pieces done and memorized to make it easier in the end.
<Anticept>Will sex for food.
<Beer>peanus, I like that
<nath2008uk>I must play with black peanus
<Jat Goodwin>i like the underage one
<Black Phoenix>He's a good pedo
Bookmarks