Help with a LUA Code!

I have a server, with SGRP, but I’ve managed to break the gamemode (I added 3 more new jobs), the server console says there is a error in sv_player.lua, with this code:


function GM:PlayerLoadout(ply)
	if (ply:GetTable().Arrested) then return 
	
	local team == ply:Team()

	ply:Give("keys")
	ply:Give("weapon_physcannon")
	ply:Give("gmod_camera")


Any help would be great, Thanks!


(User was banned for this post ("Undescriptive thread title; wrong forum" - mahalis))

When i was making a gamemode, i made it ply:Give( “weapon_ar2” ) for instance, with spaces. Try that.

Don’t be so dumb.

[editline]06:54PM[/editline]

Don’t return. Returning “leaps” to the end of the function. Only return if you want to do that (Or make the function equal to a value)

What? He can return what he wants here… he misses an end After the return thats all. And a end to close the function…

He also have == ( is equal to ) where he is only supposed to use one =.

it’s not that, it’s the “local”
This is the Error from my server



StargateRP\gamemode\sv_player.lua:527: unexpected symbol near 'local'


it’s something to do with “local team == ply:Team( )”

And that sentence is sentence number 527 in Notepad++

Read my message.

I tryed with one, still failed, but I try again if you want to :slight_smile:

Edit:
Nope, sorry, still failed.

Try everything we said. There is a lot wrong with your code.



function GM:PlayerLoadout(ply)
	if (ply:GetTable().Arrested) then return end
	
	local team == ply:Team()

	ply:Give("keys")
	ply:Give("weapon_physcannon")
	ply:Give("gmod_camera")
end


Thanks, I’ve made the code like this:



function GM:PlayerLoadout(ply)
	if (ply:GetTable().Arrested) then return end
	
	local team = ply:Team()

	ply:Give("keys")
	ply:Give("weapon_physcannon")
	ply:Give("gmod_camera")


And then server now gives me this Error:



StargateRP\gamemode\sv_player.lua:756: 'end' expected (to close 'function' at line 524) near '<eof>'


No idea what ‘<eof>’ means, and at line 756, that’s the last line, and there is a “end” there…

And thanks for the help so far, just a little more, and this great gamemode will work again :stuck_out_tongue:

EOF is “End of file”

This means you didn’t end the function.

with 2 “==”? I is that the problem? Capsu said it had to be one “=”

Edit:
Ok, I’ve tryed with “==”, now the console said



StargateRP\gamemode\sv_player.lua:527: unexpected symbol near '=='


He was talking shit (The poster of the code you are using). Use “=” for making something equal to something, and “==” for comparing two variables - are they equivalent to each other?

So EOF is End of File? But it has a end.

and Rute, I can’t have a end after “ply:Give (“gmod_camera”)”, it’s more after that, but that has nothing to do with it, that I’m sure of…

Perhaps you need another end?

But then the other in Playerloadout won’t work?

[editline]06:50PM[/editline]

if I set it up like this, does that change anything, or won’t it be any diffrence?



function GM:PlayerLoadout(ply)
	if (ply:GetTable().Arrested) then return end
	
	local team = ply:Team()
		ply:Give("keys")
		ply:Give("weapon_physcannon")
		ply:Give("gmod_camera")
	end


There are more under here… But that shouldn’t be the problem, that wasn’t the problem before atleast.

You can’t have multiple GM:PlayerLoadout functions. Use if statements instead.

WHAT? End of Function*

it worked, but now I have some other problems… lol
Server console:


 StargateRP\gamemode\sv_player.lua:533: attempt to index global 'CfgVars' (a nil value)


and line 533 in sv_player.lua is


 if (CfgVars["toolgun"] == 1 or Admins[ply:SteamID()] or Tool[ply:SteamID()]) then 

and the rest for that line is


 	local team = ply:Team()
		ply:Give("keys")
		ply:Give("weapon_physcannon")
		ply:Give("gmod_camera")
	end

	if (CfgVars["toolgun"] == 1 or Admins[ply:SteamID()] or Tool[ply:SteamID()]) then
		ply:Give("gmod_tool")
	end

	if (CfgVars["physgun"] == 1 or Admins[ply:SteamID()] or Phys[ply:SteamID()]) then
		ply:Give("weapon_physgun")
	end

Plase some more help? :smiley: