Turbesz Posted August 27, 2016 Posted August 27, 2016 no errors, but not working, why? --client local x, y = guiGetScreenSize() local font_os = (x/1600+y/900)/2 local font = font_os*1 local nSpaceY = dxGetFontHeight(font, "default-bold") local nSpaceYOld = dxGetFontHeight(2, "default-bold") local szovegek = {} for i=0, 4, 1 do szovegek[i] = "" end function itsRenderTime() for i = 0, 4, 1 do if szovegek[i] then local topSpaceX = dxGetTextWidth(szovegek[i]:gsub("#%x%x%x%x%x%x",""),font,"default-bold") local webX=topSpaceX+font_os*10 dxDrawRectangle ( x-webX-font_os*5, nSpaceYOld*2+font_os*8+nSpaceY*(4-i)+font_os*(4-i), webX, nSpaceY+font_os*4, tocolor ( 0, 0, 0, 155 ) ) dxDrawEmptyRec ( x-webX-font_os*5, nSpaceYOld*2+font_os*8+nSpaceY*(4-i)+font_os*(4-i), webX, nSpaceY+font_os*4, tocolor ( 255, 255, 255, 200 ), 2 ) dxDrawText ( szovegek[i], x-webX, nSpaceYOld*2+font_os*10+nSpaceY*(4-i)+font_os*(4-i), topSpaceX, nSpaceY, tocolor ( 255, 255, 255, 255 ), font, "default-bold", "left", "top",true,false,false,true ) end end end addEventHandler("onClientRender", getRootElement(), itsRenderTime) function infoServer2(szoveg) for i = 3, 0, -1 do szovegek[i+1] = szovegek[i] end szovegek[0] = szoveg end addEvent("infoServer2", true) addEventHandler("infoServer2",getRootElement(), infoServer2) function dxDrawEmptyRec(absX,absY,sizeX,sizeY,color,ancho) dxDrawRectangle ( absX,absY,sizeX,ancho,color ) dxDrawRectangle ( absX,absY+ancho,ancho,sizeY-ancho,color ) dxDrawRectangle ( absX+ancho,absY+sizeY-ancho,sizeX-ancho,ancho,color ) dxDrawRectangle ( absX+sizeX-ancho,absY+ancho,ancho,sizeY-ancho*2,color ) end local aValto = true function azEltunteto() if aValto then aValto = false removeEventHandler ( "onClientRender", root, itsRenderTime ) else aValto = true addEventHandler ( "onClientRender", root, itsRenderTime ) end end bindKey("delete","down",azEltunteto) --server addEventHandler('onClientPlayerJoin', root, function() szovegek[i] = ('* ' .. getPlayerName(source) .. ' has joined the game', 255, 100, 100) triggerClientEvent ( source, "infoServer2" ) end ) addEventHandler('onClientPlayerChangeNick', root, function(oldNick, newNick) szovegek[i] = ('* ' .. oldNick .. ' is now known as ' .. newNick, 255, 100, 100) triggerClientEvent ( source, "infoServer2" ) end ) addEventHandler('onClientPlayerQuit', root, function(reason) szovegek[i] = ('* ' .. getPlayerName(source) .. ' has left the game [' .. reason .. ']', 255, 100, 100) triggerClientEvent ( source, "infoServer2" ) end ) What if the only way not to feel bad, is to stop feeling, anything at all, forever? - Hannah Baker I cost a girl her life because I was afraid to love her... - Clay Jensen ~ 13 Reasons Why
KariiiM Posted August 27, 2016 Posted August 27, 2016 onClientPlayerJoin and onClientPlayerQuit are client events, they cant be used at server side.
Turbesz Posted August 27, 2016 Author Posted August 27, 2016 onClientPlayerJoin and onClientPlayerQuit are client events, they cant be used at server side. Oh.. rly but I rewrote but not good /sorry for my bad english/ local szovegek = {} addEventHandler('onPlayerChangeNick', root, function(oldNick, newNick) szovegek[i] = ('* ' .. oldNick .. ' is now known as ' .. newNick, 255, 100, 100) triggerClientEvent("infoServer2", source) end ) ')' expected near ',' What if the only way not to feel bad, is to stop feeling, anything at all, forever? - Hannah Baker I cost a girl her life because I was afraid to love her... - Clay Jensen ~ 13 Reasons Why
EstrategiaGTA Posted August 27, 2016 Posted August 27, 2016 What is i and why do you want to store that message in a table?
Turbesz Posted August 27, 2016 Author Posted August 27, 2016 What is i and why do you want to store that message in a table? i is the dx joinquit message, but doesn't working What if the only way not to feel bad, is to stop feeling, anything at all, forever? - Hannah Baker I cost a girl her life because I was afraid to love her... - Clay Jensen ~ 13 Reasons Why
Turbesz Posted August 27, 2016 Author Posted August 27, 2016 What is the solution ? What if the only way not to feel bad, is to stop feeling, anything at all, forever? - Hannah Baker I cost a girl her life because I was afraid to love her... - Clay Jensen ~ 13 Reasons Why
MTA Team qaisjp Posted August 27, 2016 MTA Team Posted August 27, 2016 onClientPlayerJoin and onClientPlayerQuit are client events, they cant be used at server side. Oh.. rly but I rewrote but not good /sorry for my bad english/ local szovegek = {} addEventHandler('onPlayerChangeNick', root, function(oldNick, newNick) szovegek[i] = ('* ' .. oldNick .. ' is now known as ' .. newNick, 255, 100, 100) triggerClientEvent("infoServer2", source) end ) ')' expected near ',' The issue here is szovegek[i] = ('* ' .. oldNick .. ' is now known as ' .. newNick, 255, 100, 100) You must use { and } to create a table to store those arguments. Try szovegek[i] = { .. contents here .. } instead. To use the result, do this: local result = szovegek[i] outputChatBox(unpack(result)) The "unpack" function will expand a table like `{value1, value2}` into arguments `value1, value2` (and so on)
Turbesz Posted August 27, 2016 Author Posted August 27, 2016 onClientPlayerJoin and onClientPlayerQuit are client events, they cant be used at server side. Oh.. rly but I rewrote but not good /sorry for my bad english/ local szovegek = {} addEventHandler('onPlayerChangeNick', root, function(oldNick, newNick) szovegek[i] = ('* ' .. oldNick .. ' is now known as ' .. newNick, 255, 100, 100) triggerClientEvent("infoServer2", source) end ) ')' expected near ',' The issue here is szovegek[i] = ('* ' .. oldNick .. ' is now known as ' .. newNick, 255, 100, 100) You must use { and } to create a table to store those arguments. Try szovegek[i] = { .. contents here .. } instead. To use the result, do this: local result = szovegek[i] outputChatBox(unpack(result)) The "unpack" function will expand a table like `{value1, value2}` into arguments `value1, value2` (and so on) ERROR: xy\server.lua:3: bad argument #1 to 'unpack' (table expected, got nil) but why? What if the only way not to feel bad, is to stop feeling, anything at all, forever? - Hannah Baker I cost a girl her life because I was afraid to love her... - Clay Jensen ~ 13 Reasons Why
Turbesz Posted August 27, 2016 Author Posted August 27, 2016 Anyone can help ? What if the only way not to feel bad, is to stop feeling, anything at all, forever? - Hannah Baker I cost a girl her life because I was afraid to love her... - Clay Jensen ~ 13 Reasons Why
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