1LoL1 Posted March 30, 2018 Share Posted March 30, 2018 Hello, can anyone help me with this? i always must use /sms . text i need /sms text and why i can't use example: /sms text\ntext\ntext ? server-side addCommandHandler("sms", function(player, cmd, sms, ...) newSMS = table.concat({...}, " ") sms = newSMS triggerClientEvent("onSMSTrigger", player, sms) end) client-side local screenW, screenH = guiGetScreenSize() local sms = "" addEvent("onSMSTrigger", true) addEventHandler("onSMSTrigger", getRootElement(), function (newSMS) sms = newSMS end) addEventHandler("onClientRender", getRootElement(), function() dxDrawText(sms, (screenW * 0.2462) + 1, (screenH * 0.6833) + 1, (screenW * 0.8838) + 1, (screenH * 0.9933) + 1, tocolor(0, 0, 0, 255), 2.50, "default-bold", "left", "top", true, true, false, true, false) dxDrawText(sms, screenW * 0.2462, screenH * 0.6833, screenW * 0.8838, screenH * 0.9933, tocolor(255, 255, 255, 255), 2.50, "default-bold", "left", "top", true, true, false, true, false) end) Link to comment
LLCoolJ Posted March 30, 2018 Share Posted March 30, 2018 --//Server addCommandHandler("sms", function(player,cmd,...) local messages = {} for i = 1,#arg do messages[i] = arg[i] end triggerClientEvent("onSMSTrigger", player, messages) end) --//Client local screenW, screenH = guiGetScreenSize() local sms = {} addEvent("onSMSTrigger", true) addEventHandler("onSMSTrigger", getRootElement(), function (newSMS) sms = newSMS end) addEventHandler("onClientRender", getRootElement(), function() local str = "" for i = 1,#sms do str = str..sms[i].."\n\n" end dxDrawText(str, (screenW * 0.2462) + 1, (screenH * 0.6833) + 1, (screenW * 0.8838) + 1, (screenH * 0.9933) + 1, tocolor(0, 0, 0, 255), 2.50, "default-bold", "left", "top", true, true, false, true, false) end) /sms <text>, or /sms <text1> <text2> <text3> Should work fine Link to comment
1LoL1 Posted March 30, 2018 Author Share Posted March 30, 2018 oh i don't think this i mean normal text Example: /sms 1 2 3 4 5 1 2 3 4 5 /sms 1\n2\n3\n4\n5 1 2 3 4 5 Link to comment
Addlibs Posted March 30, 2018 Share Posted March 30, 2018 (edited) -- server-side addCommandHandler("sms", function(player, cmd, sms, ...) newSMS = table.concat({...}, " ") sms = string.gsub(newSMS, "\\n", "\n") -- replace user input \n into actual linebreak triggerClientEvent("onSMSTrigger", player, sms) end ) Edited March 30, 2018 by MrTasty 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