What hook can be called upon the player's next spawn? Or can I do this with a variable in GM:PlayerS
7 replies, posted
Just so you know, I'm trying to get my gamemode to set the player's weapons on their next spawn based on what they had before they died. How would I do this?
GM:PlayerSpawn() is called for every time a player is spawned, so it's what you are looking for.
[QUOTE=Robotboy655;47704485]GM:PlayerSpawn() is called for every time a player is spawned, so it's what you are looking for.[/QUOTE]
My gamemode involves classes(Not made with the built in class system, just made with a simple derma menu) where each player is assigned different weapons. Using GM:PlayerSpawn would be good if every player got the same weapons, but since each player has different weapons depending on their class, I need to find a way to save their currents weapons and give those weapons to them on their next spawn.
So, what's the problem? Just do it.
[QUOTE=Robotboy655;47704646]So, what's the problem? Just do it.[/QUOTE]
Well, thing is, I don't know how I could save their weapons and give them what I saved...
once they die save their weapons, then on playerspawn give them their weapons back?
[QUOTE=Invule;47704815]once they die save their weapons, then on playerspawn give them their weapons back?[/QUOTE]
I want to know how to do that. Nvm though, I decided to use Gmod's built in class system for my gamemode, and I'll just use Player:GetClassID().
Create a table.
When a player dies insert their weapons into the 'table' by using, table.insert( table, vic:GetWeapons() ) while using this hook: [url]http://wiki.garrysmod.com/page/GM/PlayerDeath[/url]
Then when a player spawns iterate through said table and give him the weapons that he died with. Thats how I think its done. Shouldn't be too hard imo, let me know how it goes.
Sorry, you need to Log In to post a reply to this thread.