Custom Gamemode player.lua error.

Im getting this error in console RIGHT when i join the server.

[LUA][ERROR] gamemodes/seriousrp/gamemode/player.lua:6: bad key to string index (numb
er expected, got string)

  1. error - [C]:-1
  2. __index - lua/includes/extensions/string.lua:274
    3. unknown - gamemodes/seriousrp/gamemode/player.lua:6[/LUA]

My player.lua looks like this:


--> Defining strings (MONEY_STARTAMOUNT, etc.)
MONEY_STARTAMOUNT = 5000

--> Player connecting
function GM:PlayerConnect ( ply, ip )
	PrintMessage( HUD_PRINTTALK, ply:Nick().. " has joined the game.")
	-- Print to chat the player connected
end

--> Player disconnecting
function GM:PlayerDisconnected ( ply )
	-- Print to chat the player disconnected
	PrintMessage( HUD_PRINTTALK, ply:Nick().. " has left the game.")
	print("Money saved.")
	ply:SaveMoney()
	ply:SaveMoneyTXT()

end


--> Players first spawn
function GM:PlayerInitialSpawn( ply )
	--> Stripping players and giving them the default job (Citizen)

	ply:StripWeapons()
	ply:SetTeam( 1 )


	--> Giving players starting money, giving players their money.

	local cash = ply:GetPData("money") -- Get the saved money amount

	if cash == nil then -- If a player never joined the server or doesn't have any money.
		ply:SetPData("money", MONEY_STARTAMOUNT) -- Save the starting money to the players account.
		ply:SetMoney( MONEY_STARTAMOUNT ) -- Set the players money to starting money-
	else
		ply:SetMoney( cash ) -- if the player has joined the server and have got saved cash, then give him the cash.
	end

end


--> Players spawn (suiciding, dieing, etc)
function GM:PlayerSpawn( ply )
	ply:StripWeapons()

		if ply:Team() == 1 then
		ply:Give( "weapon_physgun" )
		ply:Give( "weapon_physcannon" )
		elseif ply:Team() == 2 then
			ply:Give( "weapon_physgun" )
			ply:Give( "weapon_physcannon" )
			ply:Give( "weapon_fas_colt1911" )
	end
end

-snip-

What?

[editline]4th October 2014[/editline]

Anyone? :confused:

[editline]4th October 2014[/editline]

bump

Ehh, sorry but does anyone know? :frowning: I cant seem to fix this myself.

On


 PrintMessage()

try maybe


ply:PrintMessage( 3, "message" )

Pretty sure it’s a serverside function and your calling this serverside I assume?

dude wtf

The first argument to PlayerConnect is the player’s name, not the player object.