Jump to content

Chat system problem !!!


Recommended Posts

Client :

MoteInfo = {} 
SentMessage = { 
    Button = {} 
} 
MoreInfo = { 
    Button = {} 
} 
Chat = {} 
Message = { 
    Edit = {} 
} 
X = { 
    Button = {} 
} 
Search = { 
    Edit = {} 
} 
Chatting = {} 
PlayerStatus = { 
    Button = {} 
} 
Messages = { 
    Memo = {} 
} 
GUIEditor = { 
    gridlist = {}, 
    label = {} 
} 
  
setElementData(localPlayer, "Chatting", nil) 
setElementData(localPlayer, "Status", "Online") 
local screenW, screenH = guiGetScreenSize() 
Chat.pWindow = guiCreateWindow(screenW - 297 - 10, (screenH - 420) / 2, 297, 420, "# - | Chat system | - #", false) 
guiWindowSetSizable(Chat.pWindow, false) 
guiSetAlpha(Chat.pWindow, 1.00) 
guiSetProperty(Chat.pWindow, "CaptionColour", "FF00F5FE") 
guiSetVisible(Chat.pWindow, false) 
GUIEditor.gridlist[1] = guiCreateGridList(10, 57, 229, 319, false, Chat.pWindow) 
guiGridListSetSelectionMode(GUIEditor.gridlist[1], 0) 
guiSetFont(GUIEditor.gridlist[1], "default-bold-small") 
guiGridListAddColumn(GUIEditor.gridlist[1], "# Player", 0.6) 
guiGridListAddColumn(GUIEditor.gridlist[1], "# Status", 0.3) 
Search.Edit.pWindow = guiCreateEdit(10, 27, 229, 24, "Search", false, Chat.pWindow) 
GUIEditor.label[1] = guiCreateLabel(10, 383, 68, 27, "My status : ", false, Chat.pWindow) 
guiSetFont(GUIEditor.label[1], "default-bold-small") 
guiLabelSetColor(GUIEditor.label[1], 0, 239, 253) 
guiLabelSetVerticalAlign(GUIEditor.label[1], "center") 
PlayerStatus.Button.pWindow = guiCreateButton(88, 383, 151, 27, "# Offline ~", false, Chat.pWindow) 
guiSetFont(PlayerStatus.Button.pWindow, "default-bold-small") 
guiSetProperty(PlayerStatus.Button.pWindow, "NormalTextColour", "FFFC0000") 
X.Button.pWindow = guiCreateButton(257, 383, 30, 27, "X", false, Chat.pWindow) 
guiSetFont(X.Button.pWindow, "default-bold-small") 
guiSetProperty(X.Button.pWindow, "NormalTextColour", "FFFC0000") 
MoreInfo.Button.pWindow = guiCreateButton(257, 27, 30, 27, "؟", false, Chat.pWindow) 
guiSetFont(MoreInfo.Button.pWindow, "default-bold-small") 
guiSetProperty(MoreInfo.Button.pWindow, "NormalTextColour", "FF2FFB00") 
GUIEditor.label[2] = guiCreateLabel(277, 57, 15, 319, "|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|", false, Chat.pWindow) 
guiSetFont(GUIEditor.label[2], "default-bold-small") 
guiLabelSetColor(GUIEditor.label[2], 245, 0, 0) 
guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false) 
guiLabelSetVerticalAlign(GUIEditor.label[2], "center") 
  
  
MoteInfo.MoreInfoWindow = guiCreateWindow(0.54, 0.07, 0.23, 0.17, "# - | More Info about | - #", true) 
guiWindowSetSizable(MoteInfo.MoreInfoWindow, false) 
guiSetAlpha(MoteInfo.MoreInfoWindow, 1.00) 
guiSetProperty(MoteInfo.MoreInfoWindow, "CaptionColour", "FF13FE1E") 
guiSetVisible(MoteInfo.MoreInfoWindow, false) 
GUIEditor.label[3] = guiCreateLabel(10, 21, 98, 23, "- Player status :  ", false, MoteInfo.MoreInfoWindow) 
guiSetFont(GUIEditor.label[3], "default-bold-small") 
guiLabelSetColor(GUIEditor.label[3], 39, 120, 255) 
guiLabelSetVerticalAlign(GUIEditor.label[3], "center") 
GUIEditor.label[4] = guiCreateLabel(10, 44, 243, 46, "* If you set your status to \"Offline\", \n you can't send any message,\n and everyone can't send you a messages", false, MoteInfo.MoreInfoWindow) 
guiSetFont(GUIEditor.label[4], "default-bold-small") 
X.Button.MoreInfoWindow = guiCreateButton(269, 100, 33, 21, "X", false, MoteInfo.MoreInfoWindow) 
guiSetFont(X.Button.MoreInfoWindow, "default-bold-small") 
guiSetProperty(X.Button.MoreInfoWindow, "NormalTextColour", "FFF50000") 
  
  
Chatting.ChattingWindow = guiCreateWindow((screenW - 566) / 2, (screenH - 370) / 2, 566, 370, "", false) 
guiWindowSetSizable(Chatting.ChattingWindow, false) 
guiSetAlpha(Chatting.ChattingWindow, 1.00) 
guiSetProperty(Chatting.ChattingWindow, "CaptionColour", "FF00E6F5") 
guiSetVisible(Chatting.ChattingWindow, false) 
Messages.Memo.ChattingWindow = guiCreateMemo(9, 24, 547, 304, "", false, Chatting.ChattingWindow) 
guiMemoSetReadOnly(Messages.Memo.ChattingWindow, true) 
Message.Edit.ChattingWindow = guiCreateEdit(10, 332, 399, 28, "", false, Chatting.ChattingWindow) 
SentMessage.Button.ChattingWindow = guiCreateButton(413, 332, 93, 28, "# Send ~", false, Chatting.ChattingWindow) 
guiSetFont(SentMessage.Button.ChattingWindow, "default-bold-small") 
guiSetProperty(SentMessage.Button.ChattingWindow, "NormalTextColour", "FF0BF500") 
X.Button.ChattingWindow = guiCreateButton(522, 332, 34, 28, "X", false, Chatting.ChattingWindow) 
guiSetFont(X.Button.ChattingWindow, "default-bold-small") 
guiSetProperty(X.Button.ChattingWindow, "NormalTextColour", "FFF50000") 
  
function refreshList_() 
guiGridListClear(GUIEditor.gridlist[1]) 
for _, player_ in ipairs(getElementsByType('player')) do 
local itemPlayer = guiGridListAddRow(GUIEditor.gridlist[1]) 
local itemText = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 1, getPlayerName(player_), false, false) 
local itemStatus = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 2, getElementData(player_, "Status"), false, false) 
if (getElementData(player_, "Status") == "Online") then 
guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 0, 255, 0) 
else guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 255, 0, 0) 
end 
end 
end 
  
addEvent( 'RefreshList', true ) 
addEventHandler( 'RefreshList', root, 
function() 
setTimer(function() 
refreshList_() 
end, 50, 1) 
guiGridListClear(GUIEditor.gridlist[1]) 
for _, player_ in ipairs(getElementsByType('player')) do 
local itemPlayer = guiGridListAddRow(GUIEditor.gridlist[1]) 
local itemText = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 1, getPlayerName(player_), false, false) 
local itemStatus = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 2, getElementData(player_, "Status"), false, false) 
if (getElementData(player_, "Status") == "Online") then 
guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 0, 255, 0) 
else guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 255, 0, 0) 
end 
end 
end 
) 
  
guiGridListClear(GUIEditor.gridlist[1]) 
for _, player_ in ipairs(getElementsByType('player')) do 
local itemPlayer = guiGridListAddRow(GUIEditor.gridlist[1]) 
local itemText = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 1, getPlayerName(player_), false, false) 
local itemStatus = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 2, getElementData(player_, "Status"), false, false) 
if (getElementData(player_, "Status") == "Online") then 
guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 0, 255, 0) 
else guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 255, 0, 0) 
end 
end 
  
addEventHandler( 'onClientGUIClick', root, 
function() 
if (source == X.Button.pWindow) then 
guiSetVisible(Chat.pWindow, false) 
guiSetInputEnabled(false) 
showCursor(false) 
elseif (source == X.Button.MoreInfoWindow) then 
guiSetVisible(MoteInfo.MoreInfoWindow, false) 
elseif (source == X.Button.ChattingWindow) then 
guiSetVisible(Chatting.ChattingWindow, false) 
setElementData(localPlayer, "Chatting", nil) 
elseif (source == MoreInfo.Button.pWindow) then 
guiSetVisible(MoteInfo.MoreInfoWindow, true) 
elseif (source == PlayerStatus.Button.pWindow) then 
if (guiGetText(PlayerStatus.Button.pWindow) == "# Offline ~") then 
triggerServerEvent( 'setPlayerStatusOffline', localPlayer ) 
guiSetText(PlayerStatus.Button.pWindow, "# Online ~") 
guiSetProperty(PlayerStatus.Button.pWindow, "NormalTextColour", "FF13FE1E") 
guiSetEnabled(GUIEditor.gridlist[1], false) 
else  
triggerServerEvent( 'setPlayerStatusOnline', localPlayer ) 
guiSetText(PlayerStatus.Button.pWindow, "# Offline ~") 
guiSetProperty(PlayerStatus.Button.pWindow, "NormalTextColour", "FFFC0000") 
guiSetEnabled(GUIEditor.gridlist[1], true) 
end 
elseif (source == SentMessage.Button.ChattingWindow) then 
local getMessage = guiGetText(Message.Edit.ChattingWindow) 
if (getMessage == "") then outputChatBox('* ERROR : #FFFFFF Please write a message !', 255, 0, 0, true) return end 
local playerSelected_ = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1], 1)) 
guiSetText (Messages.Memo.ChattingWindow, "" ..guiGetText(Messages.Memo.ChattingWindow).. ""..getPlayerName(localPlayer).." : "..guiGetText (Message.Edit.ChattingWindow).."") 
local playerName = getPlayerName(localPlayer) 
local MemoMessages = guiGetText(Messages.Memo.ChattingWindow) 
local getMessage_ = guiGetText(Message.Edit.ChattingWindow) 
local playerSource = getPlayerFromName(playerSelected_) 
triggerServerEvent ( "SentMessageToPlayer", playerSource, MemoMessages, playerName, getMessage_) 
guiSetText(Message.Edit.ChattingWindow, "") 
end 
end 
) 
  
addEvent( 'SentMessageTo', true ) 
addEventHandler( 'SentMessageTo', root, 
function(MemoMessages, playerName, getMessage_ ) 
guiSetText (Messages.Memo.ChattingWindow,"" ..MemoMessages.. "" ..playerName.. " : " ..getMessage_.. "") 
end 
) 
  
addEventHandler( 'onClientGUIDoubleClick', root, 
function() 
if (source == GUIEditor.gridlist[1]) then 
local Selected = guiGridListGetSelectedItem(GUIEditor.gridlist[1]) 
if (Selected == -1) then return end 
local playerSelected = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1], 1)) 
local playerStatus = getPlayerFromName(playerSelected) 
if (playerSelected) then 
if (getElementData(playerStatus, "Status") == "Offline") then outputChatBox('* ERROR : #FFFFFF This player is offline !', 255, 0, 0, true) return end 
--if (playerStatus == localPlayer) then outputChatBox('* ERROR : #FFFFFF You can\'t chatting with yourself !', 255, 0, 0, true) return end 
guiSetVisible(Chatting.ChattingWindow, true) 
guiSetText(Chatting.ChattingWindow, playerSelected) 
setElementData(localPlayer, "Chatting", playerSelected) 
end 
end 
end 
) 
  
function openChatpWindow() 
if (guiGetVisible(Chat.pWindow) == false) then 
if (getElementData(localPlayer, "Chatting") ~= nil) then 
guiSetInputEnabled(true) 
guiSetVisible(Chatting.ChattingWindow, true) 
guiSetVisible(Chat.pWindow, true) 
showCursor(true) 
else guiSetVisible(Chat.pWindow, true) showCursor(true) guiSetInputEnabled(true) end 
else 
guiSetInputEnabled(false) 
guiSetVisible(Chat.pWindow, false) 
guiSetVisible(Chatting.ChattingWindow, false) 
showCursor(false) 
end 
end 
bindKey( "F2", "down", openChatpWindow) 
  

Server :

  
addEvent( 'SentMessageToPlayer', true ) 
addEventHandler( 'SentMessageToPlayer', root, 
function(MemoMessages, playerName, getMessage_) 
triggerClientEvent( source, "SentMessageTo", source, MemoMessages, playerName, getMessage_ ) 
end 
) 
  
addEventHandler( 'onPlayerChangeNick', root,  
function() 
triggerClientEvent( 'RefreshList', source ) 
end 
) 
  
addEventHandler( 'onPlayerQuit', root,  
function() 
triggerClientEvent( 'RefreshList', source ) 
end 
) 
  
addEventHandler( 'onPlayerJoin', root, 
function() 
setElementData(source, "Status", "Online") 
triggerClientEvent( 'RefreshList', source ) 
end 
) 
  
  
  
addEvent( 'setPlayerStatusOffline', true ) 
addEventHandler( 'setPlayerStatusOffline', root, 
function() 
setElementData(source, "Status", "Offline") 
triggerClientEvent( 'RefreshList', source ) 
end 
) 
  
  
addEvent( 'setPlayerStatusOnline', true ) 
addEventHandler( 'setPlayerStatusOnline', root, 
function() 
setElementData(source, "Status", "Online") 
triggerClientEvent( 'RefreshList', source ) 
end 
) 
  

المشلة أني يوم اجي اراسل احد واجي مرة ثانية اراسل واحد ثاني

الرسائل اللي بيني وبين الشخص الأول تجي نفسها وكأنه مراسل الأول !!

أعرف تحتاج جداول لاكن ابي خبرتكم شوي تفيدني لآن الجداول لآحسه مخي

Link to comment

MoteInfo = {} 
SentMessage = { 
    Button = {} 
} 
MoreInfo = { 
    Button = {} 
} 
Chat = {} 
Message = { 
    Edit = {} 
} 
X = { 
    Button = {} 
} 
Search = { 
    Edit = {} 
} 
  
PlayerStatus = { 
    Button = {} 
} 
  
GUIEditor = { 
    gridlist = {}, 
    label = {} 
} 
  
sfa7 = {} 
  
setElementData(localPlayer, "Chatting", nil) 
setElementData(localPlayer, "Status", "Online") 
local screenW, screenH = guiGetScreenSize() 
Chat.pWindow = guiCreateWindow(screenW - 297 - 10, (screenH - 420) / 2, 297, 420, "# - | Chat system | - #", false) 
guiWindowSetSizable(Chat.pWindow, false) 
guiSetAlpha(Chat.pWindow, 1.00) 
guiSetProperty(Chat.pWindow, "CaptionColour", "FF00F5FE") 
guiSetVisible(Chat.pWindow, false) 
GUIEditor.gridlist[1] = guiCreateGridList(10, 57, 229, 319, false, Chat.pWindow) 
guiGridListSetSelectionMode(GUIEditor.gridlist[1], 0) 
guiSetFont(GUIEditor.gridlist[1], "default-bold-small") 
guiGridListAddColumn(GUIEditor.gridlist[1], "# Player", 0.6) 
guiGridListAddColumn(GUIEditor.gridlist[1], "# Status", 0.3) 
Search.Edit.pWindow = guiCreateEdit(10, 27, 229, 24, "Search", false, Chat.pWindow) 
GUIEditor.label[1] = guiCreateLabel(10, 383, 68, 27, "My status : ", false, Chat.pWindow) 
guiSetFont(GUIEditor.label[1], "default-bold-small") 
guiLabelSetColor(GUIEditor.label[1], 0, 239, 253) 
guiLabelSetVerticalAlign(GUIEditor.label[1], "center") 
PlayerStatus.Button.pWindow = guiCreateButton(88, 383, 151, 27, "# Offline ~", false, Chat.pWindow) 
guiSetFont(PlayerStatus.Button.pWindow, "default-bold-small") 
guiSetProperty(PlayerStatus.Button.pWindow, "NormalTextColour", "FFFC0000") 
X.Button.pWindow = guiCreateButton(257, 383, 30, 27, "X", false, Chat.pWindow) 
guiSetFont(X.Button.pWindow, "default-bold-small") 
guiSetProperty(X.Button.pWindow, "NormalTextColour", "FFFC0000") 
MoreInfo.Button.pWindow = guiCreateButton(257, 27, 30, 27, "؟", false, Chat.pWindow) 
guiSetFont(MoreInfo.Button.pWindow, "default-bold-small") 
guiSetProperty(MoreInfo.Button.pWindow, "NormalTextColour", "FF2FFB00") 
GUIEditor.label[2] = guiCreateLabel(277, 57, 15, 319, "|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|", false, Chat.pWindow) 
guiSetFont(GUIEditor.label[2], "default-bold-small") 
guiLabelSetColor(GUIEditor.label[2], 245, 0, 0) 
guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false) 
guiLabelSetVerticalAlign(GUIEditor.label[2], "center") 
  
  
MoteInfo.MoreInfoWindow = guiCreateWindow(0.54, 0.07, 0.23, 0.17, "# - | More Info about | - #", true) 
guiWindowSetSizable(MoteInfo.MoreInfoWindow, false) 
guiSetAlpha(MoteInfo.MoreInfoWindow, 1.00) 
guiSetProperty(MoteInfo.MoreInfoWindow, "CaptionColour", "FF13FE1E") 
guiSetVisible(MoteInfo.MoreInfoWindow, false) 
GUIEditor.label[3] = guiCreateLabel(10, 21, 98, 23, "- Player status :  ", false, MoteInfo.MoreInfoWindow) 
guiSetFont(GUIEditor.label[3], "default-bold-small") 
guiLabelSetColor(GUIEditor.label[3], 39, 120, 255) 
guiLabelSetVerticalAlign(GUIEditor.label[3], "center") 
GUIEditor.label[4] = guiCreateLabel(10, 44, 243, 46, "* If you set your status to \"Offline\", \n you can't send any message,\n and everyone can't send you a messages", false, MoteInfo.MoreInfoWindow) 
guiSetFont(GUIEditor.label[4], "default-bold-small") 
X.Button.MoreInfoWindow = guiCreateButton(269, 100, 33, 21, "X", false, MoteInfo.MoreInfoWindow) 
guiSetFont(X.Button.MoreInfoWindow, "default-bold-small") 
guiSetProperty(X.Button.MoreInfoWindow, "NormalTextColour", "FFF50000") 
  
function createChat(player) 
   local screenW, screenH = guiGetScreenSize() 
   sfa7[player] = {} 
   sfa7[player].ChattingWindow = guiCreateWindow((screenW - 566) / 2, (screenH - 370) / 2, 566, 370, getPlayerName(player), false) 
   guiWindowSetSizable(sfa7[player].ChattingWindow, false) 
   guiSetAlpha(sfa7[player].ChattingWindow, 1.00) 
   guiSetProperty(sfa7[player].ChattingWindow, "CaptionColour", "FF00E6F5") 
   guiSetVisible(sfa7[player].ChattingWindow, false) 
   sfa7[player].Memo = guiCreateMemo(9, 24, 547, 304, "", false, sfa7[player].ChattingWindow) 
   guiMemoSetReadOnly(sfa7[player].Memo, true) 
   sfa7[player].Edit = guiCreateEdit(10, 332, 399, 28, "", false, sfa7[player].ChattingWindow) 
   sfa7[player].SentMessage = guiCreateButton(413, 332, 93, 28, "# Send ~", false, sfa7[player].ChattingWindow) 
   guiSetFont(sfa7[player].SentMessage, "default-bold-small") 
   guiSetProperty(sfa7[player].SentMessage, "NormalTextColour", "FF0BF500") 
   sfa7[player].X = guiCreateButton(522, 332, 34, 28, "X", false, sfa7[player].ChattingWindow) 
   guiSetFont(sfa7[player].X, "default-bold-small") 
   guiSetProperty(sfa7[player].X, "NormalTextColour", "FFF50000") 
   if guiGetVisible(Chat.pWindow) == true then 
    guiSetVisible(sfa7[player].ChattingWindow,true) 
   else 
    guiSetVisible(sfa7[player].ChattingWindow,false) 
  end 
end 
  
function refreshList_() 
guiGridListClear(GUIEditor.gridlist[1]) 
for _, player_ in ipairs(getElementsByType('player')) do 
local itemPlayer = guiGridListAddRow(GUIEditor.gridlist[1]) 
local itemText = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 1, getPlayerName(player_), false, false) 
local itemStatus = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 2, getElementData(player_, "Status"), false, false) 
if (getElementData(player_, "Status") == "Online") then 
guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 0, 255, 0) 
else guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 255, 0, 0) 
end 
end 
end 
  
addEvent( 'RefreshList', true ) 
addEventHandler( 'RefreshList', root, 
function() 
setTimer(function() 
refreshList_() 
end, 50, 1) 
guiGridListClear(GUIEditor.gridlist[1]) 
for _, player_ in ipairs(getElementsByType('player')) do 
local itemPlayer = guiGridListAddRow(GUIEditor.gridlist[1]) 
local itemText = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 1, getPlayerName(player_), false, false) 
local itemStatus = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 2, getElementData(player_, "Status"), false, false) 
if (getElementData(player_, "Status") == "Online") then 
guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 0, 255, 0) 
else guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 255, 0, 0) 
end 
end 
end 
) 
  
guiGridListClear(GUIEditor.gridlist[1]) 
for _, player_ in ipairs(getElementsByType('player')) do 
local itemPlayer = guiGridListAddRow(GUIEditor.gridlist[1]) 
local itemText = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 1, getPlayerName(player_), false, false) 
local itemStatus = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 2, getElementData(player_, "Status"), false, false) 
if (getElementData(player_, "Status") == "Online") then 
guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 0, 255, 0) 
else guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 255, 0, 0) 
end 
end 
  
addEventHandler( 'onClientGUIClick', resourceRoot, function() 
local parent = getElementParent(source) 
if getElementType(source) ~= 'gui-button' then return end; 
if parent and guiGetText(parent) ~= '# - | Chat system | - #' then 
local playerSource = getPlayerFromName(guiGetText(parent)) 
if playerSource then 
if (source == sfa7[playerSource].SentMessage) then 
local getMessage = guiGetText(sfa7[playerSource].Edit) 
if (getMessage == "") then outputChatBox('* ERROR : #FFFFFF Please write a message !', 255, 0, 0, true) return end 
--guiSetText (sfa7[playerSource].Memo, "" ..guiGetText(sfa7[playerSource].Memo).. ""..getPlayerName(localPlayer).." : "..guiGetText (sfa7[playerSource].Edit).."") 
local playerName = getPlayerName(localPlayer) 
local MemoMessages = guiGetText(sfa7[playerSource].Memo) 
local getMessage_ = guiGetText(sfa7[playerSource].Edit) 
triggerServerEvent ( "SentMessageToPlayer", localPlayer, playerSource, MemoMessages, playerName, getMessage_) 
guiSetText(sfa7[playerSource].Edit, "") 
elseif (source == sfa7[playerSource].X) then 
if sfa7[playerSource] and isElement(sfa7[playerSource].ChattingWindow) then 
   destroyElement(sfa7[playerSource].ChattingWindow) 
   sfa7[playerSource] = nil 
end 
setElementData(localPlayer, "Chatting", nil) 
end 
end 
end 
end) 
  
addEventHandler('onClientGUIClick', resourceRoot, function() 
if (source == X.Button.pWindow) then 
guiSetVisible(Chat.pWindow, false) 
guiSetInputEnabled(false) 
showCursor(false) 
elseif (source == X.Button.MoreInfoWindow) then 
guiSetVisible(MoteInfo.MoreInfoWindow, false) 
elseif (source == MoreInfo.Button.pWindow) then 
guiSetVisible(MoteInfo.MoreInfoWindow, true) 
elseif (source == PlayerStatus.Button.pWindow) then 
if (guiGetText(PlayerStatus.Button.pWindow) == "# Offline ~") then 
triggerServerEvent( 'setPlayerStatusOffline', localPlayer ) 
guiSetText(PlayerStatus.Button.pWindow, "# Online ~") 
guiSetProperty(PlayerStatus.Button.pWindow, "NormalTextColour", "FF13FE1E") 
guiSetEnabled(GUIEditor.gridlist[1], false) 
else 
triggerServerEvent( 'setPlayerStatusOnline', localPlayer ) 
guiSetText(PlayerStatus.Button.pWindow, "# Offline ~") 
guiSetProperty(PlayerStatus.Button.pWindow, "NormalTextColour", "FFFC0000") 
guiSetEnabled(GUIEditor.gridlist[1], true) 
end 
end 
end) 
  
addEvent( 'SentMessageTo', true ) 
addEventHandler( 'SentMessageTo', root, 
function(player, MemoMessages, playerName, getMessage_ ) 
guiSetText (sfa7[player].Memo,"" ..MemoMessages.. "" ..playerName.. " : " ..getMessage_.. "") 
end) 
  
addEventHandler( 'onClientGUIDoubleClick', root, 
function() 
if (source == GUIEditor.gridlist[1]) then 
local Selected = guiGridListGetSelectedItem(GUIEditor.gridlist[1]) 
if (Selected == -1) then return end 
local playerSelected = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1], 1)) 
local playerStatus = getPlayerFromName(playerSelected) 
if (playerSelected) then 
if (getElementData(playerStatus, "Status") == "Offline") then outputChatBox('* ERROR : #FFFFFF This player is offline !', 255, 0, 0, true) return end 
--if (playerStatus == localPlayer) then outputChatBox('* ERROR : #FFFFFF You can't chatting with yourself !', 255, 0, 0, true) return end 
if not sfa7[playerStatus] then 
createChat(playerStatus) 
end 
setElementData(localPlayer, "Chatting", playerSelected) 
end 
end 
end) 
  
function openChatpWindow() 
if (guiGetVisible(Chat.pWindow) == false) then 
if (getElementData(localPlayer, "Chatting") ~= nil) then 
guiSetInputEnabled(true) 
for i,l in ipairs(sfa7) do 
    guiSetVisible(sfa7[i].ChattingWindow,true) 
end 
guiSetVisible(Chat.pWindow, true) 
showCursor(true) 
else guiSetVisible(Chat.pWindow, true) showCursor(true) guiSetInputEnabled(true) end 
else 
guiSetInputEnabled(false) 
guiSetVisible(Chat.pWindow, false) 
for i,l in ipairs(sfa7) do 
    guiSetVisible(sfa7[i].ChattingWindow,false) 
end 
showCursor(false) 
end 
end 
bindKey( "F2", "down", openChatpWindow) 

  
addEvent( 'SentMessageToPlayer', true ) 
addEventHandler( 'SentMessageToPlayer', root, 
function(player, MemoMessages, playerName, getMessage_) 
triggerClientEvent( player, "SentMessageTo", source, source, MemoMessages, playerName, getMessage_ ) 
end) 
  
addEventHandler( 'onPlayerChangeNick', root, 
function() 
triggerClientEvent( 'RefreshList', source ) 
end 
) 
  
addEventHandler( 'onPlayerQuit', root, 
function() 
triggerClientEvent( 'RefreshList', source ) 
end 
) 
  
addEventHandler( 'onPlayerJoin', root, 
function() 
setElementData(source, "Status", "Online") 
triggerClientEvent( 'RefreshList', source ) 
end 
) 
  
addEvent( 'setPlayerStatusOffline', true ) 
addEventHandler( 'setPlayerStatusOffline', root, 
function() 
setElementData(source, "Status", "Offline") 
triggerClientEvent( 'RefreshList', source ) 
end 
) 
  
  
addEvent( 'setPlayerStatusOnline', true ) 
addEventHandler( 'setPlayerStatusOnline', root, 
function() 
setElementData(source, "Status", "Online") 
triggerClientEvent( 'RefreshList', source ) 
end 
) 
Link to comment
MoteInfo = {} 
SentMessage = { 
    Button = {} 
} 
MoreInfo = { 
    Button = {} 
} 
Chat = {} 
Message = { 
    Edit = {} 
} 
X = { 
    Button = {} 
} 
Search = { 
    Edit = {} 
} 
  
PlayerStatus = { 
    Button = {} 
} 
  
GUIEditor = { 
    gridlist = {}, 
    label = {} 
} 
  
sfa7 = {} 
  
setElementData(localPlayer, "Chatting", nil) 
setElementData(localPlayer, "Status", "Online") 
local screenW, screenH = guiGetScreenSize() 
Chat.pWindow = guiCreateWindow(screenW - 297 - 10, (screenH - 420) / 2, 297, 420, "# - | Chat system | - #", false) 
guiWindowSetSizable(Chat.pWindow, false) 
guiSetAlpha(Chat.pWindow, 1.00) 
guiSetProperty(Chat.pWindow, "CaptionColour", "FF00F5FE") 
guiSetVisible(Chat.pWindow, false) 
GUIEditor.gridlist[1] = guiCreateGridList(10, 57, 229, 319, false, Chat.pWindow) 
guiGridListSetSelectionMode(GUIEditor.gridlist[1], 0) 
guiSetFont(GUIEditor.gridlist[1], "default-bold-small") 
guiGridListAddColumn(GUIEditor.gridlist[1], "# Player", 0.6) 
guiGridListAddColumn(GUIEditor.gridlist[1], "# Status", 0.3) 
Search.Edit.pWindow = guiCreateEdit(10, 27, 229, 24, "Search", false, Chat.pWindow) 
GUIEditor.label[1] = guiCreateLabel(10, 383, 68, 27, "My status : ", false, Chat.pWindow) 
guiSetFont(GUIEditor.label[1], "default-bold-small") 
guiLabelSetColor(GUIEditor.label[1], 0, 239, 253) 
guiLabelSetVerticalAlign(GUIEditor.label[1], "center") 
PlayerStatus.Button.pWindow = guiCreateButton(88, 383, 151, 27, "# Offline ~", false, Chat.pWindow) 
guiSetFont(PlayerStatus.Button.pWindow, "default-bold-small") 
guiSetProperty(PlayerStatus.Button.pWindow, "NormalTextColour", "FFFC0000") 
X.Button.pWindow = guiCreateButton(257, 383, 30, 27, "X", false, Chat.pWindow) 
guiSetFont(X.Button.pWindow, "default-bold-small") 
guiSetProperty(X.Button.pWindow, "NormalTextColour", "FFFC0000") 
MoreInfo.Button.pWindow = guiCreateButton(257, 27, 30, 27, "؟", false, Chat.pWindow) 
guiSetFont(MoreInfo.Button.pWindow, "default-bold-small") 
guiSetProperty(MoreInfo.Button.pWindow, "NormalTextColour", "FF2FFB00") 
GUIEditor.label[2] = guiCreateLabel(277, 57, 15, 319, "|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|", false, Chat.pWindow) 
guiSetFont(GUIEditor.label[2], "default-bold-small") 
guiLabelSetColor(GUIEditor.label[2], 245, 0, 0) 
guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false) 
guiLabelSetVerticalAlign(GUIEditor.label[2], "center") 
  
  
MoteInfo.MoreInfoWindow = guiCreateWindow(0.54, 0.07, 0.23, 0.17, "# - | More Info about | - #", true) 
guiWindowSetSizable(MoteInfo.MoreInfoWindow, false) 
guiSetAlpha(MoteInfo.MoreInfoWindow, 1.00) 
guiSetProperty(MoteInfo.MoreInfoWindow, "CaptionColour", "FF13FE1E") 
guiSetVisible(MoteInfo.MoreInfoWindow, false) 
GUIEditor.label[3] = guiCreateLabel(10, 21, 98, 23, "- Player status :  ", false, MoteInfo.MoreInfoWindow) 
guiSetFont(GUIEditor.label[3], "default-bold-small") 
guiLabelSetColor(GUIEditor.label[3], 39, 120, 255) 
guiLabelSetVerticalAlign(GUIEditor.label[3], "center") 
GUIEditor.label[4] = guiCreateLabel(10, 44, 243, 46, "* If you set your status to \"Offline\", \n you can't send any message,\n and everyone can't send you a messages", false, MoteInfo.MoreInfoWindow) 
guiSetFont(GUIEditor.label[4], "default-bold-small") 
X.Button.MoreInfoWindow = guiCreateButton(269, 100, 33, 21, "X", false, MoteInfo.MoreInfoWindow) 
guiSetFont(X.Button.MoreInfoWindow, "default-bold-small") 
guiSetProperty(X.Button.MoreInfoWindow, "NormalTextColour", "FFF50000") 
  
function createChat(player) 
   local screenW, screenH = guiGetScreenSize() 
   sfa7[player] = {} 
   sfa7[player].ChattingWindow = guiCreateWindow((screenW - 566) / 2, (screenH - 370) / 2, 566, 370, getPlayerName(player), false) 
   guiWindowSetSizable(sfa7[player].ChattingWindow, false) 
   guiSetAlpha(sfa7[player].ChattingWindow, 1.00) 
   guiSetProperty(sfa7[player].ChattingWindow, "CaptionColour", "FF00E6F5") 
   guiSetVisible(sfa7[player].ChattingWindow, false) 
   sfa7[player].Memo = guiCreateMemo(9, 24, 547, 304, "", false, sfa7[player].ChattingWindow) 
   guiMemoSetReadOnly(sfa7[player].Memo, true) 
   sfa7[player].Edit = guiCreateEdit(10, 332, 399, 28, "", false, sfa7[player].ChattingWindow) 
   sfa7[player].SentMessage = guiCreateButton(413, 332, 93, 28, "# Send ~", false, sfa7[player].ChattingWindow) 
   guiSetFont(sfa7[player].SentMessage, "default-bold-small") 
   guiSetProperty(sfa7[player].SentMessage, "NormalTextColour", "FF0BF500") 
   sfa7[player].X = guiCreateButton(522, 332, 34, 28, "X", false, sfa7[player].ChattingWindow) 
   guiSetFont(sfa7[player].X, "default-bold-small") 
   guiSetProperty(sfa7[player].X, "NormalTextColour", "FFF50000") 
   if guiGetVisible(Chat.pWindow) == true then 
    guiSetVisible(sfa7[player].ChattingWindow,true) 
   else 
    guiSetVisible(sfa7[player].ChattingWindow,false) 
  end 
end 
  
function refreshList_() 
guiGridListClear(GUIEditor.gridlist[1]) 
for _, player_ in ipairs(getElementsByType('player')) do 
local itemPlayer = guiGridListAddRow(GUIEditor.gridlist[1]) 
local itemText = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 1, getPlayerName(player_), false, false) 
local itemStatus = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 2, getElementData(player_, "Status"), false, false) 
if (getElementData(player_, "Status") == "Online") then 
guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 0, 255, 0) 
else guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 255, 0, 0) 
end 
end 
end 
  
addEvent( 'RefreshList', true ) 
addEventHandler( 'RefreshList', root, 
function() 
setTimer(function() 
refreshList_() 
end, 50, 1) 
guiGridListClear(GUIEditor.gridlist[1]) 
for _, player_ in ipairs(getElementsByType('player')) do 
local itemPlayer = guiGridListAddRow(GUIEditor.gridlist[1]) 
local itemText = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 1, getPlayerName(player_), false, false) 
local itemStatus = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 2, getElementData(player_, "Status"), false, false) 
if (getElementData(player_, "Status") == "Online") then 
guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 0, 255, 0) 
else guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 255, 0, 0) 
end 
end 
end 
) 
  
guiGridListClear(GUIEditor.gridlist[1]) 
for _, player_ in ipairs(getElementsByType('player')) do 
local itemPlayer = guiGridListAddRow(GUIEditor.gridlist[1]) 
local itemText = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 1, getPlayerName(player_), false, false) 
local itemStatus = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 2, getElementData(player_, "Status"), false, false) 
if (getElementData(player_, "Status") == "Online") then 
guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 0, 255, 0) 
else guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 255, 0, 0) 
end 
end 
  
addEventHandler( 'onClientGUIClick', resourceRoot, function() 
local parent = getElementParent(source) 
if getElementType(source) ~= 'gui-button' then return end; 
if parent and guiGetText(parent) ~= '# - | Chat system | - #' then 
local playerSource = getPlayerFromName(guiGetText(parent)) 
if playerSource then 
if (source == sfa7[playerSource].SentMessage) then 
local getMessage = guiGetText(sfa7[playerSource].Edit) 
if (getMessage == "") then outputChatBox('* ERROR : #FFFFFF Please write a message !', 255, 0, 0, true) return end 
--guiSetText (sfa7[playerSource].Memo, "" ..guiGetText(sfa7[playerSource].Memo).. ""..getPlayerName(localPlayer).." : "..guiGetText (sfa7[playerSource].Edit).."") 
local playerName = getPlayerName(localPlayer) 
local MemoMessages = guiGetText(sfa7[playerSource].Memo) 
local getMessage_ = guiGetText(sfa7[playerSource].Edit) 
triggerServerEvent ( "SentMessageToPlayer", localPlayer, playerSource, MemoMessages, playerName, getMessage_) 
guiSetText(sfa7[playerSource].Edit, "") 
elseif (source == sfa7[playerSource].X) then 
if sfa7[playerSource] and isElement(sfa7[playerSource].ChattingWindow) then 
   destroyElement(sfa7[playerSource].ChattingWindow) 
   sfa7[playerSource] = nil 
end 
setElementData(localPlayer, "Chatting", nil) 
end 
end 
end 
end) 
  
addEventHandler('onClientGUIClick', resourceRoot, function() 
if (source == X.Button.pWindow) then 
guiSetVisible(Chat.pWindow, false) 
guiSetInputEnabled(false) 
showCursor(false) 
elseif (source == X.Button.MoreInfoWindow) then 
guiSetVisible(MoteInfo.MoreInfoWindow, false) 
elseif (source == MoreInfo.Button.pWindow) then 
guiSetVisible(MoteInfo.MoreInfoWindow, true) 
elseif (source == PlayerStatus.Button.pWindow) then 
if (guiGetText(PlayerStatus.Button.pWindow) == "# Offline ~") then 
triggerServerEvent( 'setPlayerStatusOffline', localPlayer ) 
guiSetText(PlayerStatus.Button.pWindow, "# Online ~") 
guiSetProperty(PlayerStatus.Button.pWindow, "NormalTextColour", "FF13FE1E") 
guiSetEnabled(GUIEditor.gridlist[1], false) 
else 
triggerServerEvent( 'setPlayerStatusOnline', localPlayer ) 
guiSetText(PlayerStatus.Button.pWindow, "# Offline ~") 
guiSetProperty(PlayerStatus.Button.pWindow, "NormalTextColour", "FFFC0000") 
guiSetEnabled(GUIEditor.gridlist[1], true) 
end 
end 
end) 
  
addEvent( 'SentMessageTo', true ) 
addEventHandler( 'SentMessageTo', root, 
function(player, MemoMessages, playerName, getMessage_ ) 
guiSetText (sfa7[player].Memo,"" ..MemoMessages.. "" ..playerName.. " : " ..getMessage_.. "") 
end) 
  
addEventHandler( 'onClientGUIDoubleClick', root, 
function() 
if (source == GUIEditor.gridlist[1]) then 
local Selected = guiGridListGetSelectedItem(GUIEditor.gridlist[1]) 
if (Selected == -1) then return end 
local playerSelected = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1], 1)) 
local playerStatus = getPlayerFromName(playerSelected) 
if (playerSelected) then 
if (getElementData(playerStatus, "Status") == "Offline") then outputChatBox('* ERROR : #FFFFFF This player is offline !', 255, 0, 0, true) return end 
--if (playerStatus == localPlayer) then outputChatBox('* ERROR : #FFFFFF You can't chatting with yourself !', 255, 0, 0, true) return end 
if not sfa7[playerStatus] then 
createChat(playerStatus) 
end 
setElementData(localPlayer, "Chatting", playerSelected) 
end 
end 
end) 
  
function openChatpWindow() 
if (guiGetVisible(Chat.pWindow) == false) then 
if (getElementData(localPlayer, "Chatting") ~= nil) then 
guiSetInputEnabled(true) 
for i,l in ipairs(sfa7) do 
    guiSetVisible(sfa7[i].ChattingWindow,true) 
end 
guiSetVisible(Chat.pWindow, true) 
showCursor(true) 
else guiSetVisible(Chat.pWindow, true) showCursor(true) guiSetInputEnabled(true) end 
else 
guiSetInputEnabled(false) 
guiSetVisible(Chat.pWindow, false) 
for i,l in ipairs(sfa7) do 
    guiSetVisible(sfa7[i].ChattingWindow,false) 
end 
showCursor(false) 
end 
end 
bindKey( "F2", "down", openChatpWindow) 

  
addEvent( 'SentMessageToPlayer', true ) 
addEventHandler( 'SentMessageToPlayer', root, 
function(player, MemoMessages, playerName, getMessage_) 
triggerClientEvent( player, "SentMessageTo", source, source, MemoMessages, playerName, getMessage_ ) 
end) 
  
addEventHandler( 'onPlayerChangeNick', root, 
function() 
triggerClientEvent( 'RefreshList', source ) 
end 
) 
  
addEventHandler( 'onPlayerQuit', root, 
function() 
triggerClientEvent( 'RefreshList', source ) 
end 
) 
  
addEventHandler( 'onPlayerJoin', root, 
function() 
setElementData(source, "Status", "Online") 
triggerClientEvent( 'RefreshList', source ) 
end 
) 
  
addEvent( 'setPlayerStatusOffline', true ) 
addEventHandler( 'setPlayerStatusOffline', root, 
function() 
setElementData(source, "Status", "Offline") 
triggerClientEvent( 'RefreshList', source ) 
end 
) 
  
  
addEvent( 'setPlayerStatusOnline', true ) 
addEventHandler( 'setPlayerStatusOnline', root, 
function() 
setElementData(source, "Status", "Online") 
triggerClientEvent( 'RefreshList', source ) 
end 
) 

في مشاكل بالكود وهي يوم اني ارسل رسالة لنفسي كــ تجربة تمام ويوم ارسل رسالة لشخص ثاني ماتوصله

يعني الميمو تبقى فارغة عندي

+ يوم اجي اغلق اف 2 واشغلها اللوحة تطلع فوجهي سواء كنت اراسل او موفاتح لوحة المراسلة !!_!!

Link to comment

-- Client Side --

MoteInfo = {} 
SentMessage = {
    Button = {}
}
MoreInfo = {
    Button = {}
}
Chat = {}
Message = {
    Edit = {}
}
X = {
    Button = {}
}
Search = {
    Edit = {}
}
 
PlayerStatus = {
    Button = {}
}
 
GUIEditor = {
    gridlist = {},
    label = {}
}
 
sfa7 = {}
Wchat = false
 
setElementData(localPlayer, "Chatting", nil)
setElementData(localPlayer, "Status", "Online")
local screenW, screenH = guiGetScreenSize()
Chat.pWindow = guiCreateWindow(screenW - 297 - 10, (screenH - 420) / 2, 297, 420, "# - | Chat system | - #", false)
guiWindowSetSizable(Chat.pWindow, false)
guiSetAlpha(Chat.pWindow, 1.00)
guiSetProperty(Chat.pWindow, "CaptionColour", "FF00F5FE")
guiSetVisible(Chat.pWindow, false)
GUIEditor.gridlist[1] = guiCreateGridList(10, 57, 229, 319, false, Chat.pWindow)
guiGridListSetSelectionMode(GUIEditor.gridlist[1], 0)
guiSetFont(GUIEditor.gridlist[1], "default-bold-small")
guiGridListAddColumn(GUIEditor.gridlist[1], "# Player", 0.6)
guiGridListAddColumn(GUIEditor.gridlist[1], "# Status", 0.3)
Search.Edit.pWindow = guiCreateEdit(10, 27, 229, 24, "Search", false, Chat.pWindow)
GUIEditor.label[1] = guiCreateLabel(10, 383, 68, 27, "My status : ", false, Chat.pWindow)
guiSetFont(GUIEditor.label[1], "default-bold-small")
guiLabelSetColor(GUIEditor.label[1], 0, 239, 253)
guiLabelSetVerticalAlign(GUIEditor.label[1], "center")
PlayerStatus.Button.pWindow = guiCreateButton(88, 383, 151, 27, "# Offline ~", false, Chat.pWindow)
guiSetFont(PlayerStatus.Button.pWindow, "default-bold-small")
guiSetProperty(PlayerStatus.Button.pWindow, "NormalTextColour", "FFFC0000")
X.Button.pWindow = guiCreateButton(257, 383, 30, 27, "X", false, Chat.pWindow)
guiSetFont(X.Button.pWindow, "default-bold-small")
guiSetProperty(X.Button.pWindow, "NormalTextColour", "FFFC0000")
MoreInfo.Button.pWindow = guiCreateButton(257, 27, 30, 27, "؟", false, Chat.pWindow)
guiSetFont(MoreInfo.Button.pWindow, "default-bold-small")
guiSetProperty(MoreInfo.Button.pWindow, "NormalTextColour", "FF2FFB00")
GUIEditor.label[2] = guiCreateLabel(277, 57, 15, 319, "|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|", false, Chat.pWindow)
guiSetFont(GUIEditor.label[2], "default-bold-small")
guiLabelSetColor(GUIEditor.label[2], 245, 0, 0)
guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false)
guiLabelSetVerticalAlign(GUIEditor.label[2], "center")
 
 
MoteInfo.MoreInfoWindow = guiCreateWindow(0.54, 0.07, 0.23, 0.17, "# - | More Info about | - #", true)
guiWindowSetSizable(MoteInfo.MoreInfoWindow, false)
guiSetAlpha(MoteInfo.MoreInfoWindow, 1.00)
guiSetProperty(MoteInfo.MoreInfoWindow, "CaptionColour", "FF13FE1E")
guiSetVisible(MoteInfo.MoreInfoWindow, false)
GUIEditor.label[3] = guiCreateLabel(10, 21, 98, 23, "- Player status :  ", false, MoteInfo.MoreInfoWindow)
guiSetFont(GUIEditor.label[3], "default-bold-small")
guiLabelSetColor(GUIEditor.label[3], 39, 120, 255)
guiLabelSetVerticalAlign(GUIEditor.label[3], "center")
GUIEditor.label[4] = guiCreateLabel(10, 44, 243, 46, "* If you set your status to \"Offline\", \n you can't send any message,\n and everyone can't send you a messages", false, MoteInfo.MoreInfoWindow)
guiSetFont(GUIEditor.label[4], "default-bold-small")
X.Button.MoreInfoWindow = guiCreateButton(269, 100, 33, 21, "X", false, MoteInfo.MoreInfoWindow)
guiSetFont(X.Button.MoreInfoWindow, "default-bold-small")
guiSetProperty(X.Button.MoreInfoWindow, "NormalTextColour", "FFF50000")
 
function createChat(player)
   local screenW, screenH = guiGetScreenSize()
   sfa7[player] = {}
   sfa7[player].ChattingWindow = guiCreateWindow((screenW - 566) / 2, (screenH - 370) / 2, 566, 370, getPlayerName(player), false)
   guiWindowSetSizable(sfa7[player].ChattingWindow, false)
   guiSetAlpha(sfa7[player].ChattingWindow, 1.00)
   guiSetProperty(sfa7[player].ChattingWindow, "CaptionColour", "FF00E6F5")
   guiSetVisible(sfa7[player].ChattingWindow, false)
   sfa7[player].Memo = guiCreateMemo(9, 24, 547, 304, "", false, sfa7[player].ChattingWindow)
   guiMemoSetReadOnly(sfa7[player].Memo, true)
   sfa7[player].Edit = guiCreateEdit(10, 332, 399, 28, "", false, sfa7[player].ChattingWindow)
   sfa7[player].SentMessage = guiCreateButton(413, 332, 93, 28, "# Send ~", false, sfa7[player].ChattingWindow)
   guiSetFont(sfa7[player].SentMessage, "default-bold-small")
   guiSetProperty(sfa7[player].SentMessage, "NormalTextColour", "FF0BF500")
   sfa7[player].X = guiCreateButton(522, 332, 34, 28, "X", false, sfa7[player].ChattingWindow)
   guiSetFont(sfa7[player].X, "default-bold-small")
   guiSetProperty(sfa7[player].X, "NormalTextColour", "FFF50000")
   Wchat = player
   if guiGetVisible(Chat.pWindow) == true then
    guiSetVisible(sfa7[player].ChattingWindow,true)
   else
    guiSetVisible(sfa7[player].ChattingWindow,false)
  end
end
 
function refreshList_()
guiGridListClear(GUIEditor.gridlist[1])
for _, player_ in ipairs(getElementsByType('player')) do
local itemPlayer = guiGridListAddRow(GUIEditor.gridlist[1])
local itemText = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 1, getPlayerName(player_), false, false)
local itemStatus = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 2, getElementData(player_, "Status"), false, false)
if (getElementData(player_, "Status") == "Online") then
guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 0, 255, 0)
else guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 255, 0, 0)
end
end
end
 
addEvent( 'RefreshList', true )
addEventHandler( 'RefreshList', root,
function()
setTimer(function()
refreshList_()
end, 50, 1)
guiGridListClear(GUIEditor.gridlist[1])
for _, player_ in ipairs(getElementsByType('player')) do
local itemPlayer = guiGridListAddRow(GUIEditor.gridlist[1])
local itemText = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 1, getPlayerName(player_), false, false)
local itemStatus = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 2, getElementData(player_, "Status"), false, false)
if (getElementData(player_, "Status") == "Online") then
guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 0, 255, 0)
else guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 255, 0, 0)
end
end
end
)
 
guiGridListClear(GUIEditor.gridlist[1])
for _, player_ in ipairs(getElementsByType('player')) do
local itemPlayer = guiGridListAddRow(GUIEditor.gridlist[1])
local itemText = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 1, getPlayerName(player_), false, false)
local itemStatus = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 2, getElementData(player_, "Status"), false, false)
if (getElementData(player_, "Status") == "Online") then
guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 0, 255, 0)
else guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 255, 0, 0)
end
end
 
addEventHandler( 'onClientGUIClick', resourceRoot, function()
local parent = getElementParent(source)
if getElementType(source) ~= 'gui-button' then return end;
if parent and guiGetText(parent) ~= '# - | Chat system | - #' then
local playerSource = getPlayerFromName(guiGetText(parent))
if playerSource then
if (source == sfa7[playerSource].SentMessage) then
if sfa7[playerSource] and isElement(sfa7[playerSource].ChattingWindow) then
local getMessage = guiGetText(sfa7[playerSource].Edit)
if (getMessage == "") then outputChatBox('* ERROR : #FFFFFF Please write a message !', 255, 0, 0, true) return end
--guiSetText (sfa7[playerSource].Memo, "" ..guiGetText(sfa7[playerSource].Memo).. ""..getPlayerName(localPlayer).." : "..guiGetText (sfa7[playerSource].Edit).."")
local MemoMessages = guiGetText(sfa7[playerSource].Memo)
if not MemoMessages then MemoMessages = "" end
MemoMessages = MemoMessages.. getPlayerName(localPlayer) ..' : '.. getMessage ..'\n'
guiSetText(sfa7[playerSource].Memo, MemoMessages)
guiSetText(sfa7[playerSource].Edit, '')
guiMemoSetCaretIndex(sfa7[playerSource].Memo, string.len(MemoMessages))
triggerServerEvent ( "SentMessageToPlayer", localPlayer, playerSource, getMessage)
end
elseif (source == sfa7[playerSource].X) then
if sfa7[playerSource] and isElement(sfa7[playerSource].ChattingWindow) then
  destroyElement(sfa7[playerSource].ChattingWindow)
  sfa7[playerSource] = nil
  Wchat = false
end
setElementData(localPlayer, "Chatting", nil)
end
end
end
end)
 
addEventHandler('onClientGUIClick', resourceRoot, function()
if (source == X.Button.pWindow) then
guiSetVisible(Chat.pWindow, false)
guiSetInputEnabled(false)
showCursor(false)
if Wchat and sfa7[Wchat] and isElement(sfa7[Wchat].ChattingWindow) then
  destroyElement(sfa7[Wchat].ChattingWindow)
  sfa7[Wchat] = nil
  Wchat = false
end
elseif (source == X.Button.MoreInfoWindow) then
guiSetVisible(MoteInfo.MoreInfoWindow, false)
elseif (source == MoreInfo.Button.pWindow) then
guiSetVisible(MoteInfo.MoreInfoWindow, true)
elseif (source == PlayerStatus.Button.pWindow) then
if (guiGetText(PlayerStatus.Button.pWindow) == "# Offline ~") then
triggerServerEvent( 'setPlayerStatusOffline', localPlayer )
guiSetText(PlayerStatus.Button.pWindow, "# Online ~")
guiSetProperty(PlayerStatus.Button.pWindow, "NormalTextColour", "FF13FE1E")
guiSetEnabled(GUIEditor.gridlist[1], false)
else
triggerServerEvent( 'setPlayerStatusOnline', localPlayer )
guiSetText(PlayerStatus.Button.pWindow, "# Offline ~")
guiSetProperty(PlayerStatus.Button.pWindow, "NormalTextColour", "FFFC0000")
guiSetEnabled(GUIEditor.gridlist[1], true)
end
end
end)
 
addEvent( 'SentMessageTo', true )
addEventHandler( 'SentMessageTo', root, function(player, MemoMessages)
  if not sfa7[player] then
      createChat(player)
  end
   local Messages = guiGetText(sfa7[player].Memo)
   if not Messages then Messages = "" end
   Messages = Messages .. getPlayerName(player) .. " : " .. MemoMessages .. "\n"
   guiSetText(sfa7[player].Memo, Messages)
end)
 
addEventHandler( 'onClientGUIDoubleClick', root,
function()
if (source == GUIEditor.gridlist[1]) then
local Selected = guiGridListGetSelectedItem(GUIEditor.gridlist[1])
if (Selected == -1) then return end
local playerSelected = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1], 1))
local playerStatus = getPlayerFromName(playerSelected)
if (playerSelected) then
if (getElementData(playerStatus, "Status") == "Offline") then outputChatBox('* ERROR : #FFFFFF This player is offline !', 255, 0, 0, true) return end
--if (playerStatus == localPlayer) then outputChatBox('* ERROR : #FFFFFF You can't chatting with yourself !', 255, 0, 0, true) return end
if not sfa7[playerSelected] then
createChat(playerStatus)
end
setElementData(localPlayer, "Chatting", playerSelected)
end
end
end)
 
function openChatpWindow()
if (guiGetVisible(Chat.pWindow) == false) then
if (getElementData(localPlayer, "Chatting") ~= nil) then
guiSetInputEnabled(true)
guiSetVisible(Chat.pWindow, true)
showCursor(true)
else guiSetVisible(Chat.pWindow, true) showCursor(true) guiSetInputEnabled(true) end
else
guiSetInputEnabled(false)
guiSetVisible(Chat.pWindow, false)
if Wchat and sfa7[Wchat] and isElement(sfa7[Wchat].ChattingWindow) then
  destroyElement(sfa7[Wchat].ChattingWindow)
  sfa7[Wchat] = nil
  Wchat = false
end
Link to comment

جرب ذا ؟

MoteInfo = {} 
SentMessage = { 
    Button = {} 
} 
MoreInfo = { 
    Button = {} 
} 
Chat = {} 
Message = { 
    Edit = {} 
} 
X = { 
    Button = {} 
} 
Search = { 
    Edit = {} 
} 
Chatting = {} 
PlayerStatus = { 
    Button = {} 
} 
Messages = { 
    Memo = {} 
} 
GUIEditor = { 
    gridlist = {}, 
    label = {} 
} 
  
setElementData(localPlayer, "Chatting", nil) 
setElementData(localPlayer, "Status", "Online") 
local screenW, screenH = guiGetScreenSize() 
Chat.pWindow = guiCreateWindow(screenW - 297 - 10, (screenH - 420) / 2, 297, 420, "# - | Chat system | - #", false) 
guiWindowSetSizable(Chat.pWindow, false) 
guiSetAlpha(Chat.pWindow, 1.00) 
guiSetProperty(Chat.pWindow, "CaptionColour", "FF00F5FE") 
guiSetVisible(Chat.pWindow, false) 
GUIEditor.gridlist[1] = guiCreateGridList(10, 57, 229, 319, false, Chat.pWindow) 
guiGridListSetSelectionMode(GUIEditor.gridlist[1], 0) 
guiSetFont(GUIEditor.gridlist[1], "default-bold-small") 
guiGridListAddColumn(GUIEditor.gridlist[1], "# Player", 0.6) 
guiGridListAddColumn(GUIEditor.gridlist[1], "# Status", 0.3) 
Search.Edit.pWindow = guiCreateEdit(10, 27, 229, 24, "Search", false, Chat.pWindow) 
GUIEditor.label[1] = guiCreateLabel(10, 383, 68, 27, "My status : ", false, Chat.pWindow) 
guiSetFont(GUIEditor.label[1], "default-bold-small") 
guiLabelSetColor(GUIEditor.label[1], 0, 239, 253) 
guiLabelSetVerticalAlign(GUIEditor.label[1], "center") 
PlayerStatus.Button.pWindow = guiCreateButton(88, 383, 151, 27, "# Offline ~", false, Chat.pWindow) 
guiSetFont(PlayerStatus.Button.pWindow, "default-bold-small") 
guiSetProperty(PlayerStatus.Button.pWindow, "NormalTextColour", "FFFC0000") 
X.Button.pWindow = guiCreateButton(257, 383, 30, 27, "X", false, Chat.pWindow) 
guiSetFont(X.Button.pWindow, "default-bold-small") 
guiSetProperty(X.Button.pWindow, "NormalTextColour", "FFFC0000") 
MoreInfo.Button.pWindow = guiCreateButton(257, 27, 30, 27, "؟", false, Chat.pWindow) 
guiSetFont(MoreInfo.Button.pWindow, "default-bold-small") 
guiSetProperty(MoreInfo.Button.pWindow, "NormalTextColour", "FF2FFB00") 
GUIEditor.label[2] = guiCreateLabel(277, 57, 15, 319, "|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|", false, Chat.pWindow) 
guiSetFont(GUIEditor.label[2], "default-bold-small") 
guiLabelSetColor(GUIEditor.label[2], 245, 0, 0) 
guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false) 
guiLabelSetVerticalAlign(GUIEditor.label[2], "center") 
  
  
MoteInfo.MoreInfoWindow = guiCreateWindow(0.54, 0.07, 0.23, 0.17, "# - | More Info about | - #", true) 
guiWindowSetSizable(MoteInfo.MoreInfoWindow, false) 
guiSetAlpha(MoteInfo.MoreInfoWindow, 1.00) 
guiSetProperty(MoteInfo.MoreInfoWindow, "CaptionColour", "FF13FE1E") 
guiSetVisible(MoteInfo.MoreInfoWindow, false) 
GUIEditor.label[3] = guiCreateLabel(10, 21, 98, 23, "- Player status :  ", false, MoteInfo.MoreInfoWindow) 
guiSetFont(GUIEditor.label[3], "default-bold-small") 
guiLabelSetColor(GUIEditor.label[3], 39, 120, 255) 
guiLabelSetVerticalAlign(GUIEditor.label[3], "center") 
GUIEditor.label[4] = guiCreateLabel(10, 44, 243, 46, "* If you set your status to \"Offline\", \n you can't send any message,\n and everyone can't send you a messages", false, MoteInfo.MoreInfoWindow) 
guiSetFont(GUIEditor.label[4], "default-bold-small") 
X.Button.MoreInfoWindow = guiCreateButton(269, 100, 33, 21, "X", false, MoteInfo.MoreInfoWindow) 
guiSetFont(X.Button.MoreInfoWindow, "default-bold-small") 
guiSetProperty(X.Button.MoreInfoWindow, "NormalTextColour", "FFF50000") 
  
  
Chatting.ChattingWindow = guiCreateWindow((screenW - 566) / 2, (screenH - 370) / 2, 566, 370, "", false) 
guiWindowSetSizable(Chatting.ChattingWindow, false) 
guiSetAlpha(Chatting.ChattingWindow, 1.00) 
guiSetProperty(Chatting.ChattingWindow, "CaptionColour", "FF00E6F5") 
guiSetVisible(Chatting.ChattingWindow, false) 
Messages.Memo.ChattingWindow = guiCreateMemo(9, 24, 547, 304, "", false, Chatting.ChattingWindow) 
guiMemoSetReadOnly(Messages.Memo.ChattingWindow, true) 
Message.Edit.ChattingWindow = guiCreateEdit(10, 332, 399, 28, "", false, Chatting.ChattingWindow) 
SentMessage.Button.ChattingWindow = guiCreateButton(413, 332, 93, 28, "# Send ~", false, Chatting.ChattingWindow) 
guiSetFont(SentMessage.Button.ChattingWindow, "default-bold-small") 
guiSetProperty(SentMessage.Button.ChattingWindow, "NormalTextColour", "FF0BF500") 
X.Button.ChattingWindow = guiCreateButton(522, 332, 34, 28, "X", false, Chatting.ChattingWindow) 
guiSetFont(X.Button.ChattingWindow, "default-bold-small") 
guiSetProperty(X.Button.ChattingWindow, "NormalTextColour", "FFF50000") 
  
function refreshList_() 
    guiGridListClear(GUIEditor.gridlist[1]) 
    for _, player_ in ipairs(getElementsByType('player')) do 
        local itemPlayer = guiGridListAddRow(GUIEditor.gridlist[1]) 
        local itemText = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 1, getPlayerName(player_), false, false) 
        local itemStatus = guiGridListSetItemText(GUIEditor.gridlist[1], itemPlayer, 2, getElementData(player_, "Status"), false, false) 
        if (getElementData(player_, "Status") == "Online") then 
            guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 0, 255, 0) 
        else 
            guiGridListSetItemColor(GUIEditor.gridlist[1], itemPlayer, 2, 255, 0, 0) 
        end 
    end 
end 
  
addEvent( 'RefreshList', true ) 
addEventHandler( 'RefreshList', root, 
    function() 
        refreshList_() 
    end 
) 
  
refreshList_() 
  
addEventHandler( 'onClientGUIClick', root, 
    function() 
        if (source == X.Button.pWindow) then 
            guiSetVisible(Chat.pWindow, false) 
            guiSetInputEnabled(false) 
            showCursor(false) 
        elseif (source == X.Button.MoreInfoWindow) then 
            guiSetVisible(MoteInfo.MoreInfoWindow, false) 
        elseif (source == X.Button.ChattingWindow) then 
            guiSetVisible(Chatting.ChattingWindow, false) 
            setElementData(localPlayer, "Chatting", nil) 
        elseif (source == MoreInfo.Button.pWindow) then 
            guiSetVisible(MoteInfo.MoreInfoWindow, true) 
        elseif (source == PlayerStatus.Button.pWindow) then 
            if (guiGetText(PlayerStatus.Button.pWindow) == "# Offline ~") then 
                triggerServerEvent( 'setPlayerStatusOffline', localPlayer ) 
                guiSetText(PlayerStatus.Button.pWindow, "# Online ~") 
                guiSetProperty(PlayerStatus.Button.pWindow, "NormalTextColour", "FF13FE1E") 
                guiSetEnabled(GUIEditor.gridlist[1], false) 
            else 
                triggerServerEvent( 'setPlayerStatusOnline', localPlayer ) 
                guiSetText(PlayerStatus.Button.pWindow, "# Offline ~") 
                guiSetProperty(PlayerStatus.Button.pWindow, "NormalTextColour", "FFFC0000") 
                guiSetEnabled(GUIEditor.gridlist[1], true) 
            end 
        elseif (source == SentMessage.Button.ChattingWindow) then 
            local getMessage = guiGetText(Message.Edit.ChattingWindow) 
            if (getMessage == "") then outputChatBox('* ERROR : #FFFFFF Please write a message !', 255, 0, 0, true) return end 
            local playerSelected_ = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1], 1)) 
            guiSetText (Messages.Memo.ChattingWindow, "" ..guiGetText(Messages.Memo.ChattingWindow).. "\n"..getPlayerName(localPlayer).." : "..guiGetText (Message.Edit.ChattingWindow).."") 
            local playerName = getPlayerName(localPlayer) 
            local MemoMessages = guiGetText(Messages.Memo.ChattingWindow) 
            local getMessage_ = guiGetText(Message.Edit.ChattingWindow) 
            local playerSource = getPlayerFromName(playerSelected_) 
            triggerServerEvent ( "SentMessageToPlayer", localPlayer, MemoMessages, playerSource, getMessage_) 
            guiSetText(Message.Edit.ChattingWindow, "") 
        end 
    end 
) 
  
addEvent( 'SentMessageTo', true ) 
addEventHandler( 'SentMessageTo', root, 
    function(MemoMessages, playerName, getMessage_ ) 
        guiSetText (Messages.Memo.ChattingWindow,"" ..MemoMessages.. "\n" ..playerName.. " : " ..getMessage_.. "") 
    end 
) 
  
addEventHandler( 'onClientGUIDoubleClick', root, 
    function() 
        if (source == GUIEditor.gridlist[1]) then 
            local Selected = guiGridListGetSelectedItem(GUIEditor.gridlist[1]) 
            if (Selected == -1) then return end 
            local playerSelected = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1], 1)) 
            local playerStatus = getPlayerFromName(playerSelected) 
            if (playerSelected) then 
                if (getElementData(playerStatus, "Status") == "Offline") then outputChatBox('* ERROR : #FFFFFF This player is offline !', 255, 0, 0, true) return end 
                --if (playerStatus == localPlayer) then outputChatBox('* ERROR : #FFFFFF You can't chatting with yourself !', 255, 0, 0, true) return end 
                guiSetVisible(Chatting.ChattingWindow, true) 
                guiSetText(Chatting.ChattingWindow, playerSelected) 
                setElementData(localPlayer, "Chatting", playerSelected) 
            end 
        end 
    end 
) 
  
function openChatpWindow() 
    if (guiGetVisible(Chat.pWindow) == false) then 
        if (getElementData(localPlayer, "Chatting") ~= nil) then 
            guiSetInputEnabled(true) 
            guiSetVisible(Chatting.ChattingWindow, true) 
            guiSetVisible(Chat.pWindow, true) 
            showCursor(true) 
        else 
            guiSetVisible(Chat.pWindow, true) showCursor(true) guiSetInputEnabled(true) end 
    else 
        guiSetInputEnabled(false) 
        guiSetVisible(Chat.pWindow, false) 
        guiSetVisible(Chatting.ChattingWindow, false) 
        showCursor(false) 
    end 
end 
bindKey( "F2", "down", openChatpWindow) 
  

addEvent( 'SentMessageToPlayer', true ) 
addEventHandler( 'SentMessageToPlayer', root, 
    function(MemoMessages, thePlayer, getMessage_) 
        local name = getPlayerName(source) 
        triggerClientEvent( thePlayer, "SentMessageTo", thePlayer, MemoMessages, name, getMessage_ ) 
    end 
) 
  
addEventHandler( 'onPlayerChangeNick', root, 
    function() 
        triggerClientEvent( 'RefreshList', source ) 
    end 
) 
  
addEventHandler( 'onPlayerQuit', root, 
    function() 
        triggerClientEvent( 'RefreshList', source ) 
    end 
) 
  
addEventHandler( 'onPlayerJoin', root, 
    function() 
        setElementData(source, "Status", "Online") 
        triggerClientEvent( 'RefreshList', source ) 
    end 
) 
  
  
  
addEvent( 'setPlayerStatusOffline', true ) 
addEventHandler( 'setPlayerStatusOffline', root, 
    function() 
        setElementData(source, "Status", "Offline") 
        triggerClientEvent( 'RefreshList', source ) 
    end 
) 
  
  
addEvent( 'setPlayerStatusOnline', true ) 
addEventHandler( 'setPlayerStatusOnline', root, 
    function() 
        setElementData(source, "Status", "Online") 
        triggerClientEvent( 'RefreshList', source ) 
    end 
) 
  

Link to comment
function openChatpWindow() 
if (guiGetVisible(Chat.pWindow) == false) then 
if (getElementData(localPlayer, "Chatting") ~= nil) then 
guiSetInputEnabled(true) 
guiSetVisible(Chat.pWindow, true) 
showCursor(true) 
else guiSetVisible(Chat.pWindow, true) showCursor(true) guiSetInputEnabled(true) end 
else 
guiSetInputEnabled(false) 
guiSetVisible(Chat.pWindow, false) 
if Wchat and sfa7[Wchat] and isElement(sfa7[Wchat].ChattingWindow) then 
  destroyElement(sfa7[Wchat].ChattingWindow) 
  sfa7[Wchat] = nil 
  Wchat = false 
end 
showCursor(false) 
end 
end 
bindKey('F2', 'down', openChatpWindow) 

اللوحة يوم اراسل شخص واغلق اف 2

وارجع افتحها على اساس الاقي لوحة المراسلة حقتي

ماتظهر ^

Link to comment

آمم مآ كـآن علـى بآلـي أنك تبيهـا كذآ ع العمـوم الكـود يصـير كذا

لم تتـم التـجربة:

function openChatpWindow() 
if (guiGetVisible(Chat.pWindow) == false) then 
if (getElementData(localPlayer, "Chatting") ~= nil) then 
guiSetInputEnabled(true) 
guiSetVisible(Chat.pWindow, true) 
if Wchat and type(Wchat) == 'table' then 
createChat(Wchat[2]) 
end 
showCursor(true) 
else guiSetVisible(Chat.pWindow, true) showCursor(true) guiSetInputEnabled(true) end 
else 
guiSetInputEnabled(false) 
guiSetVisible(Chat.pWindow, false) 
if Wchat and sfa7[Wchat] and isElement(sfa7[Wchat].ChattingWindow) then 
  destroyElement(sfa7[Wchat].ChattingWindow) 
  sfa7[Wchat] = nil 
  Wchat = {true,Wchat} 
end 
showCursor(false) 
end 
end 
bindKey('F2', 'down', openChatpWindow) 
Link to comment
آمم مآ كـآن علـى بآلـي أنك تبيهـا كذآ ع العمـوم الكـود يصـير كذا

لم تتـم التـجربة:

function openChatpWindow() 
if (guiGetVisible(Chat.pWindow) == false) then 
if (getElementData(localPlayer, "Chatting") ~= nil) then 
guiSetInputEnabled(true) 
guiSetVisible(Chat.pWindow, true) 
if Wchat and type(Wchat) == 'table' then 
createChat(Wchat[2]) 
end 
showCursor(true) 
else guiSetVisible(Chat.pWindow, true) showCursor(true) guiSetInputEnabled(true) end 
else 
guiSetInputEnabled(false) 
guiSetVisible(Chat.pWindow, false) 
if Wchat and sfa7[Wchat] and isElement(sfa7[Wchat].ChattingWindow) then 
  destroyElement(sfa7[Wchat].ChattingWindow) 
  sfa7[Wchat] = nil 
  Wchat = {true,Wchat} 
end 
showCursor(false) 
end 
end 
bindKey('F2', 'down', openChatpWindow) 

باقي تحط كود جلب النص حق الميمو للأشخاص الي مراسلهم بعد ما اغلق وافتح اف 2 :)

Link to comment

function openChatpWindow() 
if (guiGetVisible(Chat.pWindow) == false) then 
if (getElementData(localPlayer, "Chatting") ~= nil) then 
guiSetInputEnabled(true) 
guiSetVisible(Chat.pWindow, true) 
if Wchat and type(Wchat) == 'table' then 
createChat(Wchat[2]) 
if TextSave and TextSave ~= '' then 
guiSetText(sfa7[Wchat].Memo,TextSave) 
end 
end 
showCursor(true) 
else guiSetVisible(Chat.pWindow, true) showCursor(true) guiSetInputEnabled(true) end 
else 
guiSetInputEnabled(false) 
guiSetVisible(Chat.pWindow, false) 
if Wchat and sfa7[Wchat] and isElement(sfa7[Wchat].ChattingWindow) then 
  local text = guiGetText(sfa7[Wchat].Memo) 
  if text and text ~= '' then 
  TextSave = text 
  end 
  destroyElement(sfa7[Wchat].ChattingWindow) 
  sfa7[Wchat] = nil 
  Wchat = {true,Wchat} 
end 
showCursor(false) 
end 
end 
bindKey('F2', 'down', openChatpWindow) 
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...