function Notify( ply, num1, num2, msg ) GAMEMODE:Notify( ply, num1, num2, msg ) end if SERVER then local function CheckLicense() for k,v in pairs( player.GetAll() ) do if ValidEntity( v:GetVehicle() ) and v:GetVehicle():IsVehicle() then if not v.License then v:ExitVehicle() Notify( v, 1, 5, "You need a license to drive a vehicle." ) end end end end timer.Create( "CheckLicense", 0.1, 0, CheckLicense ) local function GiveLicense( ply ) if ply:Team() == TEAM_DMV or ply:IsAdmin() then if ValidEntity( ply:GetEyeTrace().Entity ) and ply:GetEyeTrace().Entity:IsPlayer() then local target = ply:GetEyeTrace().Entity if target:IsPlayer() then target.License = true target:SetPData( "license", 1 ) Notify( target, 0, 4, "You have been given a driver's license." ) Notify( ply, 0, 4, "Gave " .. target:Nick() .. " a driver's license." ) end else ply.License = true ply:SetPData( "license", 1 ) Notify( ply, 0, 4, "Gave yourself a driver's license." ) end else Notify( ply, 1, 4, "You must be a DMV agent or admin to do this." ) end return "" end AddChatCommand( "/driverslicense", GiveLicense ) local revokeTeams = { TEAM_DMV, TEAM_POLICE, TEAM_CHIEF, TEAM_SWAT, TEAM_SWATCHIEF, TEAM_STATETROOPER, TEAM_MAYOR } -- ADD ALL THE TEAM_BLAH THAT YOU WANT TO BE ABLE TO REVOKE LICENSES HERE (state trooper or whatever) local function RevokeLicense( ply ) if table.HasValue( revokeTeams, ply:Team() ) then if ValidEntity( ply:GetEyeTrace().Entity ) and ply:GetEyeTrace().Entity:IsPlayer() then local target = ply:GetEyeTrace().Entity if target:IsPlayer() then target.License = false target:SetPData( "license", 0 ) Notify( target, 1, 4, "Your license has been revoked by " .. ply:Nick() .. "!" ) Notify( ply, 0, 4, "Revoked " .. target:Nick() .. "'s license." ) end end end return "" end AddChatCommand( "/revokelicense", RevokeLicense ) local function SpawnPlayer( ply ) timer.Simple( 0.1, function() if tonumber( ply:GetPData( "license", 0 ) ) == 1 then ply.License = true else ply.License = false end end ) end hook.Add( "PlayerInitialSpawn", "PlayerLicenseSet", SpawnPlayer ) end