Hey guys, i have 1 problem, im new at scripting and i want to make something like: this clanwar script is working good, it adds the points automatically, but is there a way to add something like this: 1 point has been added to Team 1( ofc the team who win ) in the chatbox and is there a way to hide everything? i mean score, maps left, players alive, etc. with a bind key? like press f6 for toggle everything( by everything i mean points, players alive etc... ) Please help me, im new at scripting.
Here is the script:
Cliente.lua
----------------- -- Variables ----------------- -- Screensize local screenWidth, screenHeight = guiGetScreenSize() -- GUI Window GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} -- Tags homeTag = "" enemyTag = "" -- Names homeName = "" enemyName = "" -- States mapsLeft = "" warState = "" -- Points points = {} points[1] = 0 points[2] = 0 -- Alive alive = {} alive[1] = 0 alive[2] = 0 Red1 = 0 Green1 = 0 Blue1 = 0 Red2 = 0 Green2 = 0 Blue2 = 1 globalColorRed = 200 globalColorGreen = 200 globalColorBlue = 0 setTimer(function() if Red1 == 1 then globalColorRed = globalColorRed + 10 if globalColorRed >= 200 then Red1 = 0 Green2 = 1 end elseif Red2 == 1 then globalColorRed = globalColorRed - 10 if globalColorRed <= 10 then Red2 = 0 Green1 = 1 end elseif Green1 == 1 then globalColorGreen = globalColorGreen + 10 if globalColorGreen >= 200 then Green1 = 0 Blue2 = 1 end elseif Green2 == 1 then globalColorGreen = globalColorGreen - 10 if globalColorGreen <= 10 then Green2 = 0 Blue1 = 1 end elseif Blue1 == 1 then globalColorBlue = globalColorBlue + 10 if globalColorBlue >= 200 then Blue1 = 0 Red2 = 1 end elseif Blue2 == 1 then if globalColorBlue <= 10 then Blue2 = 0 Red1 = 1 end globalColorBlue = globalColorBlue - 10 end end,50, 0) function drawWartext() -- HomeTeam local homeTeam = getTeamFromName(homeName) local r1,g1,b1 r1, g1, b1 = getTeamColor(homeTeam) dxDrawImage(screenWidth - 90,159.0,63.0,62.0,"red.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawImage(screenWidth - 170,159.0,63.0,62.0,"blue.png",0.0,0.0,0.0,tocolor(255,255,255,200),false) dxDrawText ( ": "..points[1].." :", screenWidth - 158, 180, screenWidth, screenHeight, tocolor( 0, 0 , 0, 255 ), 0.61, "bankgothic" ) dxDrawText ( ": "..points[1].." :", screenWidth - 158, 180, screenWidth, screenHeight, tocolor( 255, 255, 255 ), 0.6, "bankgothic" ) -- EnemyTeam-- local enemyTeam = getTeamFromName(enemyName) local r2,g2,b2 r2, g2, b2 = getTeamColor (enemyTeam) dxDrawText ( ": "..points[2].." :", screenWidth - 78, 180, screenWidth, screenHeight, tocolor( 0, 0 , 0, 255 ), 0.61, "bankgothic" ) dxDrawText ( ": "..points[2].." :", screenWidth - 78, 180, screenWidth, screenHeight, tocolor( 255, 255, 255 ), 0.6, "bankgothic" ) -- Alive dxDrawText ( "~! Alive:", screenWidth - 160, 100, screenWidth, screenHeight, tocolor( 0, 0 , 0, 255 ), 0.61, "bankgothic" ) dxDrawText ( "~! Alive:", screenWidth - 160, 100, screenWidth, screenHeight, tocolor( globalColorRed, globalColorGreen , globalColorBlue ), 0.6, "bankgothic" ) -- Alive Home dxDrawText ( ""..homeTag.."", screenWidth - 160, 115, screenWidth, screenHeight, tocolor( 0, 0 , 0, 255 ), 0.61, "bankgothic" ) dxDrawText ( ""..homeTag.."", screenWidth - 160, 115, screenWidth, screenHeight, tocolor( r1, g1, b1 ), 0.6, "bankgothic" ) dxDrawText ( ":"..alive[1].."", screenWidth - 55, 115, screenWidth, screenHeight, tocolor( 0, 0 , 0, 255 ), 0.61, "bankgothic" ) dxDrawText ( ":"..alive[1].."", screenWidth - 55, 115, screenWidth, screenHeight, tocolor( r1, g1, b1 ), 0.6, "bankgothic" ) -- Alive Enemy dxDrawText ( ""..enemyTag.."", screenWidth - 160, 130, screenWidth, screenHeight, tocolor( 0, 0 , 0, 255 ), 0.61, "bankgothic" ) dxDrawText ( ""..enemyTag.."", screenWidth - 160, 130, screenWidth, screenHeight, tocolor( r2, g2, b2 ), 0.6, "bankgothic" ) dxDrawText ( ":"..alive[2].."", screenWidth - 55, 130, screenWidth, screenHeight, tocolor( 0, 0 , 0, 255 ), 0.61, "bankgothic" ) dxDrawText ( ":"..alive[2].."", screenWidth - 55, 130, screenWidth, screenHeight, tocolor( r2, g2, b2 ), 0.6, "bankgothic" ) -- States if warState == "Waiting" then -- setstate waiting dxDrawText ( "Training", screenWidth - 440, 85, screenWidth, screenHeight, tocolor( 0, 0 , 0, 255 ), 0.61, "bankgothic" ) dxDrawText ( "Training", screenWidth - 440, 85, screenWidth, screenHeight, tocolor( 255, 10, 128 ), 0.6, "bankgothic" ) dxDrawText ( "T!me", screenWidth - 430, 100, screenWidth, screenHeight, tocolor( 0, 0 , 0, 255 ), 0.61, "bankgothic" ) dxDrawText ( "T!me", screenWidth - 430, 100, screenWidth, screenHeight, tocolor( 255, 10, 128 ), 0.6, "bankgothic" ) end if warState == "Running" then -- setstate running dxDrawText ( "WaR TiMe", screenWidth - 440, 100, screenWidth, screenHeight, tocolor( 0, 0 , 0, 255 ), 0.61, "bankgothic" ) dxDrawText ( "WaR TiMe", screenWidth - 440, 100, screenWidth, screenHeight, tocolor( 135, 247, 23 ), 0.6, "bankgothic" ) end if warState == "Ended" then -- setstate ended dxDrawText ( "WaR Ended", screenWidth - 440, 100, screenWidth, screenHeight, tocolor( 0, 0 , 0, 255 ), 0.61, "bankgothic" ) dxDrawText ( "WaR Ended", screenWidth - 440, 100, screenWidth, screenHeight, tocolor( 255, 0, 0 ), 0.6, "bankgothic" ) end -- Maps left (double lines state) if warState == "Starting" or warState == "Waiting" then dxDrawText ( "Maps Left", screenWidth - 160, 250, screenWidth, screenHeight, tocolor( 0, 0, 0, 255 ), 0.61, "bankgothic" ) dxDrawText ( "Maps Left", screenWidth - 160, 250, screenWidth, screenHeight, tocolor( 255, 255, 255 ), 0.6, "bankgothic" ) dxDrawText ( ":"..tostring(left).."", screenWidth - 55, 250, screenWidth, screenHeight, tocolor( globalColorRed, globalColorGreen , globalColorBlue, 255 ), 0.61, "bankgothic" ) dxDrawText ( ":"..tostring(left).."", screenWidth - 55, 250, screenWidth, screenHeight, tocolor( globalColorBlue, globalColorGreen , globalColorRed ), 0.6, "bankgothic" ) else -- Singe line state dxDrawText ( "Maps Left :", screenWidth - 160, 250, screenWidth, screenHeight, tocolor( 0, 0, 0, 255 ), 0.61, "bankgothic" ) dxDrawText ( "Maps Left :", screenWidth - 160, 250, screenWidth, screenHeight, tocolor( 255, 255, 255 ), 0.6, "bankgothic" ) dxDrawText ( ":"..tostring(left).."", screenWidth - 55, 250, screenWidth, screenHeight, tocolor( globalColorRed, globalColorGreen , globalColorBlue, 255 ), 0.61, "bankgothic" ) dxDrawText ( ":"..tostring(left).."", screenWidth - 55, 250, screenWidth, screenHeight, tocolor( globalColorBlue, globalColorGreen , globalColorRed ), 0.6, "bankgothic" ) end end function updatedPoints() -- Keeps points/stats updated all the time points[1] = getElementData(getTeamFromName(homeName), "points") points[2] = getElementData(getTeamFromName(enemyName), "points") alive[1] = getElementData(getTeamFromName(homeName), "alive") alive[2] = getElementData(getTeamFromName(enemyName), "alive") warState = getElementData(getTeamFromName(homeName), "warState") left = getElementData(getTeamFromName(homeName), "left") end -- Resource loaded&started addEventHandler("onClientResourceStart",getRootElement(), function(startedRes) if getResourceName(getThisResource()) == getResourceName(startedRes) then triggerServerEvent("updateNameServer", getRootElement(), getLocalPlayer()) end end ) addEvent("updateName", true) addEventHandler("updateName", getRootElement(), function(hname, htag, ename, etag) -- Variables instellen homeName = hname homeTag = htag enemyName = ename enemyTag = etag -- Eventhandlers addEventHandler("onClientRender",getRootElement(), updatedPoints) addEventHandler("onClientRender",getRootElement(), drawWartext) -- Window starten drawTeamWindow() end ) function onresourceStart () bindKey ("F2", "down", showU) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) function showU () guiSetVisible(Window, true) showCursor(true) end function drawTeamWindow() -- Window local left = screenWidth/2 - 330/2 local top = screenHeight/2 - 198/2 Window = guiCreateWindow(left,top,308,237,"Race Clan WaR",false) showCursor(true) -- Buttons --Button_home = guiCreateButton(23,105,133,51,tostring(homeName),false,Window) --Button_enemy = guiCreateButton(163,105,133,51,tostring(enemyName),false,Window) Button_specators = guiCreateButton(21,171,271,57,"Spectators",false,Window) -- Text GUIEditor_Label[1] = guiCreateLabel(62,42,223,52,"Select Yor Team",false,Window) guiLabelSetColor(GUIEditor_Label[1],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) guiSetFont(GUIEditor_Label[1],"sa-header") Button_home = guiCreateButton(23,105,133,51,tostring(homeName),false,Window) Button_enemy = guiCreateButton(163,105,133,51,tostring(enemyName),false,Window) -- Button handlers addEventHandler("onClientGUIClick", Button_home, joinHomeTeam) addEventHandler("onClientGUIClick", Button_enemy, joinEnemyTeam) addEventHandler("onClientGUIClick", Button_specators, joinSpectatorsTeam) addEventHandler("onClientGUIClick", start1, start) addEventHandler("onClientGUIClick", ende1, ende) addEventHandler("onClientGUIClick", setmap, map2) addEventHandler("onClientGUIClick", setred, red2) addEventHandler("onClientGUIClick", setblue, blue2) end function joinHomeTeam() guiSetVisible(Window, false) showCursor(false) -- Window closed localPlayer = getLocalPlayer() triggerServerEvent("joinHomeTeam", getRootElement(), localPlayer) end function joinEnemyTeam() guiSetVisible(Window, false) showCursor(false) -- Window closed localPlayer = getLocalPlayer() triggerServerEvent("joinEnemyTeam", getRootElement(), localPlayer) end function joinSpectatorsTeam() guiSetVisible(Window, false) showCursor(false) -- Window closed localPlayer = getLocalPlayer() triggerServerEvent("joinSpectatorsTeam", getRootElement(), localPlayer) end addEvent("ShowGUI", true) function ShowGUI () getVisible = guiGetVisible (win1) playerName = getPlayerName ( getLocalPlayer() ) if (getVisible == true) then guiSetVisible (win1, false) guiSetVisible (win2, false) showCursor (false) end if (getVisible == false) then guiSetVisible (win1, true) guiSetVisible (win2, true) showCursor (true) end end addEventHandler ( "ShowGUI", getRootElement(), ShowGUI ) win1 = guiCreateWindow(235,191,96,108,"Start The War",false)