Jump to content
  • 0

race_mapratings resource question


alwSmokE

Question

8 answers to this question

Recommended Posts

  • 0

This should do the trick:

Server

local g_Root = getRootElement()
 
-- defined in race_mapratings resource
addEvent("onSendMapRating") 
addEventHandler("onSendMapRating", g_Root,
function(mapRating)
-- relay map rating to clients
triggerClientEvent("onClientAcquireMapRating", g_Root, mapRating)
end
)

Client

local g_Root = getRootElement()
 
addEvent("onClientAcquireMapRating", true)
addEventHandler("onClientAcquireMapRating", g_Root, 
function(mapRating)
if mapRating then
outputChatBox("This map is rated: "..tostring(mapRating.average).."/10")
end
end
)

This is the simplest example; you can replace the outputChatBox with a more elaborate GUI output.

Edit: mistake

Edited by Guest
Link to comment
  • 0

Hey thanks, but I have no idea what to do with that.

I'm gonna try to figure it out, but I don't know that much about this stuff.

My guess is sticking this somewhere in the mapratings_server.lua file? Or wait... is there a mapratings_client? hmmmm.... I might can figure this out...

***Edit***

I added those lines to the end of the mapratings_server.lua file. Then I added a file called mapratings_client.lua and put in the other lines. But it doesn't do anything.

Link to comment
  • 0

15683962.jpg

Ok I edited the meta file (I think) to have a client thing as well. But this is what happens. I'm close...

Any ideas?

***Edit***

Just messing with it, and and now it's starting to spam the chatbox:

Rated 'Bball_Deftones' 6/10.

-]alw[-SmokE[FG] rate 'Bball_Deftones' to 6/10

This map is rated: table: 14A488F0/10

This map is rated: table: 14A48EB8/10

This map is rated: table: 14A480D0/10

Map 'biggerbumpercars' started.

This map is rated: table: 149DFEF8/10

This map is rated: table: 149E0D80/10

This map is rated: table: 149E22E8/10

This map is rated: table: 149E1A50/10

Rated 'biggerbumpercars' 7/10.

-]alw[-SmokE[FG] rate 'biggerbumpercars' to 7/10

This map is rated: table: 14A8B3F8/10

This map is rated: table: 14A8B5D8/10

This map is rated: table: 14A8B8F8/10

This map is rated: table: 14A8BAB0/10

Changed rating from 7/10 to 6.5/10.

-]alw[-SmokE[FG] rate 'biggerbumpercars' to 6.5/10

This map is rated: table: 14A66CE8/10

This map is rated: table: 14A67648/10

This map is rated: table: 14A66EF0/10

This map is rated: table: 14A63DB8/10

This map is rated: table: 14A5D878/10

Link to comment
  • 0

Those two files weren't supposed to be added to the race_mapratings resource, but to be on a separate resource.

The table output was due to a mistake, since the 'mapRating' variable actually has three fields: average, color, and count; what you want is the average. You should also check that it holds any value.

Link to comment
  • 0

I ended up coding one too, as our server would enjoy this feature.

While this is bound to sound like blowing one's trumpet here, I extensively bugfixed my own, and got the output to match race_mapratings too.

It's available: https://community.multitheftauto.com/index.html?p ... ils&id=468 should anyone want it, or just to compare differing methods of the same goal.

Also of note: No need for a clientside file to handle the output when outputChatBox works serverside: it can even just output chat to just one player if necessary.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...