Jump to content

Script doesnt work


1LoL1

Recommended Posts

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
--//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
-- 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 by MrTasty
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...