xF_Micka Posted January 28, 2014 Share Posted January 28, 2014 (edited) Hello. I have a problem on my server, without aftermath but an error always appears in my server logs. When a player joins, he gets this error on chat : say: Invalid text length In server logs : [2014-01-28 17:53:47] ERROR: Client triggered serverside event onRequestMapName, but event is not added serverside In my race gamemode : addEventHandler("onClientResourceStart", g_ResRoot, function() yo = dxGetFontHeight(c_FontScale, c_Font) triggerServerEvent("onRequestMapName", g_ResRoot) end ) So what's problem with this function "triggerServerEvent" and "OnRequestMapName" ? Thanks. Edited January 28, 2014 by Guest Link to comment
Castillo Posted January 28, 2014 Share Posted January 28, 2014 You are posting a fraction of script that doesn't fit at all with your errors. Link to comment
xF_Micka Posted January 28, 2014 Author Share Posted January 28, 2014 Sorry, check again the error, I just have changed onRequestMapName by "GetMapName" thinking it could resolve the problem, but it's not that. Link to comment
Castillo Posted January 28, 2014 Share Posted January 28, 2014 That error means that it triggered a server side event which doesn't exist in the server side. Link to comment
xF_Micka Posted January 28, 2014 Author Share Posted January 28, 2014 So, what I have to do ? Delete this part of code ? Link to comment
MTA Team 0xCiBeR Posted January 28, 2014 MTA Team Share Posted January 28, 2014 No, you just have to add that event on the server side using: addEvent It would be easy to explain if you post you're code. Link to comment
xF_Micka Posted January 28, 2014 Author Share Posted January 28, 2014 Sorry but I'm not very experimented in script. So I try to learn too. What is the "server side" ? The part of the code is from a file "info_map" who display elementary informations about the map (name, author, moden, etc.) when she is launched Here are the full script : local SCREEN_WIDTH, SCREEN_HEIGHT = guiGetScreenSize() local name, author, lastTimePlayed, spawnPointCount, playedCount, modename local startTick local enabled = true local month = {"January","February","March","April","May","June","Juli","August","September","October","November","December"} function timestampToDate(stamp) local time = getRealTime(stamp) return string.format("%d %s - %02d:%02d",time.monthday,month[time.month+1],time.hour,time.minute) end function handleMapInfo(mapInfo) name = mapInfo.name or "Unknown" author = mapInfo.author or "Unknown" playedCount = tostring(mapInfo.playedCount or "N/A") lastTimePlayed = timestampToDate(mapInfo.lastTimePlayed) or "Unknown" modename = "" if string.find(name,"%[DM]") then modename = "#FF8C00Deathmatch" elseif string.find(name,"%[DD]") then modename = "#00FFFFDestruction Derby" elseif string.find(name,"%[FUN]") then modename = "#FF0000Shooter" end outputChatBox("#FFFFFF* #E1AA5AMap created by: #FFFFFF"..author.."",255,255,255,true) outputChatBox("#FFFFFF* #E1AA5AMode: #FFFFFF"..modename.."",255,255,255,true) outputChatBox("#FFFFFF* #E1AA5APlayed: #FFFFFF"..playedCount.." #E1AA5Atimes",255,255,255,true) outputChatBox("#FFFFFF* #E1AA5ALast time: #ffffff"..lastTimePlayed.."",255,255,255,true) startTick = getTickCount() if not enabled then addEventHandler("onClientRender",getRootElement(),handleOnRender) enabled = true end end addEvent("onClientMapStarting",true) addEventHandler("onClientMapStarting",getRootElement(),handleMapInfo) local g_Root = getRootElement() local g_ResRoot = getResourceRootElement(getThisResource()) local screenWidth, screenHeight = guiGetScreenSize() -- Get the screen resolution local c_Font = "pricedown" local c_FontScale =0.90 local yo local mapName addEvent("onSendMapName", true) addEventHandler("onSendMapName", g_ResRoot, function(name) mapName = name end ) addEventHandler("onClientResourceStart", g_ResRoot, function() yo = dxGetFontHeight(c_FontScale, c_Font) triggerServerEvent("onRequestMapName", g_ResRoot) end ) addEventHandler("onClientRender", g_Root, function() if mapName then dxDrawText("Current Map: '" .. mapName .."'", 5, screenHeight-yo-2, screenWidth, screenHeight, tocolor(0, 255, 0, 255), c_FontScale, c_Font) end end ) Link to comment
Castillo Posted January 28, 2014 Share Posted January 28, 2014 Maybe the thing is that you stole that script and you want our help to build the server side. Link to comment
xF_Micka Posted January 28, 2014 Author Share Posted January 28, 2014 I have stolen that script ? LOL, he can be download on ressources mta website. You want the url may be ? I don't like to be accused of stolen --" Link to comment
MTA Team 0xCiBeR Posted January 28, 2014 MTA Team Share Posted January 28, 2014 Really? Do show then from wich url you downloaded it from.. Link to comment
xF_Micka Posted January 28, 2014 Author Share Posted January 28, 2014 https://community.multitheftauto.com/ind ... ls&id=6925 I'm here to get help and not to say I'm a thief... Thanks b Link to comment
Castillo Posted January 28, 2014 Share Posted January 28, 2014 I guess that the uploader stole that script. Link to comment
xF_Micka Posted January 28, 2014 Author Share Posted January 28, 2014 And this does not solves my problem... Link to comment
xF_Micka Posted January 29, 2014 Author Share Posted January 29, 2014 So, I can still get help ? 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