Jump to content

FlyingSpoon

Members
  • Posts

    749
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by FlyingSpoon

  1. Basically what I want to do is, I want to set that the main chat is only for a certain number of players, so if players in the lobby they can only see the chat, as I am making a global chat and seperating it from this.
  2. Ok I tweaked my code a little, still I got an error - function onJoin() if source then setElementData(source, "Local", source) outputChatBox("True", root) else outputChatBox("False", root) end end addEventHandler("onResourceStart", root, onJoin) addCommandHandler("test", onJoin) local function playerChat(message, messageType, player) if messageType == 0 then cancelEvent() outputChatBox("(Local)".. getPlayerName(source)..": #ffffff", getElementByID(getElementData(source, "Local")), 255, 255, 255) outputServerLog("CHAT: "..getPlayerName(source)..": "..message)- end end addEventHandler("onPlayerChat", root, playerChat)
  3. function checkDimension() if ( getElementDimension ( source ) == 0 ) then setElementData(source, "Arena") end end addEventHandler("onResourceStart", root, checkDimension) addEventHandler("onPlayerJoin", root, checkDimension) function arenaChat(m) outputChatBox("(Local) "..getPlayerName(source)..": #ffffff"..m, getElementByID(getElementData(source, "Arena")), 255, 255, 255, true) outputServerLog("CHAT: "..getPlayerName(source)..": "..m," ") end addEventHandler( "onPlayerChat", root, arenaChat ) SERVER SIDED Bad argument @'getElementByID' [Expected string at argument 1, got boolean] Bad argument @'outputChatBox' [Expected element at argument 2, got boolean]
  4. function clickPlant(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) if button == 'left' and state == 'down' then local px, py, pz = getElementPosition(localPlayer) for i,v in ipairs(getElementsByType("object")) do if getElementData(v, "dbid") then if getElementData(v, "hours") then local x, y, z = getElementPosition(v) local distance = getDistanceBetweenPoints3D(x, y, z, worldX, worldY, worldZ) if distance <= 0.3 then stage = getElementData(v, "stage") harvest = getElementData(v, "harvest") dbid = getElementData(v, "dbid") cCheckPlant() end end end end end end addEventHandler('onClientClick', root, clickPlant) local checkPlantGUI = nil function cCheckPlant() if checkPlantGUI == nil then checkPlantGUI = checkPlantGUI local lplayer = getLocalPlayer() local width, height = 150, 175 local scrWidth, scrHeight = guiGetScreenSize() local x = scrWidth/2 - (width/2) local y = scrHeight/2 - (height/2) plantWindow = guiCreateWindow(x, y, width, height, "Cannabis Plant - Stage: " .. stage .. "", false) local width2, height2 = 10, 10 local x = scrWidth/2 - (width2/2) local y = scrHeight/2 - (height2/2) harvest = guiCreateLabel(0.1, 0.1, 0.75, 0.30, "Current Harvest: ".. harvest .."gram(s)", true, plantWindow) guiLabelSetHorizontalAlign(harvest, "center", true) guiLabelSetVerticalAlign(harvest, "center") --Buttons pick = guiCreateButton(0.1, 0.4, 0.75, 0.30, "Pick Buds", true, plantWindow) addEventHandler("onClientGUIClick", pick, harvestBud) close = guiCreateButton(0.1, 0.7, 0.75, 0.30, "Close", true, plantWindow) addEventHandler("onClientGUIClick", close, closeWindow) --Quick Settings guiWindowSetSizable(plantWindow, false) guiWindowSetMovable(plantWindow, true) guiSetVisible(plantWindow, true) showCursor(true) end end addEvent("cCheckPlant", true) addEventHandler("cCheckPlant", getRootElement(), cCheckPlant) function harvestBud() if (source==pick) then triggerServerEvent("harvestPlant", localPlayer, localPlayer, dbid) showCursor(false) destroyElement(plantWindow) checkPlantGUI = nil end end function closeWindow() if (source==close) then showCursor(false) destroyElement(plantWindow) toggleAllControls(true) triggerEvent("onClientPlayerWeaponCheck", localPlayer) checkPlantGUI = nil end end Client Side -- It's meant to open a GUI once clicked on object, but it doesn't. Any ideas? I spent hours trying to fix it.
  5. Hi there, I developed and worked on a gamemode, me and a friend made on Windows. But when we test on Linux, it doesn't work as good, and is buggy? And ideas? How we can make the scripts work like on Windows?
  6. I realized even Vortex has started doing Linux Servers, I really need a Windows Gameserver. Anyone?
  7. Don't understand what you mean? Can you develop further if possible.
  8. CLIENT SIDE sx,sy = guiGetScreenSize () addEvent ("onNotificationWindowHide",false) addEvent ("onNotificationWindowShow",false) box = false function showBox(value, str) -- value 1 - Info -- value 2 - Error -- value 3 - warning --if box == false then if str and type(str) == "string" and string.len(str) > 0 then box = true if value == "info" then showTipBox (str,"img/info.png") outputConsole ("[iNFO]" .. 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 --else -- return false --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 = -180 tipBox.stopY = 30 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) local screenW, screenH = guiGetScreenSize() 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 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 = 512 local x,y = sx/0.85 - width/0.85, tipBox.currentY local textX,textY = x+15,tipBox.currentY+5 local textWidth,textHeight = 363,106 dxDrawRectangle(x,y, screenW * 0.2632, screenH * 0.0859, tocolor(0, 0, 0, 150), false) dxDrawRectangle(x,y, screenW * 0.0051, screenH * 0.0859, tocolor(36, 112, 36,150), false) --dxDrawImage (x,y,width,256,tipBox.path,0,0,0,tocolor(255,255,255),true) dxDrawText (tipBox.string,textX,textY,textX+textWidth,textY+textHeight,tocolor(222,222,222),1,"arial","left", "top",false,true,true) end end end ) SERVER SIDE function showBox(player, value, str) if isElement(player) then triggerClientEvent(player, "CreateBox", getRootElement(), value, str) end end I have adjusted/modified and adapted by creating a notification system but players have reported that they don't see it. I seem to see it perfectly in all resolutions. Any help?
  9. Nevermind I found out that my problem was I was using setAccountData, and doing getElementData, but how can I make getElementData permanent like save it, so player still has it after reconnect?
  10. I dont need client renders, I wanted to know if that was the right way to refresh the element data, I have my renders already.
  11. I made a custom scoreboard, and I have set element data's but I am trying to refresh it on my scoreboard, because if player changes class then it should change on scoreboard - I get no errors - Client Side function refresh() data = getElementData(getLocalPlayer(), "Class") end setTimer ( refresh, 51, 0 ) dxDrawText(data, classx, y+i*20.5) It's frozen as the previous class and doesnt change
  12. Really nice, keep it up !
  13. Hey there, I bought a VPS last month but I forgot to turn off recurring payment, so it has paid this month as well, it's going to end next month. Specifications: RAM: 3 GB Disk: 100 GB OS: Linux (Running: Ubuntu 14.04 x86_64) Bandwidth: 10 TB DDoS Protection: 10 GBps Location: Romania First payment is $25.00 then its $9/mo.
  14. I am using the HDD as an internal HDD for my PC, so I have 2 HDD's now.
  15. No, make like blur around the gui, not inside.
  16. Hi, I want to make, like when I open a gui or make a DX Window Like it blur's the background of blur of player. How can I do this?
  17. Hey there, I am using the basic way to set for all screens - local sx,sy = guiGetScreenSize() local px,py = 1024,760 local x,y = (sx/px), (sy/py) GUIEditor.staticimage[2] = guiCreateStaticImage(x*300, y*250, x*420, y*240, "img/login.png", false) It works great on my screen, but for others it comes out weird. Any way I can fix this? When I try with his resolution 1600x900 it comes out weird on my screen. Any solutions?
  18. Thanks, Instead I used a function todo with Playtime, so it checks if the player's play time is 0 and then says this as a New Player, and so on. Really helpful though. Thanks!
  19. No point now , I threw it away. It was useless. Worked for a good 4 months then motherboard stop responding.
  20. I want to check and see if a new player registered, how would I do it? Because I want to give money if it's a new player registered. But on my login, you register then it takes you back to login and press login. If anyone can help it'll be helpful!
  21. Should I do 'lefftime' in there then?
  22. screenX,screenY = guiGetScreenSize() local function renderCountdown ( ) local lefttime = endtime - getTickCount() local minutesleft = math.floor ( lefttime / 60000 ) local secondsleft = math.floor ( ( lefttime - minutesleft * 60000 ) / 1000 ) local timet = minutesleft..":"..secondsleft >= 10 and secondsleft or "0"..secondsleft if lefttime > 0 then dxDrawText(math.ceil ( timet ), screenX * .48, screenY * .1, screenX, screenY, tocolor(255,255,255), 2) elseif lefttime >= -3000 then dxDrawText("GO!", screenX * .48, screenY * .1, screenX, screenY, tocolor(255,255,255), 2) else removeEventHandler ( "onClientRender", root, renderCountdown ) end end addCommandHandler ( "timer", function ( _, timeinsec ) endtime = getTickCount() + tonumber ( timeinsec ) * 1000 addEventHandler ( "onClientRender", root, renderCountdown ) end ) I did this but it don't work.
  23. How can I now convert this into Minutes only, I know it's / 1000 but how would I go about doing it. Like countdown: 2:00 .. 1:59 .. 1:58 etc
×
×
  • Create New...