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!