Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- COMMAND = openAura.command:New();
- COMMAND.tip = "Set the class of your character.";
- COMMAND.text = "<string Class>";
- COMMAND.flags = CMD_HEAVY;
- COMMAND.arguments = 1;
- -- Called when the command has been run.
- function COMMAND:OnRun(player, arguments)
- local class = openAura.class:Get( arguments[1] );
- if ( player:InVehicle() ) then
- openAura.player:Notify(player, "You don't have permission to do this right now!");
- return;
- end;
- if (class) then
- local limit = openAura.class:GetLimit(class.name);
- if ( openAura.plugin:Call("PlayerCanBypassClassLimit", player, class.index) ) then
- limit = MaxPlayers();
- end;
- if (_team.NumPlayers(class.index) >= limit) then
- openAura.player:Notify(player, "There are too many characters with this class!");
- else
- local previousTeam = player:Team();
- if (player:Team() != class.index) then
- if ( openAura.plugin:Call("PlayerCanChangeClass", player, class) ) then
- local success, fault = openAura.class:Set(player, class.index, nil, true);
- if (!success) then
- openAura.player:Notify(player, fault);
- end;
- end;
- else
- openAura.player:Notify(player, "You do not have access to this class!");
- end;
- end;
- end;
- else
- openAura.player:Notify(player, "This is not a valid class!");
- end;
- end;
- openAura.command:Register(COMMAND, "SetClass");
Add Comment
Please, Sign In to add comment