Permanent ULX Commands. Also, is there some way to have players set to automatic classes without change?


(Sorry about the stupid question, I am learning very slowly!)

 I am working on making my own server, and I would like to set classes to certain people, in which they will spawn, then immediately change to that class without the permission to leave the class. I would also like to make the classes Gag & Mute them upon connecting. Can anybody help me with this?? Thank you!

hook into player connect, and set them the class, add your chat/console commands to it using arguments etc.

I’m sorry to ask but can you elaborate on how to do that? I just started with this stuff, though I understand the basics

then could you please explain your “request” more? (Dont take it the rude way, I kinda understand you already, but define stuff like ‘classes’, are it DarkRP jobs, full Lua classes or anything like that, like a long explaination, then I could maybe provide a full working example code).

Hooking to ‘connect’ will cause an error since player might not be fully loaded/authed.
Stop with the suggestions.

I mean PlayerInitialSpawn, geez, its 3AM here and I wasnt sleeping sincer over 20 hours, calm down.

I can! I am looking to have a class pre-set for certain Steam ID’s to in which they spawn in the class they have been assigned to. (Basically meaning, I would like to permanently assign a certain fellow a class he can not leave.) I would also like for this person to be Gagged and Muted when he spawns in, as well.
Thank you for all your help :slight_smile:

Now define what classes? Do you like, have a class system already, or as above, mean darkrp jobs? Do you need a class system to be made, and if, what shall the classes be, features?

I already have a class made. This is gonna be a punishment class. This is actually for ZombieRP but I know it’s not too different from DarkRP. This class will have no weapons, no forms of communication (Hence why I ask for perma Gag and Mute.) Basically, these guys can’t do anything for a given amount of time but walk around. I find it a better way rather than kick somebody and lose players on the server. Plus, keeps RDM at a low! Everything is all set up. Player Model, Salary, and all that easy stuff. I just need to know how to perma !Gag & !Mute and have that class immediately set to them! I appreciate all the help you both are giving :slight_smile:

is there like, a function to set classes? Sorry, never used ZombieRP & there are different versions, so the class system may be edited. If there is, I will give you a working code (you’d need to make it ulx-compatible yourself, since I dont work with ulx, I only can make a normal chatcommand).

[editline]14th April 2016[/editline]

Uhhh, I just used the DarkRP Job Format to make the class. I am not entirely sure if there is something different but I don’t believe there is, knowing ZombieRP is basically DarkRP but with Zombies. If you can’t do the ULX commands it’s fine. But can you do the automatic redirect to the certain assigned class?

If it runs on the DarkRP core files, then this should work as a basic way…

--[[ BASIC WAY ]]--
local tbl = {} -- Add your Steam IDs.
tbl["STEAMID"] = true
tbl["STEAMID"] = true

hook.Add("PlayerInitialSpawn", "JailPlayerClass", function(ply)
    if tbl[ply:SteamID()] then
        ply:changeTeam(TEAM_YOURTEAM) -- if its actually using the DarkRP functions, and team format.
        RunConsoleCommand("ulx", "gag", ply:Nick()) -- Should run the ULX GAG command on them
        RunConsoleCommand("ulx", "mute", ply:Nick()) -- Should run the ULX MUTE command on them

And for the chat commands, it should be easy for you to get that going ^-^


Thank you! Now, where do I place this?? With the Job?

Its a serverside addon, either put it in “/lua/autorun/server/yourfilename.lua” or “/addons/youraddonname/lua/autorun/yourfilename.lua”.

[editline]15th April 2016[/editline]

Also dont forget to replace TEAM_YOURTEAM in the code.

Okay! Thank you very much