Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- util.AddNetworkString("instructor_menu")
- util.AddNetworkString("instructor_info_menu")
- hook.Add("PlayerSay", "InstructorCommand", function(ply, txt, chn)
- if (string.sub(string.lower(txt), 1, 11) == "!instructor" and (ULib.ucl.query(ply, "license admin panel") or ply.carInstructor == 1 or ply.busInstructor == 1 or ply.truckInstructor == 1)) then
- net.Start("instructor_menu")
- net.Send(ply)
- return ""
- end
- end)
- net.Receive("instructor_menu", function(len, ply)
- if(IsValid(ply) and ply:IsPlayer() and ((not ULib and ply:IsAdmin()) or ULib.ucl.query(ply, "license admin panel") or ply.carInstructor == 1 or ply.busInstructor == 1 or ply.truckInstructor == 1)) then
- local txt = net.ReadString();
- local choice = nil;
- for k, v in pairs(player.GetAll()) do
- if(string.lower(tostring(v:Name())) == string.lower(txt)) then
- choice = v
- break
- end
- end
- if not choice then return end
- local infos = {}
- infos["name"] = choice:Name();
- if((not ULib and ply:IsAdmin()) or ULib.ucl.query(ply, "license admin panel") or (ply.carInstructor == 1 and choice.carInstructor ~= 1)) then
- infos["car"] = choice.carLicense
- infos["carPoints"] = choice.carLicensePoints
- end
- if((not ULib and ply:IsAdmin()) or ULib.ucl.query(ply, "license admin panel") or (ply.busInstructor == 1 and choice.busInstructor ~= 1)) then
- infos["bus"] = choice.busLicense
- infos["busPoints"] = choice.busLicensePoints
- end
- if((not ULib and ply:IsAdmin()) or ULib.ucl.query(ply, "license admin panel") or (ply.truckInstructor == 1 and choice.truckInstructor ~= 1)) then
- infos["truck"] = choice.truckLicense
- infos["truckPoints"] = choice.truckLicensePoints
- end
- if((not ULib and ply:IsAdmin()) or ULib.ucl.query(ply, "license admin panel")) then
- infos["carInstructor"] = choice.carInstructor
- infos["busInstructor"] = choice.busInstructor
- infos["truckInstructor"] = choice.truckInstructor
- end
- net.Start("instructor_info_menu")
- net.WriteTable(infos)
- net.Send(ply)
- end
- end)
- net.Receive("instructor_info_menu", function(len, ply)
- if(IsValid(ply) and ply:IsPlayer() and ((not ULib and ply:IsAdmin()) or ULib.ucl.query(ply, "license admin panel") or ply.carInstructor == 1 or ply.busInstructor == 1 or ply.truckInstructor == 1)) then
- local txt = net.ReadString()
- local choice = nil
- for k, v in pairs(player.GetAll()) do
- if(string.lower(tostring(v:Name())) == string.lower(txt)) then
- choice = v
- break
- end
- end
- if not choice then return end
- local key = ""
- while(true) do
- key = net.ReadString()
- if(key == "fin") then
- break;
- elseif(key == "car") then
- carl = net.ReadInt()
- choice.carLicense = net.ReadInt()
- choice.carLicensePoints = net.ReadInt()
- elseif(key == "bus") then
- choice.busLicense = net.ReadInt()
- choice.busLicensePoints = net.ReadInt()
- elseif(key == "truck") then
- choice.truckLicense = net.ReadInt()
- choice.truckLicensePoints = net.ReadInt()
- elseif(key == "instructors") then
- choice.carInstructor = net.ReadInt()
- choice.busInstructor = net.ReadInt()
- choice.truckInstructor = net.ReadInt()
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment