Respected Team

Hey I’m new to Face Punch
Anyway…

I’m setting up a team for my Gamemode
but i don’t know if there is such command to find a respected player?

is it ply:IsRespected
or ply:IsAdmin

Heres my code


function team_3( ply )
if ply:IsRespected() then
ply:SetTeam( 3 )
ply:Spawn

end


and i want to have

else “say this” but i don’t know how

remember I’m just started lua 2 days ago


Thanks

By default, there is no “respected” user group or team built into Gmod. Figuring out if a player is respected depends on the addon that you’re using that sets a player to respected, such as ASSMod or ULX. Which mod are you using?

ULX but thats on my normal gmod how would i get it on my gamemod?

Edit:

how do i post my code in like {code/ bla bla bla /code} ??

use [1lua]code[/lua] without the 1

ok heres what i have

[lua]AddCSLuaFile( “cl_init.lua” ) --Tell the server that the client needs to download cl_init.lua
AddCSLuaFile( “shared.lua” ) --Tell the server that the client needs to download shared.lua

include( ‘shared.lua’ ) --Tell the server to load shared.lua

function GM:PlayerInitialSpawn( ply ) – When Player joins the server and Spawns…

ply:SetTeem ( 1 ) -- Add player to team 1 (Guest)

end

function GM:PlayerLoadout ( ply ) – Weapon/ammo/itom Function…
ply:StripWeapons()
if ply:Team() == 1 then
ply:Give ( “weapon_crowbar” )

elseif ply:Team() == 2 then
	ply:Give ( "weapon_crowbar" )
	ply:Give ( "weapon_physcannon" )
	
	elseif ply:Team() == 3 then
		ply:Give ( "weapon_crowbar" )
		ply:Give ( "weapon_physcannon" )
		ply:Give ( "weapon_physgun" )

		elseif ply:Team() == 4 then
			ply:Give ( "weapon_crowbar" )
			ply:Give ( "weapon_physcannon" )
			ply:Give ( "weapon_physgun" )
			
		end

	end
	
end

end

function team_2( ply )

ply:SetTeam( 2 )
	ply:Spawn

end

function team_3( ply )
if ply:IsAdmin() then
ply:SetTeam( 3 )
ply:Spawn
else

	Msg("You Are Not Admin!

")
end

end

function team_4( ply )
if ply:IsSuperAdmin() then
ply:SetTeam( 4 )
ply:Spawn
else
`
Msg("You Are Not SuperAdmin!
")
end

end

concommand.Add( “team_2”, team_2 )
concommand.Add( “team_3”, team_3 )
concommand.Add( “team_4”, team_4 )
[/lua]

ok this part of the code
[lua]function team_3( ply )
if ply:IsAdmin() then
ply:SetTeam( 3 )
ply:Spawn
else

	Msg("You Are Not Admin!

")
end

end
[/lua]

i need it to be respected so…
i tryed putting ULX into my gamemode folder but im having a hard time
finding where to put it

btw

i started from scratch

you misspelled at line 8, I dont think you need that many ends on GM:PlayerLoadout (you only need 2, one for the if and one to close the function) and you don’t need to put ULX into your gamemode folder, you need to find the respected function in ULX.

thanks i fixed line 8
how would i find the function in ULX
if i can’t l just leave it as admin and super admin

btw is there an owner command!


thanks

I can’t seem to find the function by looking on the website or google, I did see a space build server once that had a respected team so I’m pretty sure that you can do this.

ok i deleted all but 2 "end"s but now i get

gamemodes\blazemod\gamemode\init.lua:39: function arguments expected near ‘end’



********** COULDN’T LOAD GAMEMODE!! **********



There was a problem opening the gamemode file ‘BlazeMod/gamemode/init.lua’

[lua]AddCSLuaFile( “cl_init.lua” ) --Tell the server that the client needs to download cl_init.lua
AddCSLuaFile( “shared.lua” ) --Tell the server that the client needs to download shared.lua

include( ‘shared.lua’ ) --Tell the server to load shared.lua

function GM:PlayerInitialSpawn( ply ) – When Player joins the server and Spawns…

ply:SetTeam ( 1 ) -- Add player to team 1 (Guest)

end

function GM:PlayerLoadout ( ply ) – Weapon/ammo/itom Function…
ply:StripWeapons()
if ply:Team() == 1 then
ply:Give ( “weapon_crowbar” )

elseif ply:Team() == 2 then
	ply:Give ( "weapon_crowbar" )
	ply:Give ( "weapon_physcannon" )
	
	elseif ply:Team() == 3 then
		ply:Give ( "weapon_crowbar" )
		ply:Give ( "weapon_physcannon" )
		ply:Give ( "weapon_physgun" )

		elseif ply:Team() == 4 then
			ply:Give ( "weapon_crowbar" )
			ply:Give ( "weapon_physcannon" )
			ply:Give ( "weapon_physgun" )
			
		end

end

function team_2( ply )

ply:SetTeam( 2 )
	ply:Spawn

end

function team_3( ply )
if ply:IsAdmin() then
ply:SetTeam( 3 )
ply:Spawn
else

	Msg("You Are Not Admin!

")
end

end

function team_4( ply )
if ply:IsSuperAdmin() then
ply:SetTeam( 4 )
ply:Spawn
else

Msg("You Are Not SuperAdmin!

")
end

end

concommand.Add( “team_2”, team_2 )
concommand.Add( “team_3”, team_3 )
concommand.Add( “team_4”, team_4 )

function GM:ShowHelp( ply ) – This hook is called everytime F1 is pressed.
SendUserMessage(“set_team”, ply) – Sending a message to the client.
end
[/lua]

[editline]04:53AM[/editline]

I FIXED IT

in line 39, 44 and 55

i missed the ()
ply:Spawn()

[editline]05:02AM[/editline]

Msg("You Are Not SuperAdmin!
")

that shows up in console

it there a way to have an new window pop up and
say that?

Bump… i think
i have everything up and running just need the popup code to say
you are not admin!

heres what i have

CL_INIT.lua
[lua] include( ‘shared.lua’ )

function set_team()

local frame = vgui.Create( “DFrame” )
frame:SetPos( ScrW() / 2, ScrH() / 2 )
frame:SetSize( 300, 350 )
frame:SetTitle( “Change Team” )
frame:SetVisible( true )
frame:SetDraggable( false )
frame:ShowCloseButton( true )
frame:MakePopup()
frame.Paint = function()
draw.RoundedBox(4, 0, 0, frame:GetWide(), frame:GetTall(), Color(200,0,0,200))
draw.RoundedBox(4, 2, 2, frame:GetWide()-4, 21, Color(50,50,50,200))
end
team_2 = vgui.Create( “DButton”, frame )
team_2:SetPos( 30, 30 )
team_2:SetSize( 60, 50 )
team_2:SetText( “Player” )
team_2.DoClick = function()
RunConsoleCommand( “team_2” )
end

team_3 = vgui.Create( “DButton”, frame )
team_3:SetPos( 30, 135 )
team_3:SetSize( 60, 50 )
team_3:SetText( “Admin” )
team_3.DoClick = function()
RunConsoleCommand( “team_3” )
end

team_4 = vgui.Create( “DButton”, frame )
team_4:SetPos( 30, 240 )
team_4:SetSize( 60, 50 )
team_4:SetText( “Owner” )
team_4.DoClick = function()
RunConsoleCommand( “team_4” )
end

end
concommand.Add( “team_menu”, set_team )
usermessage.Hook( “set_team”, set_team )
[/lua]

INIT.lua
[lua]AddCSLuaFile( “cl_init.lua” ) --Tell the server that the client needs to download cl_init.lua
AddCSLuaFile( “shared.lua” ) --Tell the server that the client needs to download shared.lua

include( ‘shared.lua’ ) --Tell the server to load shared.lua

function GM:PlayerInitialSpawn( ply ) – When Player joins the server and Spawns…

ply:SetTeam ( 1 ) -- Add player to team 1 (Guest)

end

function GM:PlayerLoadout ( ply ) – Weapon/ammo/itom Function…
ply:StripWeapons()
if ply:Team() == 1 then
ply:Give ( “weapon_crowbar” )

elseif ply:Team() == 2 then
	ply:Give ( "weapon_crowbar" )
	ply:Give ( "weapon_physcannon" )
	
	elseif ply:Team() == 3 then
		ply:Give ( "weapon_crowbar" )
		ply:Give ( "weapon_physcannon" )
		ply:Give ( "weapon_physgun" )

		elseif ply:Team() == 4 then
			ply:Give ( "weapon_crowbar" )
			ply:Give ( "weapon_physcannon" )
			ply:Give ( "weapon_physgun" )
			
		end

end

function team_1( ply )

ply:SetTeam( 1 )
	ply:Spawn()

end

function team_2( ply )

ply:SetTeam( 2 )
	ply:Spawn()

end

function team_3( ply )
if ply:IsAdmin() then
ply:SetTeam( 3 )
ply:Spawn()
else

	Msg("You Are Not Admin!

")
end

end

function team_4( ply )
if ply:IsSuperAdmin() then
ply:SetTeam( 4 )
ply:Spawn()
else

Msg("You Are Not SuperAdmin!

")
end

end

concommand.Add( “team_1”, team_1 )
concommand.Add( “team_2”, team_2 )
concommand.Add( “team_3”, team_3 )
concommand.Add( “team_4”, team_4 )

function GM:ShowHelp( ply ) – This hook is called everytime F1 is pressed.
SendUserMessage(“set_team”, ply) – Sending a message to the client.
end
[/lua]

shared.lua

[lua] GM.Name = “BlazeMod”
GM.Author = “Blaze”
GM.Email = “N/A”
GM.Website = “N/A”

team.SetUp( 1, “Guest”, Color( 125, 125, 125, 255 ) )
team.SetUp( 2, “Player”, Color( 0, 160, 0, 255 ) )
team.SetUp( 3, “Admin”, Color( 160, 0, 0, 255 ) )
team.SetUp( 4, “Owner”, Color( 0, 0, 160, 255 ) )

[/lua]

Well one tip to help you with too many/too few ends for your if blocks: Your if-then-elseif blocks don’t need tabbing on the -elseif’s. They respresent the same level of conditional (extra tabbing in that case indicates nested conditionals, but -elseifs are just case-based conditionals). Also, -elseifs don’t require their own -ends.

Anyways, you can just replace Msg() with **[DNotify

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=DNotify)**, or a DFrame in general I suppose.

Ugh. “Respected” players. Seriously? Come on.