This is the code im putting in my init.lua file
[CODE]function GM:PlayerInitialSpawn( pl )
pl:SetGravity( 1 )
pl:SetWalkSpeed ( 250 )
pl:SetRunSpeed ( 500 )
end
function GM:PlayerSpawn ( pl )
pl:Give( "weapon_crowbar" )
end[/CODE]
When I go on Gmod, select the gamemode folder and load it up, I dont spawn with a crowbar, just normal things like Phys gun.
Any Idea why?
-didn't read-
Did you make a PlayerLoadout function too?
Right off the top of my head, you need a player loadout function, like chessnut says.
you want the player to have just the crowbar?
[lua]
function GM:PlayerLoadout( ply )
ply:StripWeapons() -- this takes everything away, like a clean slate
ply:Give(your weapon)
ply:SelectWeapon(the weapon you want the player to start using)
ply:GiveAmmo(3, "(ammo type here)", true)
end[/lua]
I don't know about others, but i use playerspawn to set run speed, walk speed, health and armor, and other cool things like setting custom locations throughout the map. Loadout is for distributing weapons.
Did you change your gamemode from sandbox to your gamemode and also post shared.lua please!
[QUOTE=me-name-bob;37869239]Right off the top of my head, you need a player loadout function, like chessnut says.
you want the player to have just the crowbar?
[lua]
function GM:PlayerLoadout( ply )
ply:StripWeapons() -- this takes everything away, like a clean slate
ply:Give(your weapon)
ply:SelectWeapon(the weapon you want the player to start using)
ply:GiveAmmo(3, "(ammo type here)", true)
end[/lua]
I don't know about others, but i use playerspawn to set run speed, walk speed, health and armor, and other cool things like setting custom locations throughout the map. Loadout is for distributing weapons.[/QUOTE]
Thats still not spawning me with the crowbar. I think the issue is somehow its not recognising the gamemode files at all, (I can still select to play on my gamemode) but it doesnt even recognise the player running and walking speed changed.
Ive got the gamemode file inside "Garry's Mod > Gamemodes" folder
You should probably open your console and check for errors then. Gamemodes revert to bare minimums when something is wrong.
As an aside -- PlayerLoadout is just called by PlayerSpawn, ain't it?
Blobtastic did you somewhere else the same function? I know from me, if I had 2 times same function.. th eone didn't take effect.
I just worked out the issue. My gamemode folder name wasnt one word, and its only works if it is. The coding was fine, thats all it was.
For.Fuck.Sake.
Well, thats one mistake you won't make again.
Sorry, you need to Log In to post a reply to this thread.