Say "/class" to change class.

Okay, I use Classes as teams.

I dont know how to make a script where if you says “/class” it gives you a list.

So, anyone could tell me how I make the /class command? 8D

Thanks ~

Bumping <-<

[lua]
– RPLOL.lua

function helpClass(ply)
if (ply:GetNWBool(“helpClass”) == true) then
ply:SetNWBool(“helpClass”,false)
else
ply:SetNWBool(“helpClass”,true)
end
return “”
end
AddChatCommand("/Classhelp", helpClass)

– CLINIT.lua

local function DrawDisplay()

DrawDisplay()

if (LocalPlayer():GetNWBool("helpClass") == true and LocalPlayer():Alive()) then
	draw.RoundedBox(10, 10, 10, 560, 260, Color(0, 0, 0, 155))
	draw.RoundedBox(10, 12, 12, 556, 256, Color(51, 58, 51, 200))
	draw.RoundedBox(10, 12, 12, 556, 20, Color(0, 0, 0, 200))
	draw.DrawText("Class Help", "ScoreboardText", 30, 12, Color(255,255,255,255),0)
	draw.DrawText("[INSERT CLASS TEXT INFO HERE]", "ScoreboardText", 30, 35, Color(255,255,255,255),0)
end

[/lua]

Untested,
Used DarkRP Code.
Should help you get started.

Actually, they have their own scripting way I think xD

They have made like a function to make it easier to script that kind of commands :s
Thanks anyway :stuck_out_tongue:

Bump! 8D

Can you please stop bumping your threads within a 24 hour period.
Some one will attend to you when they can.

Here’s the simplest way I can think of :[lua]function sayChangeTeam(ply, say, teamsay)
if say == “/team1” and !ply:Team() == 1 then
ply:SetTeam(1)
return
end

	 if say == "/team2" and ply:Team() == 2 then
        ply:SetTeam(2)
		return
     end

end
hook.Add(“PlayerSay”,“ChangeTeamBlue”,sayChangeTeam) [/lua]

And here are a few wiki pages you can read for more information :

edit : And Sykore, the bit you posted has actually nothing to do with changing teams. And it also uses a few DarkRp only functions.

another edit : Thanks for pointing out these dumb errors BastinkaLive

Uhm, your code has 2 right parentheses without a matching left one.

It would be more like this:

[lua]function ClassSay( ply, text, toall )
if (string.lower( text ) == “/class”) then
–Do stuff
end
end
hook.Add( “PlayerSay”, “ClassChange”, ClassSay )[/lua]

Okay, sorry for the bumps.

Anyways, im going to test this now.
Ill edit this post with the progress ^^

@BastinkaLive

Yours works perfectly.
Thanks you very much!