Little question before creating a server

Hi all :wink:
I have created this thread in Server Hosting forum, but it isn’t the good forum to ask my question, so I repost here.

I have a little question:

I want to create a server and I would know if it’s possible to create a system for, when a player come, he can select a model, and every model corresponds to a team. And when a man select a model, his team name is add to his name (for exemple: Rob85Fr).

I have create a little exemple with Paint: http://www.noelshack.com/up/aac/exempleserveur1518-3ffa354134.bmp
Noelistes, Hapistes, Wesh, Kikoo and Pedobear are team name.

I dont want to create a new gamemode, I want to stay in SandBox gamemode.

Thanks, and sorry for my bad english i’m french :slight_smile:

Please nobody can help me? :frowning:

Well that might not help but yes, it is indeed possible. :wink:

You will obviously need a menu for choosing, and then hook to InitPostEntity to have it autorun.

You will also need a PlayerSpawn hook to enforce the model selection.

I can’t really do much to help right now but here’s the gamemode hook you would use to put a tag in front of what your users type : http://wiki.garrysmod.com/?title=Gamemode.PlayerSay

Bonne chance. :smile:

Ok thanks you very much! :wink:

So it’s possible to do that, with not recreate a gamemode? Nice! Thanks :wink:

I have a problem.

I have created a gamemode to test my scripts (because I don’t know how to put a Lua script in addons folder and load it in Sandbox gamemode, please If you can tell me how to :wink: )

So, in my gamemode folder, there are 2 files: cl_init.lua and init.lua

I will show you the scripts I created:

cl_init.lua:

local Frame = vgui.Create( “DFrame” )
Frame:SetPos( 50, 50 )
Frame:SetSize( 200, 200 )
Frame:SetVisible( true )
Frame:SetTitle ( “Choose your team” )
Frame:SetDraggable( true )
Frame:ShowCloseButton ( true )
Frame:MakePopup()

local Icon = vgui.Create( “SpawnIcon”, Frame)
Icon:SetPos( 30, 30 )
Icon:SetModel( “models/Player/Group01/male_01.mdl” )

function GM:PlayerSpawn(ply)
self.BaseClass:PlayerSpawn(ply)
ply:SetModel(“models/Player/Group01/male_01.mdl”)
end

Now, Init.lua:

AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )

include( ‘shared.lua’ )

function GM:PlayerInitialSpawn(ply)
self.BaseClass:PlayerInitialSpawn(ply) – don’t know if you need baseclass here but it couldn’t hurt
umsg.Start(“call_vgui”, ply)
umsg.End()
end

–And to set a player’s model:

function GM:PlayerSpawn(ply)
self.BaseClass:PlayerSpawn(ply)
ply:SetModel(“models/player/Kleiner.mdl”) --Model you want when you spawn.
end

/---------------------------------------------------------
Name: gamemode:PlayerLoadout( )
Desc: Give the player the default spawning weapons/ammo
---------------------------------------------------------
/
function GM:PlayerLoadout( pl )

pl:GiveAmmo( 27,	"Pistol", 		true )

pl:Give( "cse_glock" )

end

As you can see I have take a tutoriel to do the Init.lua.

So, When I start the game, a window appear:

But when I click on the picture of the man, nothing happend. I have tried to kill myself, and my model was always Kleiner.

And I have tried to put the Gamemode.PlayerSay, but it’s don’t work. If you can tell me how to do that too please :wink:

Thanks :wink:

Please :frowning:

Put files in the garrysmod/garrysmod/lua folder.

If you want them to autorun, make a folder called autorun (if it doesn’t exist), and inside that, ‘client’ and ‘server’.