sagi100 Posted April 6, 2018 Share Posted April 6, 2018 Hello every one,i have a DD cw server,i want to put my clan logo on the screen in the begging of every round . I saw alot of servers with it, how can i do it Link to comment
^iiEcoo'x_) Posted April 6, 2018 Share Posted April 6, 2018 "onClientPlayerJoin" guiCreateStaticImage Link to comment
sagi100 Posted April 6, 2018 Author Share Posted April 6, 2018 31 minutes ago, DABL said: "onClientPlayerJoin" guiCreateStaticImage How do i upload the image and where should i put it Link to comment
KaMi Posted April 6, 2018 Share Posted April 6, 2018 2 hours ago, sagi100 said: How do i upload the image and where should i put it Put this in client local screenW, screenH = guiGetScreenSize() function imag() addEventHandler("onClientRender", getRootElement(), render) end addEventHandler ( "onClientPlayerJoin", getLocalPlayer(), imag ) function render() showChat(false) dxDrawImage((screenW - 800) / 2, (screenH - 600) / 2, 800, 600, "hello.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end This in meta.xml <meta> <info author="YourName" version="1.0" name="Welcome" description="Welcome To My Server" type="script" /> <script src="client.lua" type="client" /> <file src="hello.png" /> </meta> Now you need download a image, put her in png mode and take it to your resource ( you going to change her name to "hello" ) Link to comment
sagi100 Posted April 6, 2018 Author Share Posted April 6, 2018 Just now, <~KaMiKaZe~> said: Put this in client local screenW, screenH = guiGetScreenSize() function imag() addEventHandler("onClientRender", getRootElement(), render) end addEventHandler ( "onClientPlayerJoin", getLocalPlayer(), imag ) function render() showChat(false) dxDrawImage((screenW - 800) / 2, (screenH - 600) / 2, 800, 600, "hello.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end This in meta.xml <meta> <info author="YourName" version="1.0" name="Welcome" description="Welcome To My Server" type="script" /> <script src="client.lua" type="client" /> <file src="hello.png" /> </meta> Now you need download a image, put her in png mode and take it to your resource ( you going to change her name to "hello" ) what client ?like where should i put it bro. please i'm new here Link to comment
KaMi Posted April 6, 2018 Share Posted April 6, 2018 Just now, sagi100 said: what client ?like where should i put it bro. please i'm new here do you have the lua program ? Link to comment
sagi100 Posted April 6, 2018 Author Share Posted April 6, 2018 (edited) 1 minute ago, <~kamikaze~> said: do you have the lua program ? yea like i should put this on the notepad +++ make also an meta file and move it to rescource? btw how to i choose the image that i want , like how i need to upload her to the script Edited April 6, 2018 by sagi100 Link to comment
KaMi Posted April 6, 2018 Share Posted April 6, 2018 1 minute ago, sagi100 said: yea like i should put this on the notepad +++ make also an meta file and move it to rescource? Yes, you have to do that with the given instructions Link to comment
sagi100 Posted April 6, 2018 Author Share Posted April 6, 2018 okey bro and add the image also to the folder and change her name to hello? Link to comment
KaMi Posted April 6, 2018 Share Posted April 6, 2018 2 minutes ago, sagi100 said: okey bro and add the image also to the folder and change her name to hello? Yes, if you can´t do it, you can download this example http://www.mediafire.com/file/sc6zdudjvb18suu/OpenMe.rar Link to comment
sagi100 Posted April 6, 2018 Author Share Posted April 6, 2018 3 hours ago, <~KaMiKaZe~> said: Yes, if you can´t do it, you can download this example http://www.mediafire.com/file/sc6zdudjvb18suu/OpenMe.rar BRO the script does not working Link to comment
sagi100 Posted April 7, 2018 Author Share Posted April 7, 2018 3 hours ago, <~KaMiKaZe~> said: Yes, if you can´t do it, you can download this example http://www.mediafire.com/file/sc6zdudjvb18suu/OpenMe.rar i have added it to gameplay and didnt work ,also on resources. help me please Link to comment
LLCoolJ Posted April 7, 2018 Share Posted April 7, 2018 (edited) 'onClientPlayerJoin' event will trigger for all players except the local player.You need to use 'onClientResourceStart'. Try this local x,y = guiGetScreenSize() local image addEventHandler("onClientResourceStart",resourceRoot, function() image = guiCreateStaticImage(x/2-400/2,y/2-400/2,400,400,"hello.png",false) end) Also add this line to your resource's meta.xml.It means that resource will be started earlier than other resources. <download_priority_group>1</download_priority_group> Edited April 7, 2018 by IRBIS Link to comment
sagi100 Posted April 7, 2018 Author Share Posted April 7, 2018 3 hours ago, IRBIS said: 'onClientPlayerJoin' event will trigger for all players except the local player.You need to use 'onClientResourceStart'. Try this local x,y = guiGetScreenSize() local image addEventHandler("onClientResourceStart",resourceRoot, function() image = guiCreateStaticImage(x/2-400/2,y/2-400/2,400,400,"hello.png",false) end) Also add this line to your resource's meta.xml.It means that resource will be started earlier than other resources. <download_priority_group>1</download_priority_group> it's does work but the picture does not getting of the screen. i want it only when i restart the map, a race map , so the picture will be on the screen for few sec till game start. how can i fix it? Link to comment
myonlake Posted April 7, 2018 Share Posted April 7, 2018 1 hour ago, sagi100 said: it's does work but the picture does not getting of the screen. i want it only when i restart the map, a race map , so the picture will be on the screen for few sec till game start. how can i fix it? Make sure you load the file in meta.xml too. <file src="hello.png" /> Link to comment
sagi100 Posted April 7, 2018 Author Share Posted April 7, 2018 2 minutes ago, myonlake said: Make sure you load the file in meta.xml too. <file src="hello.png" /> i do ,the image does showing up but she is not getting out of the screen,i want that i will be only when player join till the map starts for him i saw it in many server. 4 minutes ago, myonlake said: Make sure you load the file in meta.xml too. <file src="hello.png" /> timer is needed? Link to comment
sagi100 Posted April 7, 2018 Author Share Posted April 7, 2018 i need a script of this: when i join the server it will show logo / image / for 7 seconds , and then it will stop auto. By the way , there is the dealy with Link to comment
myonlake Posted April 7, 2018 Share Posted April 7, 2018 (edited) If you only want the player to see it once, then this could work: -- Whenever onClientMapStarting is triggered by mapmanager, execute the function addEventHandler("onClientMapStarting", root, function() -- If the local player has already seen the server logo once, let's not show it again if (getElementData(localPlayer, "hasSeenServerLogo")) then return end -- Let's get our screen dimensions local screenWidth, screenHeight = guiGetScreenSize() -- Let's create a static image element into serverLogo local serverLogo = guiCreateStaticImage(0, 0, 0, 0, "hello.png", false) -- Let's get the native image size local serverLogoWidth, serverLogoHeight = guiStaticImageGetNativeSize(serverLogo) -- Let's center the image guiSetPosition(serverLogo, (screenWidth - serverLogoWidth) / 2, (screenHeight - serverLogoHeight) / 2, false) guiSetSize(serverLogo, serverLogoWidth, serverLogoHeight, false) -- Let's destroy the logo in 7000 ms (7 seconds) setTimer(destroyElement, 7000, 1, serverLogo) -- Let's give the local player hasSeenServerLogo data so they won't see it again setElementData(localPlayer, "hasSeenServerLogo", true) end) Edited April 7, 2018 by myonlake Link to comment
sagi100 Posted April 7, 2018 Author Share Posted April 7, 2018 9 minutes ago, myonlake said: If you only want the player to see it once, then this could work: addEventHandler("onClientMapStarting", root, function() if (getElementData(localPlayer, "hasSeenServerLogo")) then return end local screenWidth, screenHeight = guiGetScreenSize() local serverLogo = guiCreateStaticImage(0, 0, 0, 0, "icon.jpg", false) local serverLogoWidth, serverLogoHeight = guiStaticImageGetNativeSize(serverLogo) guiSetPosition(serverLogo, (screenWidth - serverLogoWidth) / 2, (screenHeight - serverLogoHeight) / 2, false) guiSetSize(serverLogo, serverLogoWidth, serverLogoHeight, false) setTimer(destroyElement, 7000, 1, serverLogo) setElementData(localPlayer, "hasSeenServerLogo", true) end) I already have working code, now i need to know how to make it also when i restart the map or choose map Link to comment
myonlake Posted April 7, 2018 Share Posted April 7, 2018 (edited) If you want the players to see it every time a map starts, then the following could work: -- Let's get our screen dimensions local screenWidth, screenHeight = guiGetScreenSize() -- Save the static image into serverLogo, and the server logo timer into serverLogoTimer local serverLogo, serverLogoTimer -- Whenever onClientMapStarting is triggered by mapmanager, execute the function addEventHandler("onClientMapStarting", root, function() -- If we already have a valid server logo timer, let's kill it if (isTimer(serverLogoTimer)) then killTimer(serverLogoTimer) end -- If we already have a server logo element, let's destroy it if (isElement(serverLogo)) then destroyElement(serverLogo) end -- Let's create a static image element into serverLogo serverLogo = guiCreateStaticImage(0, 0, 0, 0, "hello.png", false) -- Let's get the native image size local serverLogoWidth, serverLogoHeight = guiStaticImageGetNativeSize(serverLogo) -- Let's center the image guiSetPosition(serverLogo, (screenWidth - serverLogoWidth) / 2, (screenHeight - serverLogoHeight) / 2, false) guiSetSize(serverLogo, serverLogoWidth, serverLogoHeight, false) -- Let's destroy the logo in 7000 ms (7 seconds) serverLogoTimer = setTimer(destroyElement, 7000, 1, serverLogo) end) Edited April 7, 2018 by myonlake Link to comment
sagi100 Posted April 7, 2018 Author Share Posted April 7, 2018 4 minutes ago, myonlake said: -- Let's get our screen dimensions local screenWidth, screenHeight = guiGetScreenSize() -- Save the static image into serverLogo, and the server logo timer into serverLogoTimer local serverLogo, serverLogoTimer -- Whenever onClientMapStarting is triggered by race, execute the function addEventHandler("onClientMapStarting", root, function() -- If we already have a valid server logo timer, let's kill it if (isTimer(serverLogoTimer)) then killTimer(serverLogoTimer) end -- If we already have a server logo element, let's destroy it if (isElement(serverLogo)) then destroyElement(serverLogo) end -- Let's create a static image element into serverLogo serverLogo = guiCreateStaticImage(0, 0, 0, 0, "icon.jpg", false) -- Let's get the native image size local serverLogoWidth, serverLogoHeight = guiStaticImageGetNativeSize(serverLogo) -- Let's center the image guiSetPosition(serverLogo, (screenWidth - serverLogoWidth) / 2, (screenHeight - serverLogoHeight) / 2, false) guiSetSize(serverLogo, serverLogoWidth, serverLogoHeight, false) -- Let's destroy the logo in 7000 ms (7 seconds) serverLogoTimer = setTimer(destroyElement, 7000, 1, serverLogo) end) Ty bro do you know how to disable race intro? Link to comment
myonlake Posted April 7, 2018 Share Posted April 7, 2018 If you want to hide the race logo, then in race/race_client.lua file, comment line 84: --g_GUI['titleImage'] = guiCreateStaticImage(screenWidth/2-256, screenHeight/2-256+adjustY, 512, 512, 'img/title.png', false) Link to comment
sagi100 Posted April 7, 2018 Author Share Posted April 7, 2018 16 minutes ago, myonlake said: If you want to hide the race logo, then in race/race_client.lua file, comment line 84: --g_GUI['titleImage'] = guiCreateStaticImage(screenWidth/2-256, screenHeight/2-256+adjustY, 512, 512, 'img/title.png', false) i need to remove this line? Link to comment
myonlake Posted April 7, 2018 Share Posted April 7, 2018 5 minutes ago, sagi100 said: i need to remove this line? Comment line 84 by adding two dashes in front of it "--". You can also delete the line... 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