Neukfout Posted September 1, 2011 Share Posted September 1, 2011 (edited) 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 September 1, 2011 by Guest Link to comment
Neukfout Posted September 1, 2011 Author Share Posted September 1, 2011 Use tags Done Link to comment
Neukfout Posted September 2, 2011 Author Share Posted September 2, 2011 I checked it again, with the MTA Wiki, and I can't find any errors/mistakes... It must be minor Link to comment
SDK Posted September 2, 2011 Share Posted September 2, 2011 getResourceFromName("mapratings") This assumes the resource where it's getting the ratings from is called "mapratings", check that. Also, use debugscript 3 to detect errors Link to comment
Neukfout Posted September 3, 2011 Author Share Posted September 3, 2011 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': 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 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now