Tando Posted June 8, 2018 Posted June 8, 2018 Hello, I need help in Server .lua Logo: Quote Client: sx,sy = guiGetScreenSize () addEvent ("onNotificationWindowHide",false) addEvent ("onNotificationWindowShow",false) box = false function showBox(value, str) if str and type(str) == "table" and #(str) > 0 then box = true if value == "info" then showTipBox (table.concat(str," "),"img/info.png") outputConsole ("[INFO]" .. table.concat(str," ")) --[[elseif value == "error" then showTipBox (str,"img/error.png") outputConsole ("[ERROR]" .. str) elseif value == "warning" then showTipBox (str,"img/warning.png") outputConsole ("[WARNING]" .. str)]]-- end end end addEvent("CreateBox", true) addEventHandler("CreateBox", getRootElement(), showBox) addEventHandler ("onNotificationWindowHide",getRootElement(), function () box = false end ) tipBox = {} tipBox.path = "" tipBox.show = false tipBox.state = nil tipBox.string = nil tipBox.starTick = nil tipBox.currentY = nil tipBox.time = 800 tipBox.next = nil tipBox.nextPath = "" tipBox.timer = nil tipBox.startY = sy+256 tipBox.stopY = sy-150 function showTipBox (str,path) if str then if path == nil then path = "img/info.png" end if fileExists (path) then if tipBox.show == true then tipBox.next = str tipBox.nextPath = path else tipBox.path = path tipBox.show = true tipBox.state = "starting" tipBox.string = str tipBox.startTick = getTickCount() triggerEvent ("onNotificationWindowShow",getRootElement()) end end end end addEvent("CreateTipBox", true) addEventHandler("CreateTipBox", getRootElement(), showTipBox) addEventHandler ("onClientRender", getRootElement(), function () if tipBox.show == true and tipBox.string then local width = dxGetTextWidth (tipBox.string, 1, "default-bold") if width then if tipBox.state == "starting" then local progress = ((getTickCount() - tipBox.startTick) / tipBox.time)*0.5 local intY = interpolateBetween ( tipBox.startY,0,0, tipBox.stopY,0,0, progress,"OutElastic" ) if intY then tipBox.currentY = intY else tipBox.currentY = 100 end if progress > 1 then tipBox.state = "showing" tipBox.timer = setTimer ( function () tipBox.startTick = getTickCount() tipBox.state = "hiding" end ,string.len(tipBox.string)*45+800,1) end elseif tipBox.state == "showing" then tipBox.currentY = tipBox.stopY elseif tipBox.state == "hiding" then local progress = (getTickCount() - tipBox.startTick) / (tipBox.time) local intY = interpolateBetween ( tipBox.stopY,0,0, tipBox.startY,0,0, progress,"Linear" ) if intY then tipBox.currentY = intY else tipBox.currentY = 100 end if progress > 1 then triggerEvent ("onNotificationWindowHide",getRootElement()) if tipBox.next then if isTimer(tipBox.timer) then killTimer(tipBox.timer) end tipBox.show = true tipBox.state = "starting" tipBox.string = tipBox.next tipBox.startTick = getTickCount() tipBox.next = nil tipBox.path = tipBox.nextPath return else tipBox.show = false tipBox.state = nil tipBox.string = nil return end end else return end local width = 400 local x,y = sx - width - 5, tipBox.currentY local textX,textY = x+100,tipBox.currentY+34.375 local textWidth,textHeight = 273.59375,82.8125 dxDrawImage(x,y,width,200,tipBox.path,0,0,0,tocolor(255,255,255),true) dxDrawText(tipBox.string,textX,textY,textX+textWidth,textY+textHeight,tocolor(255,255,255),1,"default-bold","center","center",false,true,true) end end end ) First this system same as message but this with logo and will be under screen Server.lua = Command <text> for show inside Logo under screen Like Info for players ingame NOTE: Sry for spam posts i just want be finish my verison OF SAUG:RPG 3.5
Tando Posted June 9, 2018 Author Posted June 9, 2018 Just now, Dimos7 said: so you want the message be on image? yeaa not message i need command in it like t/tando <tex> t/tando hello everybody
Tando Posted June 9, 2018 Author Posted June 9, 2018 7 minutes ago, Dimos7 said: You want that message apear to every one? yea !! like info
Dimos7 Posted June 11, 2018 Posted June 11, 2018 Make a function in server side make command handler and then triger the even createBox
Tando Posted July 11, 2018 Author Posted July 11, 2018 On 6/11/2018 at 07:21, Dimos7 said: Make a function in server side make command handler and then triger the even createBox may u make it plz bcs i have some problems with making function function showTextDisplay ( player, command ) local serverDisplay = textCreateDisplay() -- create a text display textDisplayAddObserver ( serverDisplay, player ) -- make it visible to a player local serverText = textCreateTextItem ( "Hello world!", 0.5, 0.5 ) -- create a text item for the display textDisplayAddText ( serverDisplay, serverText ) -- add it to the display so it is displayed end addCommandHandler( "showText", showTextDisplay ) this i want inside logo + with acl group "staff" or "admin" anything
Tando Posted July 12, 2018 Author Posted July 12, 2018 17 hours ago, (SAUG)Tando said: may u make it plz bcs i have some problems with making function function showTextDisplay ( player, command ) local serverDisplay = textCreateDisplay() -- create a text display textDisplayAddObserver ( serverDisplay, player ) -- make it visible to a player local serverText = textCreateTextItem ( "Hello world!", 0.5, 0.5 ) -- create a text item for the display textDisplayAddText ( serverDisplay, serverText ) -- add it to the display so it is displayed end addCommandHandler( "showText", showTextDisplay ) this i want inside logo + with acl group "staff" or "admin" anything OMG this false i need it by own text not show text
Dimos7 Posted July 13, 2018 Posted July 13, 2018 function createText(thePlayer, command,...) local message = table.concat({...}, "") if message ~= "" then triggerEvent("createBox", message) else return outputChatBox("Synat:/ "..command.." text", thePlayer, 255, 0, 0) end end addCommandHandler("", createText) -- "" put the command you want
Tando Posted July 13, 2018 Author Posted July 13, 2018 19 minutes ago, Dimos7 said: function createText(thePlayer, command,...) local message = table.concat({...}, "") if message ~= "" then triggerEvent("createBox", message) else return outputChatBox("Synat:/ "..command.." text", thePlayer, 255, 0, 0) end end addCommandHandler("", createText) -- "" put the command you want not working i thing it's need addEventHandler("onNotificationWindowShow") right ?
Dimos7 Posted July 13, 2018 Posted July 13, 2018 function createText(thePlayer, command,...) local message = table.concat({...}, "") if message ~= "" then triggerEvent("onNotificationWindowShow", root, message) else return outputChatBox("Synat:/ "..command.." text", thePlayer, 255, 0, 0) end end addCommandHandler("", createText) -- "" put the command you want
Tando Posted July 13, 2018 Author Posted July 13, 2018 7 hours ago, Dimos7 said: function createText(thePlayer, command,...) local message = table.concat({...}, "") if message ~= "" then triggerEvent("onNotificationWindowShow", root, message) else return outputChatBox("Synat:/ "..command.." text", thePlayer, 255, 0, 0) end end addCommandHandler("", createText) -- "" put the command you want not working
Dimos7 Posted July 14, 2018 Posted July 14, 2018 13 hours ago, (SAUG)Tando said: not working Any errors or warnings?
Tando Posted July 14, 2018 Author Posted July 14, 2018 1 hour ago, Dimos7 said: Any errors or warnings? This script already shared in mtasa scripts but server.lua not working it's function showBox(player, value, str) if isElement(player) then triggerClientEvent(player, "CreateBox", getRootElement(), value, str) end end link:https://community.multitheftauto.com/index.php?p=resources&s=details&id=5812
Dimos7 Posted July 14, 2018 Posted July 14, 2018 function createText(thePlayer, command,...) local message = table.concat({...}, "") if message ~= "" then triggerEvent("createBox", root, "info" , message) else return outputChatBox("Synat:/ "..command.." text", thePlayer, 255, 0, 0) end end addCommandHandler("", createText) -- "" put the command you wanτ Try that
Tando Posted July 16, 2018 Author Posted July 16, 2018 On 7/14/2018 at 16:26, Dimos7 said: function createText(thePlayer, command,...) local message = table.concat({...}, "") if message ~= "" then triggerEvent("createBox", root, "info" , message) else return outputChatBox("Synat:/ "..command.." text", thePlayer, 255, 0, 0) end end addCommandHandler("", createText) -- "" put the command you wanτ Try that nothing too
Dimos7 Posted July 16, 2018 Posted July 16, 2018 10 minutes ago, (SAUG)Tando said: nothing too Is that same resource with notification?
Tando Posted July 16, 2018 Author Posted July 16, 2018 6 minutes ago, Dimos7 said: Is that same resource with notification? yea
Dimos7 Posted July 16, 2018 Posted July 16, 2018 function createText(thePlayer, command,...) local message = table.concat({...}, "") if message ~= "" then triggerClientEvent("createBox", root, "info" , message) else return outputChatBox("Synat:/ "..command.." text", thePlayer, 255, 0, 0) end end addCommandHandler("", createText) -- "" put the command you wanτ Try that
Tando Posted July 16, 2018 Author Posted July 16, 2018 1 minute ago, Dimos7 said: function createText(thePlayer, command,...) local message = table.concat({...}, "") if message ~= "" then triggerClientEvent("createBox", root, "info" , message) else return outputChatBox("Synat:/ "..command.." text", thePlayer, 255, 0, 0) end end addCommandHandler("", createText) -- "" put the command you wanτ Try that nothing too
Dimos7 Posted July 16, 2018 Posted July 16, 2018 (edited) function createText(thePlayer, command,...) local message = table.concat({...}, "") if message ~= "" then triggerClientEvent("CreateTipBox", root, message) else return outputChatBox("Synat:/ "..command.." text", thePlayer, 255, 0, 0) end end addCommandHandler("", createText) -- "" put the command you wanτ Last i give up if that not work Edited July 16, 2018 by Dimos7
Tando Posted July 16, 2018 Author Posted July 16, 2018 7 minutes ago, Dimos7 said: function createText(thePlayer, command,...) local message = table.concat({...}, "") if message ~= "" then triggerClientEvent("CreateTipBox", root, message) else return outputChatBox("Synat:/ "..command.." text", thePlayer, 255, 0, 0) end end addCommandHandler("", createText) -- "" put the command you wanτ Last i give up if that not work same
Galactix Posted July 16, 2018 Posted July 16, 2018 function createText(thePlayer, command,...) local message = table.concat({...}, "") if message ~= "" then triggerClientEvent("CreateBox", root, message) else return outputChatBox("Synat:/ "..command.." text", thePlayer, 255, 0, 0) end end addCommandHandler("", createText) -- "" put the command you wanτ This will work. The event that is supposed to be triggered is CreateBox, not CreateTipBox, which is triggered itself by CreateBox.
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