Sandbox show rate system

So im admin on a server thats sandbox but its sort of a bother hearing everyone bitch about rate abuse… Can i get a script that tells admins who rated who? Like playername rated rate name to playername

Do people actually care about their ratings?

yes apparently so

Would be nice for a code -

rating.lua in gamemodes/sandbox/

It’s not exactly what you wanted, just quickly threw it up, my internet is being a jerk right now so yeah. It will send a message to everyone when you rate someone saying “Player rated Player with rating”
[lua]
/---------------------------------------------------------
Name: Make the table if it doesn’t exist
---------------------------------------------------------
/
if ( !sql.TableExists( “ratings” ) ) then

sql.Query( "CREATE TABLE IF NOT EXISTS ratings ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, target INTEGER, rater INTEGER, rating INTEGER );" )
sql.Query( "CREATE INDEX IDX_RATINGS_TARGET ON ratings ( target DESC )" )
Msg("SQL: Created ratings table!

")

end

/---------------------------------------------------------
Name: ValidRatings - only these ratings are valid!
---------------------------------------------------------
/
local ValidRatings = { “bad”, “smile”, “love”, “artistic”, “star”, “builder” }

local function GetRatingID( name )

for k, v in pairs( ValidRatings ) do
	if ( name == v ) then return k end
end

return false

end

/---------------------------------------------------------
Name: Update the player’s networkvars based on the DB
---------------------------------------------------------
/
local function UpdatePlayerRatings( ply )

local result = sql.Query( "SELECT rating, count(*) as cnt FROM ratings WHERE target = "..ply:UniqueID().." GROUP BY rating " )

if ( !result ) then return end

for id, row in pairs( result ) do

	ply:SetNetworkedInt( "Rating."..ValidRatings[ tonumber( row['rating'] ) ], tonumber( row['cnt'] ) )

end

end

/---------------------------------------------------------
Name: CCRateUser
---------------------------------------------------------
/
local function CCRateUser( player, command, arguments )

local Ratername	= player:GetName()
local Rater 	= player
local Target 	= Entity( tonumber( arguments[1] ) )
local Rating	= arguments[2]

// Don't rate non players
if ( !Target:IsPlayer() ) then return end

// Don't rate self
if ( Rater == Target ) then return end

local RatingID = GetRatingID( Rating )
local RaterID = Rater:UniqueID()
local TargetID = Target:UniqueID()

// Rating isn't valid
if (!RatingID) then return end

// When was the last time this player rated this player
// Only let them rate each other evre 60 seconds
Target.RatingTimers = Target.RatingTimers or {}
if ( Target.RatingTimers[ RaterID ] && Target.RatingTimers[ RaterID ] > CurTime() - 60 ) then

	Rater:ChatPrint( "Please wait before rating ".. Target:Nick() .." again.

" );
return

end

Target.RatingTimers[ RaterID ] = CurTime()

// Tell the target that they have been rated (but don't tell them who to add to the fun and bitching)
Target:ChatPrint( "You have received a new rating.

" );

// Let the rater know that their vote was counted
Rater:ChatPrint( "Rated ".. Target:Nick() .."!

" );

PrintMessage( HUD_PRINTTALK, Ratername.. " Rated ".. Target:Nick() .." with "..Rating.."!

" );

sql.Query( "INSERT INTO ratings ( target, rater, rating ) VALUES ( "..TargetID..", "..RaterID..", "..RatingID.." )" )

// We changed something so update the networked vars
UpdatePlayerRatings( Target )

end

concommand.Add( “rateuser”, CCRateUser )

/---------------------------------------------------------
When the player joins the server we
need to restore the NetworkedInt’s
---------------------------------------------------------
/
local function PlayerRatingsRestore( ply )

UpdatePlayerRatings( ply )

end
hook.Add( “PlayerInitialSpawn”, “PlayerRatingsRestore”, PlayerRatingsRestore )
[/lua]

Cool il check it out, thx.