
Dice
Members-
Posts
103 -
Joined
-
Last visited
Everything posted by Dice
-
addEventHandler ( "onClientResourceStart", localPlayer, hide ) addEventHandler ( "onClientResourceStart", localPlayer, jump ) Is this recommended ? Having 2 event handlers for other functions?
-
@ IIYAMA You can't do that when the function is embedded....but thanks you gave me another idea. Snake I didn't even know that function existed so thanks lol. figured it out.
-
addEventHandler ( "onClientGUIMouseDown", root, dragDown ) -- < that is embedded within onClientResourceStart because that is where GUI variables are function dragDown ( button, x, y ) if button == "left" then if source == main then outputChatBox ( "124" ) wX, wY = guiGetPosition ( maun, false ) z = x - wX s = y - wY addEventHandler ( "onClientCursorMove", root, function(_,_,a,b) if ftamainp then guiSetPosition ( main, a - z, b - s, false ) end end ) end end end It works, but I can't figure out how to remove the onClientCursorMove when onClientGUIMouseUp
-
I can't move it around like a window becuase it says the down STATE is not working
-
I tried that but it keeps pissing me off
-
Hello again, I am currently using an image as a template and I am curious how to make a image movable, pretty much treat it like if it were a window.
-
Hi, I am curious to know what functions I would use if lets say I have a GUI box , an EDIT and a Button, in the edit you put in a URL of any image link from the web. and when you press ok, it shows the image or pops up anywhere on the screen. I saw something like this in a server once, but I am not sure how to make it show or connect to the web.
-
Nope, only thing is the other person only gets the message if the window with you is already open, if he doesn't have a little chat window open, and I send the person a message, it will not open the chat window on the targetplayers side, like I said unless his chat window is already open.
-
ok here is what I have so far, I fixed that issue only problem is the person receiving the message is not getting the GUI.. idk y, nothing happens. ---Client function buildChatWnd () local row, col = guiGridListGetSelectedItem ( playerlist ) if ( row and col and row ~= -1 and col ~= -1 ) then playerName = guiGridListGetItemText ( playerlist, row, 1 ) player = getPlayerFromName ( playerName ) if ( player ) and ( player ~= getPlayerName ( getLocalPlayer() ) ) then --Check recheck if not chats [ player ] then chats [ player ] = { } chats [ player ].window = guiCreateWindow(889, 491, 342, 298, getPlayerName ( player ), false) guiWindowSetSizable(chats [ player ].window, false) chats [ player ].memo = guiCreateMemo(14, 45, 312, 206, "", false, chats [ player ].window) guiMemoSetReadOnly(chats [ player ].memo, true) chats [ player ].edit = guiCreateEdit(14, 261, 227, 26, "", false, chats [ player ].window) chats [ player ].send = guiCreateButton(248, 260, 78, 27, "Send", false, chats [ player ].window) chats [ player ].close = guiCreateButton(314, 23, 18, 18, "X", false, chats [ player ].window) addEventHandler( "onClientGUIAccepted", chats [ player ].edit, msgwino ) addEventHandler ( "onClientGUIClick", chats [ player ].send, msgwino ) addEventHandler ( "onClientGUIClick", chats [ player ].close, function ( ) _destroyElement ( chats [ player ].window ) chats [ player ] = nil end ,false ) end end end end function msgwino () ---Send the message pls if not chats [ player ] then buildChatWnd ( player ) end newText = guiGetText( chats [ player ].edit ) if newText and string.len(newText) > 0 then local oldText = guiGetText(chats [ player ].memo) if not oldText then oldText = "" end oldText = oldText .. getPlayerName(localPlayer) .. ": " .. newText .. "\n" guiSetText(chats [ player ].memo, oldText) guiSetText(chats [ player ].edit, "") guiMemoSetCaretIndex(chats [ player ].memo, string.len(oldText)) triggerServerEvent("sMsg", localPlayer, player, newText) end end --Server function servmsg ( player, chat ) outputChatBox ( getPlayerName ( player ) ) triggerClientEvent ( player, "rMsg", source, source, chat ) end addEvent ( "sMsg", true ) addEventHandler ( "sMsg", root, servmsg ) --Client ---get the message who ever you sent it to. function receivedMsg ( player, chat ) if not chats [ player ] then buildChatWnd () end local oldText = guiGetText(chats [ player ].memo) if not oldText then oldText = "" end oldText = oldText .. getPlayerName( player ) .. ": " .. chat .. "\n" guiSetText(chats [ player ].memo, oldText) guiMemoSetCaretIndex(chats [ player ].memo, string.len(oldText)) end addEvent ( "rMsg", true ) addEventHandler ( "rMsg", root, receivedMsg )
-
function buildChatWnd () local row, col = guiGridListGetSelectedItem ( playerlist ) if ( row and col and row ~= -1 and col ~= -1 ) then local playerName = guiGridListGetItemText ( playerlist, row, 1 ) local player = getPlayerFromName ( playerName ) if ( player ) and ( player ~= getPlayerName ( getLocalPlayer() ) ) then --Check recheck if not chats [ player ] then chats [ player ] = { } chats [ player ].window = guiCreateWindow(889, 491, 342, 298, getPlayerName ( localPlayer ), false) guiWindowSetSizable(chats [ player ].window, false) chats [ player ].memo = guiCreateMemo(14, 45, 312, 206, "", false, chats [ player ].window) guiMemoSetReadOnly(chats [ player ].memo, true) chats [ player ].edit = guiCreateEdit(14, 261, 227, 26, "", false, chats [ player ].window) chats [ player ].send = guiCreateButton(248, 260, 78, 27, "Send", false, chats [ player ].window) chats [ player ].close = guiCreateButton(314, 23, 18, 18, "X", false, chats [ player ].window) addEventHandler ( "onClientGUIClick", chats [ player ].send, msgwino ) addEventHandler ( "onClientGUIClick", chats [ player ].close, function ( ) _destroyElement ( chats [ player ].window ) chats [ player ] = nil end ,false ) end end end end function msgwino () if not chats [ player ] then buildChatWnd ( player ) end newText = guiGetText( chats [ player ].edit ) if newText and string.len(newText) > 0 then local oldText = guiGetText(chats [ player ].memo) if not oldText then oldText = "" end oldText = oldText .. getPlayerName(localPlayer) .. ": " .. newText .. "\n" guiSetText(chats [ player ].memo, oldText) guiSetText(chats [ player ].edit, "") guiMemoSetCaretIndex(chats [ player ].memo, string.len(oldText)) triggerServerEvent("sMsg", localPlayer, player,newText) end end function receivedMsg ( player, chat ) if not chats [ player ] then buildChatWnd ( player ) end local oldText = guiGetText(chats [ player ].memo) if not oldText then oldText = "" end oldText = oldText .. getPlayerName( player ) .. ": " .. chat .. "\n" guiSetText(chats [ player ].memo, oldText) guiMemoSetCaretIndex(chats [ player ].memo, string.len(oldText)) end addEvent ( "rMsg", true ) addEventHandler ( "rMsg", root, receivedMsg ) Line 33 ^ keeps giving me that Attempt to Index Field a nil value -.- pls he;p
-
No no, thanks, but what I mean is let's say someone lives in a place where the time is Eastern Time, so they do !Eastern Time and the time for Eastern time show's up? something like that? if it is possible
-
What? No i want the math or how I can get central time , or how I can do it.
-
how can I make a script to show the realtime, i Know getRealtTime() but how can I get , let's say, Central Time, so I can display it on the server.
-
ow ok and was talking about the length operator (#) <---hash tag ty
-
ffs finally lol thanks a bunch!!! 2 Random questions, what is the hash tag for? when i see it on things like for example #players or #elements and difference between ipairs and pairs? thanks a lot!
-
addEventHandler("onClientResourceStart", resourceRoot, function() pmmain = guiCreateWindow(1020, 410, 253, 398, "", false) guiWindowSetSizable(pmmain, false) playerlist = guiCreateGridList(10, 68, 234, 277, false, pmmain) pcolumn = guiGridListAddColumn(playerlist, "Player List", 0.9) pmbut = guiCreateButton(20, 357, 80, 27, "Msg", false, pmmain) notifychk = guiCreateCheckBox(130, 360, 93, 21, "sound", true, false, pmmain) ftalabel = guiCreateLabel(42, 40, 170, 18, "pm system", false, pmmain) guiSetFont(ftalabel, "clear-normal") playerName = guiGridListGetItemText ( playerlist, guiGridListGetSelectedItem ( playerlist ), 1 ) for id, player in ipairs ( getElementsByType ( "player" ) ) do guiGridListSetItemText ( playerlist, guiGridListAddRow ( playerlist ), pcolumn, getPlayerName ( player ), false, false ) end -- addEventHandler( "onClientGUIDoubleClick", playerlist, msgwino, false ) -- guiSetVisible ( pmmain, false ) end ) chats = { } function msgwino () local row, col = guiGridListGetSelectedItem ( playerlist ) if ( row and col and row ~= -1 and col ~= -1 ) then local playerName = guiGridListGetItemText ( playerlist, row, 1 ) local player = getPlayerName ( getPlayerFromName ( playerName ) ) if ( player ) then chats [ player ] = { } chats [ player ].window = guiCreateWindow(889, 491, 342, 298, "PM with: " ..playerName, false) guiWindowSetSizable(chats [ player ].window, false) chats [ player ].memo = guiCreateMemo(14, 45, 312, 206, "", false, chats [ player ].window) guiMemoSetReadOnly(chats [ player ].memo, true) chats [ player ].edit = guiCreateEdit(14, 261, 227, 26, "", false, chats [ player ].window) guiSetProperty(chats [ player ].edit, "NormalTextColour", "FF7F7F7F") chats [ player ].send = guiCreateButton(248, 260, 78, 27, "Send", false, chats [ player ].window) chats [ player ].close = guiCreateButton(314, 23, 18, 18, "X", false, chats [ player ].window) addEventHandler ( "onClientGUIClick", chats [ player ].close, function ( ) _destroyElement ( chats [ player ].window ) end ,false ) end end end bindKey ( "F3", "down", function () if (guiGetVisible(pmmain) == false) then guiSetVisible ( pmmain, true ) showCursor( guiGetVisible( pmmain ) ) guiSetInputEnabled(true) toggleAllControls( false ) else guiSetVisible ( pmmain, false ) showCursor( guiGetVisible( pmmain ) ) guiSetInputEnabled( false ) toggleAllControls( true ) end end ) btw the one u just gave me i removed it, when i messed up trying different stuff
-
It still doesn't work, my main window disappears just fine, but those little pm windows won't , i tried some stuff of my own too but nothing. only positive thing is that the error is gone
-
sorry i didn't post 100 percent of the client script but, anways there is a bind to close and open the PM main window that has a list of all the players, on top of that i want to make it so if i press the bind (which i already have 'f3' ) the little PM window's closes also, all the ones that are open which is the chats [ player ].window <---those are the little pm windows. anyways when i press the bind is where i get that error. 'attempt to index fields ? a nil value'
-
This is what I have so far. chats = { } function msgwino () local row, col = guiGridListGetSelectedItem ( playerlist ) if ( row and col and row ~= -1 and col ~= -1 ) then local playerName = guiGridListGetItemText ( playerlist, row, 1 ) local player = getPlayerName ( getPlayerFromName ( playerName ) ) if ( player ) then chats [ player ] = { } chats [ player ].window = guiCreateWindow(889, 491, 342, 298, "PM with: " ..playerName, false) guiWindowSetSizable(chats [ player ].window, false) chats [ player ].memo = guiCreateMemo(14, 45, 312, 206, "", false, chats [ player ].window) guiMemoSetReadOnly(chats [ player ].memo, true) chats [ player ].edit = guiCreateEdit(14, 261, 227, 26, "", false, chats [ player ].window) guiSetProperty(chats [ player ].edit, "NormalTextColour", "FF7F7F7F") chats [ player ].send = guiCreateButton(248, 260, 78, 27, "Send", false, chats [ player ].window) chats [ player ].close = guiCreateButton(314, 23, 18, 18, "X", false, chats [ player ].window) addEventHandler ( "onClientGUIClick", chats [ player ].close, function ( ) _destroyElement ( chats [ player ].window ) end ,false ) end end end function openpm () if (guiGetVisible(pmmain) == false) then guiSetVisible ( pmmain, true ) guiSetVisible ( chats [ player ].window, true ) showCursor( guiGetVisible( pmmain ) ) guiSetInputEnabled(true) toggleAllControls( false ) else guiSetVisible ( pmmain, false ) guiSetVisible ( chats [ player ].window, false ) showCursor( guiGetVisible( pmmain ) ) guiSetInputEnabled( false ) toggleAllControls( true ) end end I know they are local, but this is where i had it before trying a whole bunch of shit, i tried making them global, even passing the variables onto openpm() , this is driving me nuts, last time i tries to get involved with tables i nearly fucked my screen -.-. i am so lost with this part
-
thank you works really good now pls! but why when i try to let's say set the visibility of the to false it gives me an error 'attempt to index fields ? a nil value' sorry my experience with tables are really shitty. function openpm () if (guiGetVisible(pmmain) == false) then guiSetVisible ( pmmain, true ) guiSetVisible ( chats [ player ].window, true ) --ISSUE HEREpls showCursor( guiGetVisible( pmmain ) ) guiSetInputEnabled(true) toggleAllControls( false ) else guiSetVisible ( pmmain, false ) guiSetVisible ( chats [ player ].window, false ) --nhere pls showCursor( guiGetVisible( pmmain ) ) guiSetInputEnabled( false ) toggleAllControls( true ) end end
-
Thanks this worked! all I need help with is that The issue we were talking about with tables, I have always tried to avoid tables because I hated them with a passion. how can I do that here? function msgwino () local row, col = guiGridListGetSelectedItem ( playerlist ) if ( row and col and row ~= -1 and col ~= -1 ) then local playerName = guiGridListGetItemText ( playerlist, row, 1 ) msgwin = guiCreateWindow(889, 491, 342, 298, "PM with: " ..playerName, false) guiWindowSetSizable(msgwin, false) chatmemo = guiCreateMemo(14, 45, 312, 206, "", false, msgwin) guiMemoSetReadOnly(chatmemo, true) sendpm = guiCreateEdit(14, 261, 227, 26, "", false, msgwin) guiSetProperty(sendpm, "NormalTextColour", "FF7F7F7F") sendbut = guiCreateButton(248, 260, 78, 27, "Send", false, msgwin) close = guiCreateButton(314, 23, 18, 18, "X", false, msgwin) addEventHandler ( "onClientGUIClick", close, msgwinclose ) end end function msgwinclose() _destroyElement ( msgwin ) end I know this is wrong and you told me with tables, can you show me how? because like this as I have it if i have multiple windows open the addEventHandler ( "onClientGUIClick", close, msgwinclose ) will only wwork once.
-
Hi, i am working on a PM system GUI and all, I got it down, I am confused on the playerlist, i have them on there, i have it so it updates when a player changed their name or quits or joins etc. I got it so when I double click a name a PM window pops up and the title at the top says "PMing : thePlayersName" anyways I have that part down no problem, but how can I make it so the window only pops up when one of the items (players) are clicked. For example if I click the bottom of the gridlist where there are no objects filled, the PM window pops up "PMing: " <-- i dont want it to do that, i only want it to pop up when the items are clicked. addEventHandler( "onClientGUIDoubleClick", playerlist, msgwino, false ) function msgwino () local playerName = guiGridListGetItemText ( playerlist, guiGridListGetSelectedItem ( playerlist ), 1 ) msgwin = guiCreateWindow(889, 491, 342, 298, "PM with: " ..playerName, false) guiWindowSetSizable(msgwin, false) chatmemo = guiCreateMemo(14, 45, 312, 206, "", false, msgwin) guiMemoSetReadOnly(chatmemo, true) sendpm = guiCreateEdit(14, 261, 227, 26, "", false, msgwin) guiSetProperty(sendpm, "NormalTextColour", "FF7F7F7F") sendbut = guiCreateButton(248, 260, 78, 27, "Send", false, msgwin) close = guiCreateButton(314, 23, 18, 18, "X", false, msgwin) end That is what I have so far, i know the 'playerlist' is basically saying that if I click anywere on the gridlist it pops up, but i want it only when i double click the items. also this makes me wonder, what if there are multiple players in that server and i double click all there names and all the PM window pops up, are all these varables going to be overwritten? how can i make it so i can close the windows, as you can see I have a feeling if multiple players are in that server i close one window and more windows are opened it won't work anymore because when i close it i was planning to destroy all teh GUI's for that window, but since all will have the same, "variables" once i close one, and try to close the other, that"close" technically won't exist no more.