Jump to content

mapratings_report


Neukfout

Recommended Posts

Hey guys,

I got a little problem with this resource: https://community.multitheftauto.com/ind ... ils&id=468

It's supposed to show the average map rating, but it doesn't show anything in the chatbox...

I already checked THIS topic, and followed the suggestion, but it still won't work :|

Could you please help me?

This are my files:

meta.xml

<meta> 
    <info name="Mapratings Report" description="reports the map name and it's current map rating on map start." author="Pothole Studios" version="1.0" type="script" /> 
     
    <script src="server.lua" /> 
     
</meta> 

server.lua

local g_Root = getRootElement() 
  
addEvent('onGamemodeMapStart') 
addEvent('onSendMapRating') 
  
function processRating(rating) 
    if rating[1] == false then 
        outputChatBox("This map has not yet been rated.", g_Root, 225, 170, 90, true) 
    else 
        outputChatBox("This map has a rating of "..rating.color..rating.average.."/10#E1AA5A.", g_Root, 225, 170, 90, true) 
    end 
    removeEventHandler('onSendMapRating',g_Root,processRating) 
end 
  
addEventHandler('onGamemodeMapStart',g_Root, 
    function() 
        if (getResourceState(getResourceFromName("mapratings")) == "running") then 
            addEventHandler('onSendMapRating',g_Root,processRating) 
        else 
            outputDebugString("ERROR: mapratings_report cannot run: mapratings is not loaded.",1) 
        end 
    end 
) 

Thanks in advance! :)

Edited by Guest
Link to comment

The resource name is right, so that won't be the problem.

I used debugscript 3 and I got these errors when I started 'mapratings':

j13m9g.jpg

When I started 'mapratings_report' I didn't get any errors, so it must be the mapratings resource...

EDIT: Okay, I fixed the problem, but there's a new problem :roll:

I rate a map like '/rate 6', but the server doesn't save the ratings (I suppose lol). When I redo a map which I just rated, it still says 'This map hasn't been rated yet.'

I have no idea what to do.

Debugscript 3 doesn't give any errors...

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...