Jump to content

# مساعدههـ


Recommended Posts

8 minutes ago, Rakan# said:

اطرح اكواد الكلنت


 
  1. local mainKey = 'F2' -- The key to open panel </>
  2.  
  3.  
  4.  
  5.  
  6. GUIEditor = {
  7. gridlist = {},
  8. button = {},
  9. edit = {},
  10. label = {}
  11. }
  12. addEventHandler("onClientResourceStart", resourceRoot,
  13. function()
  14. privtechat = guiCreateWindow(0, 203, 464, 473, "|#| الــدردشــات الــخـــاصــة |#|", false)
  15. guiWindowSetSizable(privtechat, false)
  16. guiSetAlpha(privtechat, 1.00)
  17. guiSetVisible(privtechat, false)
  18. GUIEditor.edit[1] = guiCreateEdit(9, 31, 260, 41, "", false, privtechat)
  19. GUIEditor.gridlist[1] = guiCreateGridList(9, 88, 270, 375, false, privtechat)
  20. guiGridListAddColumn(GUIEditor.gridlist[1], "الاعــبــيــن ..#", 0.9)
  21. GUIEditor.label[1] = guiCreateLabel(324, 40, 85, 22, "Player Name ", false, privtechat)
  22. guiSetFont(GUIEditor.label[1], "default-bold-small")
  23. GUIEditor.label[2] = guiCreateLabel(279, 34, 44, 38, "*", false, privtechat)
  24. guiSetFont(GUIEditor.label[2], "sa-gothic")
  25. guiLabelSetColor(GUIEditor.label[2], 255, 0, 0)
  26. GUIEditor.label[3] = guiCreateLabel(399, 34, 44, 38, "*", false, privtechat)
  27. guiSetFont(GUIEditor.label[3], "sa-gothic")
  28. guiLabelSetColor(GUIEditor.label[3], 255, 0, 0)
  29. GUIEditor.button[1] = guiCreateButton(281, 202, 173, 51, "|#| فـــتـــح الــدردشــة |#|", false, privtechat)
  30. guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF00FE00")
  31. GUIEditor.button[5] = guiCreateButton(281, 263, 173, 51, "|#| أغـــلاق |=| Close |#|", false, privtechat)
  32. guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFFF0000")
  33. GUIEditor.label[5] = guiCreateLabel(283, 430, 181, 16, "===================", false, privtechat)
  34. guiLabelSetColor(GUIEditor.label[5], 250, 2, 154)
  35. GUIEditor.label[6] = guiCreateLabel(283, 98, 181, 16, "Mr.Grand", false, privtechat)
  36. guiLabelSetColor(GUIEditor.label[6], 48, 203, 55)
  37.  
  38. end
  39. )
  40.  
  41.  
  42.  
  43. bindKey( mainKey, 'down', function( )
  44. guiSetVisible( privtechat, not guiGetVisible( privtechat ) )
  45. showCursor( guiGetVisible( privtechat ) )
  46. guiSetInputEnabled( guiGetVisible( privtechat ) )
  47. for cNumber, _ in pairs( chat_Windows ) do
  48. guiSetVisible( chat_Windows[cNumber].window, guiGetVisible( privtechat ) )
  49. end
  50. end );
  51.  
  52.  
  53. addEventHandler( 'onClientGUIChanged', root,
  54. function( )
  55. if ( source == GUIEditor.edit[1] ) then
  56. local plrString = guiGetText( GUIEditor.edit[1] )
  57. if ( plrString == '' or not plrString ) then
  58. guiGridListClear( GUIEditor.gridlist[1] )
  59. for _, player in ipairs( getElementsByType( 'player' ) ) do
  60. addPlayer( player )
  61. return end
  62. if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
  63. guiGridListClear( GUIEditor.gridlist[1] )
  64. for _, player in ipairs( getElementsByType( 'player' ) ) do
  65. if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
  66. addOnlinePlayer( player )
  67. end
  68. end
  69. elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
  70. guiGridListClear( GUIEditor.gridlist[1] )
  71. for _, player in ipairs( getElementsByType( 'player' ) ) do
  72. if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
  73. addOfflinePlayer( player )
  74. end
  75. end
  76. elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
  77. guiGridListClear( GUIEditor.gridlist[1] )
  78. for _, player in ipairs( getElementsByType( 'player' ) ) do
  79. addPlayer( player )
  80. end
  81. end
  82. else
  83. guiGridListClear( GUIEditor.gridlist[1] )
  84. for _, player in ipairs( getElementsByType( 'player' ) ) do
  85. if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
  86. addPlayer( player )
  87. end return end
  88. if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
  89. guiGridListClear( GUIEditor.gridlist[1] )
  90. for _, player in ipairs( getElementsByType( 'player' ) ) do
  91. if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
  92. if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
  93. addOnlinePlayer( player )
  94. end
  95. end
  96. end
  97. elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
  98. guiGridListClear( GUIEditor.gridlist[1] )
  99. for _, player in ipairs( getElementsByType( 'player' ) ) do
  100. if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
  101. if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
  102. addOfflinePlayer( player )
  103. end
  104. end
  105. end
  106. elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
  107. guiGridListClear( GUIEditor.gridlist[1] )
  108. for _, player in ipairs( getElementsByType( 'player' ) ) do
  109. if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
  110. addPlayer( player )
  111. end
  112. end
  113. end
  114. end
  115. end
  116. end );
  117.  
  118. function checkIfTextChanged( player, text )
  119. setTimer( function( )
  120. if ( guiGetText( chat_Windows[player].editBox ) == text ) then
  121. triggerServerEvent( 'onServerCheckHide', Cplayer, player )
  122. end
  123. end, 1000, 1 )
  124. end;
  125.  
  126. addEvent( 'onClientPokePlayer', true );
  127. addEventHandler( 'onClientPokePlayer', root,
  128. function( pokedBy )
  129. if ( getElementData( Cplayer, 'donotDisturb' ) ~= 'Enabled' ) then
  130. playSound( 'Wakeup.mp3' )
  131. outputChatBox( '#FFFF00• Chat System :#FFFFFF The player : [ '..pokedBy..' ] - Poked you !', 255, 255, 255, true )
  132. end
  133. end );
  134.  
  135. addEvent( 'onClientChangeButton', true );
  136. addEventHandler( 'onClientChangeButton', root,
  137. function( Text )
  138. guiSetText( GUIEditor.button[2], Text )
  139. end );
  140.  
  141. function buildChattingWith( )
  142. local row, column = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
  143. if ( row == -1 or column == -1 ) then return end
  144. local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], row, column ) )
  145. if ( getElementData( player, 'chatStatus' ) ~= 'Online' ) then
  146. outputChatBox( '#FF0000• ERROR :#FFFFFF Sorry, You cannot send a message to this player .. it\'s offline !', 255, 255, 255, true ) return end
  147. if ( not chat_Windows[player] ) then
  148. BuildChatting( player )
  149. guiBringToFront( chat_Windows[player].window )
  150. end
  151. end;
  152. addEvent( 'buildChattingWith', true ); addEventHandler( 'buildChattingWith', root, buildChattingWith )
  153.  
  154. function privateChatDoubleClicks( )
  155. if ( source == GUIEditor.gridlist[1] ) then
  156. local Sel = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
  157. if ( Sel == -1 ) then return end
  158. local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], Sel, 1 ) )
  159. if ( player == Cplayer ) then outputChatBox( '#FF0000• ERROR :#FFFFFF You cannot chatting with yourself !', 255, 255, 255, true ) return end
  160. local serial = getElementData( player, 'chatSystem;playerSerial' )
  161. triggerServerEvent( 'onServerCheckIfBlocked', Cplayer, serial )
  162. end
  163. end;
  164. addEventHandler( 'onClientGUIDoubleClick', root, privateChatDoubleClicks );
  165.  
  166.  
  167. addEvent( 'onClientReceiveMessage', true );
  168. addEventHandler( 'onClientReceiveMessage', root,
  169. function( player, message )
  170. if ( not chat_Windows[player] ) then
  171. BuildChatting( player )
  172. end
  173. local oldMessages = guiGetText( chat_Windows[player].memo )
  174. local newString = oldMessages..getPlayerName( player ):gsub( '#%x%x%x%x%x%x', '' )..' : '..message..'\n'
  175. guiSetText( chat_Windows[player].memo, newString )
  176. guiMemoSetCaretIndex( chat_Windows[player].memo, string.len( oldMessages ) )
  177. if ( guiGetVisible( GUIEditor.window[1] ) == false ) then
  178. if ( getElementData( Cplayer, 'donotDisturb' ) ~= 'Enabled' ) then
  179. outputChatBox( '#FFFF00• Chat System :#FFFFFF The player : [ '..getPlayerName( player )..' ] - Sent you a message !', 255, 255, 255, true )
  180. playSound( 'Message.mp3' )
  181. end
  182. end
  183. end );
  184.  
  185. function addPlayer( player )
  186. local data = getElementData( player, 'chatStatus' ) or 'Online'
  187. local name = getPlayerName( player )
  188. local r, g, b = getPlayerNametagColor( player )
  189. local row = guiGridListAddRow( GUIEditor.gridlist[1] )
  190. guiGridListSetItemText( GUIEditor.gridlist[1], row, 1, name, false, false )
  191. guiGridListSetItemText( GUIEditor.gridlist[1], row, 2, data, false, false )
  192. guiGridListSetItemColor( GUIEditor.gridlist[1], row, 1, r, g, b )
  193. if ( data == 'Online' ) then
  194. guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 0, 200, 0 )
  195. else
  196. guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 200, 0, 0 )
  197. end
  198. end;
  199.  
  200. function addOnlinePlayer( player )
  201. local data = getElementData( player, 'chatStatus' ) or 'Online'
  202. if ( data == 'Online' ) then
  203. local name = getPlayerName( player )
  204. local r, g, b = getPlayerNametagColor( player )
  205. local row = guiGridListAddRow( GUIEditor.gridlist[1] )
  206. guiGridListSetItemText( GUIEditor.gridlist[1], row, 1, name, false, false )
  207. guiGridListSetItemText( GUIEditor.gridlist[1], row, 2, data, false, false )
  208. guiGridListSetItemColor( GUIEditor.gridlist[1], row, 1, r, g, b )
  209. guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 0, 200, 0 )
  210. end
  211. end;
  212.  
  213. function addOfflinePlayer( player )
  214. local data = getElementData( player, 'chatStatus' ) or 'Offline'
  215. if ( data == 'Offline' ) then
  216. local name = getPlayerName( player )
  217. local r, g, b = getPlayerNametagColor( player )
  218. local row = guiGridListAddRow( GUIEditor.gridlist[1] )
  219. guiGridListSetItemText( GUIEditor.gridlist[1], row, 1, name, false, false )
  220. guiGridListSetItemText( GUIEditor.gridlist[1], row, 2, data, false, false )
  221. guiGridListSetItemColor( GUIEditor.gridlist[1], row, 1, r, g, b )
  222. guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 200, 0, 0 )
  223. end
  224. end;
  225.  
  226. function player_Quit( player )
  227. removePlayer( player )
  228. destroyChattingWindow( player )
  229. end;
  230. addEvent( 'onClientRemovePlayer', true ); addEventHandler( 'onClientRemovePlayer', root, player_Quit )
  231.  
  232. function player_ChangedName( player, name )
  233. for i = 0, guiGridListGetRowCount( GUIEditor.gridlist[1] ) do
  234. if ( guiGridListGetItemText( GUIEditor.gridlist[1], i, 1 ) == name ) then
  235. guiGridListRemoveRow( GUIEditor.gridlist[1], i )
  236. end
  237. end
  238. destroyChattingWindow( player )
  239. setTimer( function( )
  240. local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
  241. if ( Sel == -1 ) then addPlayer( player ) return end
  242. if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
  243. guiGridListClear( GUIEditor.gridlist[1] )
  244. for _, player in ipairs( getElementsByType( 'player' ) ) do
  245. if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
  246. addOnlinePlayer( player )
  247. end
  248. end
  249. elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
  250. guiGridListClear( GUIEditor.gridlist[1] )
  251. for _, player in ipairs( getElementsByType( 'player' ) ) do
  252. if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
  253. addOfflinePlayer( player )
  254. end
  255. end
  256. elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
  257. guiGridListClear( GUIEditor.gridlist[1] )
  258. for _, player in ipairs( getElementsByType( 'player' ) ) do
  259. addPlayer( player )
  260. end
  261. end
  262. end, 1500, 1 )
  263. end;
  264. addEvent( 'onClientRemovePlayer_ChangedName', true ); addEventHandler( 'onClientRemovePlayer_ChangedName', root, player_ChangedName
  265. )
  266.  
  267. function sendMessage( eleEdit )
  268. local parent = getElementParent( source )
  269. if ( parent == false or not parent ) then return end
  270. local player = getPlayerFromName( guiGetText( parent ) )
  271. if ( player == false or not player ) then return end
  272. if ( eleEdit == chat_Windows[player].editBox ) then
  273. sendNewMessage( player )
  274. end
  275. end;
  276.  
  277. addEventHandler( 'onClientGUIAccepted', root, sendMessage );
  278.  
  279.  
  280. addEventHandler( 'onClientResourceStart', resourceRoot,
  281. function( )
  282. triggerServerEvent( 'onServerSetPlayerSerial', Cplayer )
  283. setTimer( function( )
  284. for _, player in ipairs( getElementsByType( 'player' ) ) do
  285. addPlayer( player )
  286. end
  287. end, 1000, 1 )
  288. end );
  • Sad 1
Link to comment

اكوادك ناقصه !!

لكن حاولت اسويها مع انها ناقصه . تفضل

local mainKey = 'F2' -- The key to open panel </>
 
 
 
 
GUIEditor = {
gridlist = {},
button = {},
edit = {},
label = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
function()
privtechat = guiCreateWindow(0, 203, 464, 473, "|#| الــدردشــات الــخـــاصــة |#|", false)
guiWindowSetSizable(privtechat, false)
guiSetAlpha(privtechat, 1.00)
guiSetVisible(privtechat, false)
GUIEditor.edit[1] = guiCreateEdit(9, 31, 260, 41, "", false, privtechat)
GUIEditor.gridlist[1] = guiCreateGridList(9, 88, 270, 375, false, privtechat)
guiGridListAddColumn(GUIEditor.gridlist[1], "الاعــبــيــن ..#", 0.9)
GUIEditor.label[1] = guiCreateLabel(324, 40, 85, 22, "Player Name ", false, privtechat)
guiSetFont(GUIEditor.label[1], "default-bold-small")
GUIEditor.label[2] = guiCreateLabel(279, 34, 44, 38, "*", false, privtechat)
guiSetFont(GUIEditor.label[2], "sa-gothic")
guiLabelSetColor(GUIEditor.label[2], 255, 0, 0)
GUIEditor.label[3] = guiCreateLabel(399, 34, 44, 38, "*", false, privtechat)
guiSetFont(GUIEditor.label[3], "sa-gothic")
guiLabelSetColor(GUIEditor.label[3], 255, 0, 0)
GUIEditor.button[1] = guiCreateButton(281, 202, 173, 51, "|#| فـــتـــح الــدردشــة |#|", false, privtechat)
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF00FE00")
GUIEditor.button[5] = guiCreateButton(281, 263, 173, 51, "|#| أغـــلاق |=| Close |#|", false, privtechat)
guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFFF0000")
GUIEditor.label[5] = guiCreateLabel(283, 430, 181, 16, "===================", false, privtechat)
guiLabelSetColor(GUIEditor.label[5], 250, 2, 154)
GUIEditor.label[6] = guiCreateLabel(283, 98, 181, 16, "Mr.Grand", false, privtechat)
guiLabelSetColor(GUIEditor.label[6], 48, 203, 55)
 
end
)
 
 
 
bindKey( mainKey, 'down', function( )
guiSetVisible( privtechat, not guiGetVisible( privtechat ) )
showCursor( guiGetVisible( privtechat ) )
guiSetInputEnabled( guiGetVisible( privtechat ) )
for cNumber, _ in pairs( chat_Windows ) do
if cNumber and isElement(cNumber) and getElementType(cNumber) == "player" then
guiSetVisible( chat_Windows[cNumber].window, guiGetVisible( privtechat ) )
else
destroyElement(chat_Windows[cNumber].window)
end
end
end );
 
 
addEventHandler( 'onClientGUIChanged', root,
function( )
if ( source == GUIEditor.edit[1] ) then
local plrString = guiGetText( GUIEditor.edit[1] )
if ( plrString == '' or not plrString ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
addPlayer( player )
return end
if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
addOnlinePlayer( player )
end
end
elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
addOfflinePlayer( player )
end
end
elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
addPlayer( player )
end
end
else
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
addPlayer( player )
end return end
if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
addOnlinePlayer( player )
end
end
end
elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
addOfflinePlayer( player )
end
end
end
elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
addPlayer( player )
end
end
end
end
end
end );
 
function checkIfTextChanged( player, text )
setTimer( function( )
if ( guiGetText( chat_Windows[player].editBox ) == text ) then
triggerServerEvent( 'onServerCheckHide', Cplayer, player )
end
end, 1000, 1 )
end;
 
addEvent( 'onClientPokePlayer', true );
addEventHandler( 'onClientPokePlayer', root,
function( pokedBy )
if ( getElementData( Cplayer, 'donotDisturb' ) ~= 'Enabled' ) then
playSound( 'Wakeup.mp3' )
outputChatBox( '#FFFF00• Chat System :#FFFFFF The player : [ '..pokedBy..' ] - Poked you !', 255, 255, 255, true )
end
end );
 
addEvent( 'onClientChangeButton', true );
addEventHandler( 'onClientChangeButton', root,
function( Text )
guiSetText( GUIEditor.button[2], Text )
end );
 
function buildChattingWith( )
local row, column = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
if ( row == -1 or column == -1 ) then return end
local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], row, column ) )
if ( getElementData( player, 'chatStatus' ) ~= 'Online' ) then
outputChatBox( '#FF0000• ERROR :#FFFFFF Sorry, You cannot send a message to this player .. it\'s offline !', 255, 255, 255, true ) return end
if ( not chat_Windows[player] ) then
BuildChatting( player )
guiBringToFront( chat_Windows[player].window )
end
end;
addEvent( 'buildChattingWith', true ); addEventHandler( 'buildChattingWith', root, buildChattingWith )
 
function privateChatDoubleClicks( )
if ( source == GUIEditor.gridlist[1] ) then
local Sel = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
if ( Sel == -1 ) then return end
local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], Sel, 1 ) )
if ( player == Cplayer ) then outputChatBox( '#FF0000• ERROR :#FFFFFF You cannot chatting with yourself !', 255, 255, 255, true ) return end
local serial = getElementData( player, 'chatSystem;playerSerial' )
triggerServerEvent( 'onServerCheckIfBlocked', Cplayer, serial )
end
end;
addEventHandler( 'onClientGUIDoubleClick', root, privateChatDoubleClicks );
 
 -- BuildChatting
addEvent( 'onClientReceiveMessage', true );
addEventHandler( 'onClientReceiveMessage', root,
function( player, message )
if ( not chat_Windows[player] ) then
BuildChatting( player )
end
local oldMessages = guiGetText( chat_Windows[player].memo )
local newString = oldMessages..getPlayerName( player ):gsub( '#%x%x%x%x%x%x', '' )..' : '..message..'\n'
guiSetText( chat_Windows[player].memo, newString )
guiMemoSetCaretIndex( chat_Windows[player].memo, string.len( oldMessages ) )
if ( guiGetVisible( GUIEditor.window[1] ) == false ) then
if ( getElementData( Cplayer, 'donotDisturb' ) ~= 'Enabled' ) then
outputChatBox( '#FFFF00• Chat System :#FFFFFF The player : [ '..getPlayerName( player )..' ] - Sent you a message !', 255, 255, 255, true )
playSound( 'Message.mp3' )
end
end
end );
 
function addPlayer( player )
local data = getElementData( player, 'chatStatus' ) or 'Online'
local name = getPlayerName( player )
local r, g, b = getPlayerNametagColor( player )
local row = guiGridListAddRow( GUIEditor.gridlist[1] )
guiGridListSetItemText( GUIEditor.gridlist[1], row, 1, name, false, false )
guiGridListSetItemText( GUIEditor.gridlist[1], row, 2, data, false, false )
guiGridListSetItemColor( GUIEditor.gridlist[1], row, 1, r, g, b )
if ( data == 'Online' ) then
guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 0, 200, 0 )
else
guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 200, 0, 0 )
end
end;
 
function addOnlinePlayer( player )
local data = getElementData( player, 'chatStatus' ) or 'Online'
if ( data == 'Online' ) then
local name = getPlayerName( player )
local r, g, b = getPlayerNametagColor( player )
local row = guiGridListAddRow( GUIEditor.gridlist[1] )
guiGridListSetItemText( GUIEditor.gridlist[1], row, 1, name, false, false )
guiGridListSetItemText( GUIEditor.gridlist[1], row, 2, data, false, false )
guiGridListSetItemColor( GUIEditor.gridlist[1], row, 1, r, g, b )
guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 0, 200, 0 )
end
end;
 
function addOfflinePlayer( player )
local data = getElementData( player, 'chatStatus' ) or 'Offline'
if ( data == 'Offline' ) then
local name = getPlayerName( player )
local r, g, b = getPlayerNametagColor( player )
local row = guiGridListAddRow( GUIEditor.gridlist[1] )
guiGridListSetItemText( GUIEditor.gridlist[1], row, 1, name, false, false )
guiGridListSetItemText( GUIEditor.gridlist[1], row, 2, data, false, false )
guiGridListSetItemColor( GUIEditor.gridlist[1], row, 1, r, g, b )
guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 200, 0, 0 )
end
end;
 
function player_Quit( player )
removePlayer( player )
destroyChattingWindow( player )
end;
addEvent( 'onClientRemovePlayer', true ); addEventHandler( 'onClientRemovePlayer', root, player_Quit )
 
function player_ChangedName( player, name )
for i = 0, guiGridListGetRowCount( GUIEditor.gridlist[1] ) do
if ( guiGridListGetItemText( GUIEditor.gridlist[1], i, 1 ) == name ) then
guiGridListRemoveRow( GUIEditor.gridlist[1], i )
end
end
destroyChattingWindow( player )
setTimer( function( )
local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
if ( Sel == -1 ) then addPlayer( player ) return end
if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
addOnlinePlayer( player )
end
end
elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
addOfflinePlayer( player )
end
end
elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
addPlayer( player )
end
end
end, 1500, 1 )
end;
addEvent( 'onClientRemovePlayer_ChangedName', true ); addEventHandler( 'onClientRemovePlayer_ChangedName', root, player_ChangedName
)
 
function sendMessage( eleEdit )
local parent = getElementParent( source )
if ( parent == false or not parent ) then return end
local player = getPlayerFromName( guiGetText( parent ) )
if ( player == false or not player ) then return end
if ( eleEdit == chat_Windows[player].editBox ) then
sendNewMessage( player )
end
end;
 
addEventHandler( 'onClientGUIAccepted', root, sendMessage );
 
 
addEventHandler( 'onClientResourceStart', resourceRoot,
function( )
triggerServerEvent( 'onServerSetPlayerSerial', Cplayer )
setTimer( function( )
for _, player in ipairs( getElementsByType( 'player' ) ) do
addPlayer( player )
end
end, 1000, 1 )
end );

 

  • Like 1
Link to comment
2 minutes ago, AbU - W6N said:

مود مستر قراند :| 

اعلم انو مود مستر جراند

واتمني انك تدخل تساعدني مب تقول انو مود مستر جراند

25 minutes ago, Rakan# said:

اكوادك ناقصه !!

لكن حاولت اسويها مع انها ناقصه . تفضل


local mainKey = 'F2' -- The key to open panel </>
 
 
 
 
GUIEditor = {
gridlist = {},
button = {},
edit = {},
label = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
function()
privtechat = guiCreateWindow(0, 203, 464, 473, "|#| الــدردشــات الــخـــاصــة |#|", false)
guiWindowSetSizable(privtechat, false)
guiSetAlpha(privtechat, 1.00)
guiSetVisible(privtechat, false)
GUIEditor.edit[1] = guiCreateEdit(9, 31, 260, 41, "", false, privtechat)
GUIEditor.gridlist[1] = guiCreateGridList(9, 88, 270, 375, false, privtechat)
guiGridListAddColumn(GUIEditor.gridlist[1], "الاعــبــيــن ..#", 0.9)
GUIEditor.label[1] = guiCreateLabel(324, 40, 85, 22, "Player Name ", false, privtechat)
guiSetFont(GUIEditor.label[1], "default-bold-small")
GUIEditor.label[2] = guiCreateLabel(279, 34, 44, 38, "*", false, privtechat)
guiSetFont(GUIEditor.label[2], "sa-gothic")
guiLabelSetColor(GUIEditor.label[2], 255, 0, 0)
GUIEditor.label[3] = guiCreateLabel(399, 34, 44, 38, "*", false, privtechat)
guiSetFont(GUIEditor.label[3], "sa-gothic")
guiLabelSetColor(GUIEditor.label[3], 255, 0, 0)
GUIEditor.button[1] = guiCreateButton(281, 202, 173, 51, "|#| فـــتـــح الــدردشــة |#|", false, privtechat)
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF00FE00")
GUIEditor.button[5] = guiCreateButton(281, 263, 173, 51, "|#| أغـــلاق |=| Close |#|", false, privtechat)
guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFFF0000")
GUIEditor.label[5] = guiCreateLabel(283, 430, 181, 16, "===================", false, privtechat)
guiLabelSetColor(GUIEditor.label[5], 250, 2, 154)
GUIEditor.label[6] = guiCreateLabel(283, 98, 181, 16, "Mr.Grand", false, privtechat)
guiLabelSetColor(GUIEditor.label[6], 48, 203, 55)
 
end
)
 
 
 
bindKey( mainKey, 'down', function( )
guiSetVisible( privtechat, not guiGetVisible( privtechat ) )
showCursor( guiGetVisible( privtechat ) )
guiSetInputEnabled( guiGetVisible( privtechat ) )
for cNumber, _ in pairs( chat_Windows ) do
if cNumber and isElement(cNumber) and getElementType(cNumber) == "player" then
guiSetVisible( chat_Windows[cNumber].window, guiGetVisible( privtechat ) )
else
destroyElement(chat_Windows[cNumber].window)
end
end
end );
 
 
addEventHandler( 'onClientGUIChanged', root,
function( )
if ( source == GUIEditor.edit[1] ) then
local plrString = guiGetText( GUIEditor.edit[1] )
if ( plrString == '' or not plrString ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
addPlayer( player )
return end
if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
addOnlinePlayer( player )
end
end
elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
addOfflinePlayer( player )
end
end
elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
addPlayer( player )
end
end
else
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
addPlayer( player )
end return end
if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
addOnlinePlayer( player )
end
end
end
elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
addOfflinePlayer( player )
end
end
end
elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
addPlayer( player )
end
end
end
end
end
end );
 
function checkIfTextChanged( player, text )
setTimer( function( )
if ( guiGetText( chat_Windows[player].editBox ) == text ) then
triggerServerEvent( 'onServerCheckHide', Cplayer, player )
end
end, 1000, 1 )
end;
 
addEvent( 'onClientPokePlayer', true );
addEventHandler( 'onClientPokePlayer', root,
function( pokedBy )
if ( getElementData( Cplayer, 'donotDisturb' ) ~= 'Enabled' ) then
playSound( 'Wakeup.mp3' )
outputChatBox( '#FFFF00• Chat System :#FFFFFF The player : [ '..pokedBy..' ] - Poked you !', 255, 255, 255, true )
end
end );
 
addEvent( 'onClientChangeButton', true );
addEventHandler( 'onClientChangeButton', root,
function( Text )
guiSetText( GUIEditor.button[2], Text )
end );
 
function buildChattingWith( )
local row, column = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
if ( row == -1 or column == -1 ) then return end
local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], row, column ) )
if ( getElementData( player, 'chatStatus' ) ~= 'Online' ) then
outputChatBox( '#FF0000• ERROR :#FFFFFF Sorry, You cannot send a message to this player .. it\'s offline !', 255, 255, 255, true ) return end
if ( not chat_Windows[player] ) then
BuildChatting( player )
guiBringToFront( chat_Windows[player].window )
end
end;
addEvent( 'buildChattingWith', true ); addEventHandler( 'buildChattingWith', root, buildChattingWith )
 
function privateChatDoubleClicks( )
if ( source == GUIEditor.gridlist[1] ) then
local Sel = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
if ( Sel == -1 ) then return end
local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], Sel, 1 ) )
if ( player == Cplayer ) then outputChatBox( '#FF0000• ERROR :#FFFFFF You cannot chatting with yourself !', 255, 255, 255, true ) return end
local serial = getElementData( player, 'chatSystem;playerSerial' )
triggerServerEvent( 'onServerCheckIfBlocked', Cplayer, serial )
end
end;
addEventHandler( 'onClientGUIDoubleClick', root, privateChatDoubleClicks );
 
 -- BuildChatting
addEvent( 'onClientReceiveMessage', true );
addEventHandler( 'onClientReceiveMessage', root,
function( player, message )
if ( not chat_Windows[player] ) then
BuildChatting( player )
end
local oldMessages = guiGetText( chat_Windows[player].memo )
local newString = oldMessages..getPlayerName( player ):gsub( '#%x%x%x%x%x%x', '' )..' : '..message..'\n'
guiSetText( chat_Windows[player].memo, newString )
guiMemoSetCaretIndex( chat_Windows[player].memo, string.len( oldMessages ) )
if ( guiGetVisible( GUIEditor.window[1] ) == false ) then
if ( getElementData( Cplayer, 'donotDisturb' ) ~= 'Enabled' ) then
outputChatBox( '#FFFF00• Chat System :#FFFFFF The player : [ '..getPlayerName( player )..' ] - Sent you a message !', 255, 255, 255, true )
playSound( 'Message.mp3' )
end
end
end );
 
function addPlayer( player )
local data = getElementData( player, 'chatStatus' ) or 'Online'
local name = getPlayerName( player )
local r, g, b = getPlayerNametagColor( player )
local row = guiGridListAddRow( GUIEditor.gridlist[1] )
guiGridListSetItemText( GUIEditor.gridlist[1], row, 1, name, false, false )
guiGridListSetItemText( GUIEditor.gridlist[1], row, 2, data, false, false )
guiGridListSetItemColor( GUIEditor.gridlist[1], row, 1, r, g, b )
if ( data == 'Online' ) then
guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 0, 200, 0 )
else
guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 200, 0, 0 )
end
end;
 
function addOnlinePlayer( player )
local data = getElementData( player, 'chatStatus' ) or 'Online'
if ( data == 'Online' ) then
local name = getPlayerName( player )
local r, g, b = getPlayerNametagColor( player )
local row = guiGridListAddRow( GUIEditor.gridlist[1] )
guiGridListSetItemText( GUIEditor.gridlist[1], row, 1, name, false, false )
guiGridListSetItemText( GUIEditor.gridlist[1], row, 2, data, false, false )
guiGridListSetItemColor( GUIEditor.gridlist[1], row, 1, r, g, b )
guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 0, 200, 0 )
end
end;
 
function addOfflinePlayer( player )
local data = getElementData( player, 'chatStatus' ) or 'Offline'
if ( data == 'Offline' ) then
local name = getPlayerName( player )
local r, g, b = getPlayerNametagColor( player )
local row = guiGridListAddRow( GUIEditor.gridlist[1] )
guiGridListSetItemText( GUIEditor.gridlist[1], row, 1, name, false, false )
guiGridListSetItemText( GUIEditor.gridlist[1], row, 2, data, false, false )
guiGridListSetItemColor( GUIEditor.gridlist[1], row, 1, r, g, b )
guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 200, 0, 0 )
end
end;
 
function player_Quit( player )
removePlayer( player )
destroyChattingWindow( player )
end;
addEvent( 'onClientRemovePlayer', true ); addEventHandler( 'onClientRemovePlayer', root, player_Quit )
 
function player_ChangedName( player, name )
for i = 0, guiGridListGetRowCount( GUIEditor.gridlist[1] ) do
if ( guiGridListGetItemText( GUIEditor.gridlist[1], i, 1 ) == name ) then
guiGridListRemoveRow( GUIEditor.gridlist[1], i )
end
end
destroyChattingWindow( player )
setTimer( function( )
local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
if ( Sel == -1 ) then addPlayer( player ) return end
if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
addOnlinePlayer( player )
end
end
elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
addOfflinePlayer( player )
end
end
elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
guiGridListClear( GUIEditor.gridlist[1] )
for _, player in ipairs( getElementsByType( 'player' ) ) do
addPlayer( player )
end
end
end, 1500, 1 )
end;
addEvent( 'onClientRemovePlayer_ChangedName', true ); addEventHandler( 'onClientRemovePlayer_ChangedName', root, player_ChangedName
)
 
function sendMessage( eleEdit )
local parent = getElementParent( source )
if ( parent == false or not parent ) then return end
local player = getPlayerFromName( guiGetText( parent ) )
if ( player == false or not player ) then return end
if ( eleEdit == chat_Windows[player].editBox ) then
sendNewMessage( player )
end
end;
 
addEventHandler( 'onClientGUIAccepted', root, sendMessage );
 
 
addEventHandler( 'onClientResourceStart', resourceRoot,
function( )
triggerServerEvent( 'onServerSetPlayerSerial', Cplayer )
setTimer( function( )
for _, player in ipairs( getElementsByType( 'player' ) ) do
addPlayer( player )
end
end, 1000, 1 )
end );

 

مضبتت حب :\

Link to comment

طيب الحين مشكلتك هي انه لما يتغير اسم اللاعب , ما يتغير الإسم بالقريد لست ؟ طيب اطرحلي اكواد السيرفر والكلنت أشوف

برب 10 دقايق وراجعلك وبضبطلك ياها ;) 

Link to comment
  • 2 weeks later...

function guiCreateWindow(x2, y2, width2, height2, titleBarText2, relative2)
	local mainBackground = guiCreateStaticImage ( x2, y2, width2, height2, "n.png", relative2 )
	local mainBackgroundLabel = guiCreateLabel ( 0, 0, 700, 100, "               "..titleBarText2, false, mainBackground )
	guiSetAlpha( mainBackground, 0.9)
	guiSetFont ( mainBackgroundLabel, guiCreateFont ( "PetitFormalScript.ttf", 10 ) )
	guiSetEnabled ( mainBackgroundLabel, false )
	return mainBackground
end

local mainKey = 'F2' -- The key to open panel </>

-- If you don't know anything in programming don't edit anything down .
local Cplayer = getLocalPlayer(  );
local screenW, screenH = guiGetScreenSize(  );
setElementData( Cplayer, 'chatStatus', 'Online' )
setElementData( Cplayer, 'donotDisturb', nil )
local chat_Windows = {  };



GUIEditor = {
    edit = {},
    button = {},
    window = {},
    label = {},
    gridlist = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
local screenW, screenH = guiGetScreenSize()
        GUIEditor.window[1] = guiCreateWindow(screenW - 573 - 10, (screenH - 481) / 2, 573, 481, "", false)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetAlpha(GUIEditor.window[1], 1.00)
		guiSetVisible( GUIEditor.window[1], false )
        GUIEditor.label[1] = guiCreateLabel(278, 37, 152, 60, "- الــــدردشــــات ", false, GUIEditor.window[1])
        guiLabelSetColor(GUIEditor.label[1], 253, 0, 0)
		guiSetFont(GUIEditor.label[1],font)
        GUIEditor.label[2] = guiCreateLabel(198, 37, 152, 60, "الــخــاصــة -", false, GUIEditor.window[1])
        guiLabelSetColor(GUIEditor.label[2], 3, 242, 251)
		guiSetFont(GUIEditor.label[2],font)
        GUIEditor.label[3] = guiCreateLabel(10, 38, 558, 49, "_______________________________________________________________________________________", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.label[3], "sa-header")
        GUIEditor.gridlist[1] = guiCreateGridList(187, 150, 365, 242, false, GUIEditor.window[1])
        guiGridListAddColumn(GUIEditor.gridlist[1], "Player Name", 0.9)
        GUIEditor.edit[1] = guiCreateEdit(370, 97, 182, 43, "", false, GUIEditor.window[1])
        GUIEditor.label[4] = guiCreateLabel(312, 107, 48, 15, "Serach :", false, GUIEditor.window[1])
        GUIEditor.button[4] = guiCreateButton(9, 151, 168, 39, "Disable Chat F2", false, GUIEditor.window[1])
        local font0_PetitFormalScript = guiCreateFont("PetitFormalScript.ttf", 12)
        guiSetFont(GUIEditor.button[4], font0_PetitFormalScript)
        guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFFD0000")
        GUIEditor.button[2] = guiCreateButton(9, 232, 168, 39, "Block Player", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[2], font0_PetitFormalScript)
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF03BD79")
        GUIEditor.button[5] = guiCreateButton(9, 316, 168, 39, "| Close |", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[5], font0_PetitFormalScript)
        guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFC8FEEA")
        GUIEditor.label[5] = guiCreateLabel(167, 416, 385, 47, "", false, GUIEditor.window[1])
        local font1_PetitFormalScript = guiCreateFont("PetitFormalScript.ttf", 10)
        guiSetFont(GUIEditor.label[5], font1_PetitFormalScript)
        guiLabelSetColor(GUIEditor.label[5], 43, 243, 184)
        GUIEditor.label[6] = guiCreateLabel(32, 99, 236, 36, "Grand", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.label[6], font1_PetitFormalScript)
        guiLabelSetColor(GUIEditor.label[6], 167, 251, 34)    
    end
)

guiSetEnabled( GUIEditor.button[2], false )
bindKey( mainKey, 'down', function(  )
	guiSetVisible( GUIEditor.window[1], not guiGetVisible( GUIEditor.window[1] ) )
		showCursor( guiGetVisible( GUIEditor.window[1] ) )
		guiSetInputEnabled( guiGetVisible( GUIEditor.window[1] ) )
	for cNumber, _ in pairs( chat_Windows ) do
		guiSetVisible( chat_Windows[cNumber].window, guiGetVisible( GUIEditor.window[1] ) )
	end
end );

addEventHandler( 'onClientGUIChanged', root,
function(  )
	if ( source == GUIEditor.edit[1] ) then
		local plrString = guiGetText( GUIEditor.edit[1] )
			if ( plrString == '' or not plrString ) then
				local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
				if ( Sel == -1 ) then
					guiGridListClear( GUIEditor.gridlist[1] )
					for _, player in ipairs( getElementsByType( 'player' ) ) do
				addPlayer( player ) 
					end return end
			if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
					addOnlinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
					addOfflinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
			addPlayer( player )
		end
			end
				else
				local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
				if ( Sel == -1 ) then
					guiGridListClear( GUIEditor.gridlist[1] )
					for _, player in ipairs( getElementsByType( 'player' ) ) do
					if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
				addPlayer( player ) 
				end end return end
			if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
				if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
					addOnlinePlayer( player )
				end
			end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
				if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
					addOfflinePlayer( player )
				end
			end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
			addPlayer( player )
			end
		end
		end
	end
end
end );

function BuildChatting( player )
chat_Windows[player] = {  };
chat_Windows[player].window = guiCreateWindow((screenW - 629) / 2, (screenH - 314) / 2, 629, 314, getPlayerName( player ), false)
guiWindowSetSizable(chat_Windows[player].window, false)
guiSetAlpha(chat_Windows[player].window, 1.00)

chat_Windows[player].memo = guiCreateMemo(10, 21, 609, 242, "", false, chat_Windows[player].window)
guiMemoSetReadOnly(chat_Windows[player].memo, true)
chat_Windows[player].editBox = guiCreateEdit(10, 278, 401, 26, "", false, chat_Windows[player].window)
chat_Windows[player].SendButton = guiCreateButton(421, 280, 104, 24, "Send Message", false, chat_Windows[player].window)
chat_Windows[player].Xclose = guiCreateButton(582, 278, 37, 26, "X", false, chat_Windows[player].window)
chat_Windows[player].Label = guiCreateLabel(10, 263, 609, 15, "* [N/A] is typing ...", false, chat_Windows[player].window)
guiSetFont(chat_Windows[player].Label, "default-small")
guiLabelSetVerticalAlign(chat_Windows[player].Label, "center")
guiSetVisible(chat_Windows[player].Label, false)
chat_Windows[player].Emoji = guiCreateButton(535, 278, 37, 26, "^ᴥ^", false, chat_Windows[player].window)
guiSetProperty(chat_Windows[player].Emoji, "NormalTextColour", "FF4080FF")
guiSetProperty(chat_Windows[player].Xclose, "NormalTextColour", "FFFE0000")
guiSetProperty(chat_Windows[player].SendButton, "NormalTextColour", "FF1FC100")

	if ( guiGetVisible( GUIEditor.window[1] ) == true ) then
		guiSetVisible( chat_Windows[player].window, true )
	else
		guiSetVisible( chat_Windows[player].window, false )
	end
end;

function clickTimer( element, timer )
	guiSetEnabled( element, false )
		setTimer( guiSetEnabled, timer * 1000, 1, element, true )
end;

function sendNewMessage( player )
	if ( isTimer( sendTimer ) ) then return end
	if ( chat_Windows[player] and isElement( chat_Windows[player].window ) ) then
		local message = guiGetText( chat_Windows[player].editBox )
			for _, badWord in ipairs( badWordsTable ) do
				if ( string.find( message, badWord[1] ) ) then
					guiSetProperty( chat_Windows[player].editBox, 'NormalTextColour', 'FFFF0000' )
						guiSetText( chat_Windows[player].editBox, 'السب والشتم سيعرضك للمخالفات !' )
							guiSetEnabled( chat_Windows[player].editBox, false )
								guiEditSetReadOnly( chat_Windows[player].editBox, true )
									setTimer( function(  )
										guiSetText( chat_Windows[player].editBox, '' )
											guiSetEnabled( chat_Windows[player].editBox, true )
										guiEditSetReadOnly( chat_Windows[player].editBox, false )
									guiSetProperty( chat_Windows[player].editBox, 'NormalTextColour', 'FF000000' )
								end, 3000, 1 )
							sendTimer = setTimer( function(  )
						killTimer( sendTimer )
					end, 2500, 1 )
						return
					end 
				end
			if ( string.len( message ) > 0 ) then
				local oldMessages = guiGetText( chat_Windows[player].memo )
					local newString = oldMessages..getPlayerName( Cplayer ):gsub( '#%x%x%x%x%x%x', '' )..' : '..message..'\n'
				guiSetText( chat_Windows[player].memo, newString )
			guiSetText( chat_Windows[player].editBox, '' )
				guiMemoSetCaretIndex( chat_Windows[player].memo, string.len( oldMessages ) )
			triggerServerEvent( 'onServerSendMessage', Cplayer, player, message )
		sendTimer = setTimer( function(  )
			killTimer( sendTimer )
			end, 2500, 1 )
		end
	end
end;

function destroyChattingWindow( player )
	if ( chat_Windows[player] and isElement( chat_Windows[player].window ) ) then
		destroyElement( chat_Windows[player].window )
		chat_Windows[player] = nil
	end
end;

function removePlayer( player )
	local name = getPlayerName( player )
		for i = 0, guiGridListGetRowCount( GUIEditor.gridlist[1] ) do
			if ( guiGridListGetItemText( GUIEditor.gridlist[1], i, 1 ) == name ) then
		guiGridListRemoveRow( GUIEditor.gridlist[1], i )
	end
end
end;

function privateChatClicks(  )
if ( getElementType( source ) ~= 'gui-button' ) then return end
	local parent = getElementParent( source )
		if ( parent == false or not parent ) then return end
			local player = getPlayerFromName( guiGetText( parent ) )
		if ( player == false or not player ) then return end
	if ( source == chat_Windows[player].SendButton ) then
		sendNewMessage( player )
	elseif ( source == chat_Windows[player].Xclose ) then
		destroyChattingWindow( player )
	elseif ( source == chat_Windows[player].Emoji ) then
		if ( isTimer( emojiTimer ) ) then return end
		local oldMessages = guiGetText( chat_Windows[player].memo )
			local newString = oldMessages..getPlayerName( Cplayer ):gsub( '#%x%x%x%x%x%x', '' )..' : '..'^ᴥ^'..'\n'
				guiSetText( chat_Windows[player].memo, newString )
			guiMemoSetCaretIndex( chat_Windows[player].memo, string.len( oldMessages ) )
		triggerServerEvent( 'onServerSendMessage', Cplayer, player, '^ᴥ^' )
			guiSetEnabled( chat_Windows[player].Emoji, false )
				emojiTimer = setTimer( function(  )
					if ( chat_Windows[player] and isElement( chat_Windows[player].Emoji ) ) then
				guiSetEnabled( chat_Windows[player].Emoji, true )
					end
			killTimer( emojiTimer )
		end, 2500, 1 )
	end
end;
addEventHandler( 'onClientGUIClick', root, privateChatClicks );

addEventHandler( 'onClientGUIClick', root,
function(  )
	if ( source == GUIEditor.button[1] ) then
		clickTimer( GUIEditor.button[1], 3 )
			local Sel = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
				if ( Sel == -1 ) then outputChatBox( '#FF0000• ERROR :#FFFFFF Please select the player which you want to begin chat with it !', 255, 255, 255, true ) return end
				local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], Sel, 1 ) )
					if ( player == Cplayer ) then outputChatBox( '#FF0000• ERROR :#FFFFFF You cannot chatting with yourself !', 255, 255, 255, true ) return end
			local serial = getElementData( player, 'chatSystem;playerSerial' )
		triggerServerEvent( 'onServerCheckIfBlocked', Cplayer, serial )
	elseif ( source == GUIEditor.button[4] ) then
		clickTimer( GUIEditor.button[4], 5 )
		if ( guiGetText( GUIEditor.button[4] ) == 'Turn Off Chat' ) then
			guiSetEnabled( GUIEditor.button[1], false )
				guiSetEnabled( GUIEditor.button[3], false )
				guiSetEnabled( GUIEditor.button[2], false )
				guiSetEnabled( GUIEditor.gridlist[1], false )
				guiSetEnabled( GUIEditor.combobox[1], false )
				guiSetEnabled( GUIEditor.edit[1], false )
				guiSetEnabled( GUIEditor.checkbox[1], false )
				guiSetText( GUIEditor.button[4], 'Turn On Chat' )
			setElementData( Cplayer, 'chatStatus', 'Offline' )
			triggerServerEvent( 'onServerChangeStatus', Cplayer, 'Offline' )
			for cNumber, _ in pairs( chat_Windows ) do
				if ( chat_Windows[cNumber] and isElement( chat_Windows[cNumber].window ) ) then
					destroyElement( chat_Windows[cNumber].window )
					chat_Windows[cNumber] = nil
				end
			end
				else
			guiSetEnabled( GUIEditor.button[1], true )
				guiSetEnabled( GUIEditor.button[3], true )
				guiSetEnabled( GUIEditor.gridlist[1], true )
				guiSetEnabled( GUIEditor.combobox[1], true )
				guiSetEnabled( GUIEditor.edit[1], true )
				guiSetEnabled( GUIEditor.checkbox[1], true )
				guiSetText( GUIEditor.button[4], 'Turn Off Chat' )
			setElementData( Cplayer, 'chatStatus', 'Online' )
			triggerServerEvent( 'onServerChangeStatus', Cplayer, 'Online' )
		end
	elseif ( source == GUIEditor.button[5] ) then
		guiSetVisible( GUIEditor.window[1], false )
			showCursor( false )
		guiSetInputEnabled( false )
		for cNumber, _ in pairs( chat_Windows ) do
		guiSetVisible( chat_Windows[cNumber].window, false )
		end
	elseif ( source == GUIEditor.gridlist[1] ) then
		local Sel = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
			if ( Sel == -1 ) then
				guiSetEnabled( GUIEditor.button[2], false )
				guiSetText( GUIEditor.button[2], 'Block Player' )
			else
				guiSetEnabled( GUIEditor.button[2], true )
					local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], Sel, 1 ) )
				local serial = getElementData( player, 'chatSystem;playerSerial' )
					if ( serial and string.len( serial ) == 32 ) then
				triggerServerEvent( 'onServerCheckBlockStatus', Cplayer, serial )
			end
		end
	elseif ( source == GUIEditor.button[2] ) then
		clickTimer( GUIEditor.button[2], 3 )
		local Sel = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
			if ( Sel == -1 ) then return end
		local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], Sel, 1 ) )
			local serial = getElementData( player, 'chatSystem;playerSerial' )
		if ( guiGetText( GUIEditor.button[2] ) == 'Block Player' ) then
			triggerServerEvent( 'onServerBlockPlayer', Cplayer, serial, player )
		else
			triggerServerEvent( 'onServerUnblockPlayer', Cplayer, serial )
		end
	elseif ( source == GUIEditor.button[3] ) then
		clickTimer( GUIEditor.button[3], 10 )
		local Sel = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
			if ( Sel == -1 ) then outputChatBox( '#FF0000• ERROR :#FFFFFF Please select the player which you want to poke it !', 255, 255, 255, true ) return end
				local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], Sel, 1 ) )
			local serial = getElementData( player, 'chatSystem;playerSerial' )
		triggerServerEvent( 'onServerSendPoke', Cplayer, player, serial )
	elseif ( source == GUIEditor.combobox[1] ) then
		local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
			if ( Sel == -1 ) then return end
		if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
					addOnlinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
					addOfflinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				addPlayer( player )
			end
		end
	elseif ( source == GUIEditor.checkbox[1] ) then
		if ( guiCheckBoxGetSelected( GUIEditor.checkbox[1] ) == true ) then
			setElementData( Cplayer, 'donotDisturb', 'Enabled' )
			triggerServerEvent( 'onServerChangeStatus', Cplayer, 'Online' )
		else
			setElementData( Cplayer, 'donotDisturb', nil )
			triggerServerEvent( 'onServerChangeStatus', Cplayer, 'Online' )
		end
	end
end );

local txtValue = 0

function showWriteMessage( player, name )
	if ( isTimer( writeTimer ) ) then return end
		guiSetText( chat_Windows[player].Label, '* ['..name..'] is typing')
			guiSetVisible( chat_Windows[player].Label, true )
				writeTimer = setTimer( function(  )
					if ( txtValue >= 3 ) then
						guiSetText( chat_Windows[player].Label, '* ['..name..'] is typing' )
					txtValue = 0
				end
			guiSetText( chat_Windows[player].Label, guiGetText( chat_Windows[player].Label )..'.' )
		txtValue = txtValue + 1
	end, 500, 0 )
end;
addEvent( 'onClientShowWrite', true ); addEventHandler( 'onClientShowWrite', root, showWriteMessage )


function hideWriteMessage( player )
	if ( isTimer( writeTimer ) ) then killTimer( writeTimer ) end
	guiSetText( chat_Windows[player].Label, '* [N/A] is typing ...')
	guiSetVisible( chat_Windows[player].Label, false )
end;
addEvent( 'onClientHideWrite', true ); addEventHandler( 'onClientHideWrite', root, hideWriteMessage )

addEventHandler( 'onClientGUIChanged', root,
function(  )
	local parent = getElementParent( source )
		if ( not parent ) then return end
			local player = getPlayerFromName( guiGetText( parent ) )
		if ( not player ) then return end
			if ( source == chat_Windows[player].editBox ) then
				if ( guiGetText( chat_Windows[player].editBox ) ~= '' ) then
					triggerServerEvent( 'onServerCheckShow', Cplayer, player, getPlayerName( Cplayer ) )
				local messageStringText = guiGetText( chat_Windows[player].editBox )
					checkIfTextChanged( player, messageStringText )
				else
			triggerServerEvent( 'onServerCheckHide', Cplayer, player )
		end
	end
end );

function checkIfTextChanged( player, text )
	setTimer( function(  )
		if ( guiGetText( chat_Windows[player].editBox ) == text ) then
			triggerServerEvent( 'onServerCheckHide', Cplayer, player )
		end
	end, 1000, 1 )
end;

addEvent( 'onClientPokePlayer', true );
addEventHandler( 'onClientPokePlayer', root,
function( pokedBy )
	if ( getElementData( Cplayer, 'donotDisturb' ) ~= 'Enabled' ) then
		playSound( 'Wakeup.mp3' )
		outputChatBox( '#FFFF00• Chat System :#FFFFFF The player : [ '..pokedBy..' ] - Poked you !', 255, 255, 255, true )
	end
end );

addEvent( 'onClientChangeButton', true );
addEventHandler( 'onClientChangeButton', root,
function( Text )
	guiSetText( GUIEditor.button[2], Text )
end );

function buildChattingWith(  )
	local row, column = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
			if ( row == -1 or column == -1 ) then return end
		local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], row, column ) )
			if ( getElementData( player, 'chatStatus' ) ~= 'Online' ) then
				outputChatBox( '#FF0000• ERROR :#FFFFFF Sorry, You cannot send a message to this player .. it\'s offline !', 255, 255, 255, true ) return end
				if ( not chat_Windows[player] ) then
			BuildChatting( player )
		guiBringToFront( chat_Windows[player].window )
	end
end;
addEvent( 'buildChattingWith', true ); addEventHandler( 'buildChattingWith', root, buildChattingWith )

function privateChatDoubleClicks(  )
	if ( source == GUIEditor.gridlist[1] ) then
		local Sel = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
			if ( Sel == -1 ) then return end
		local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], Sel, 1 ) )
			if ( player == Cplayer ) then outputChatBox( '#FF0000• ERROR :#FFFFFF You cannot chatting with yourself !', 255, 255, 255, true ) return end
			local serial = getElementData( player, 'chatSystem;playerSerial' )
		triggerServerEvent( 'onServerCheckIfBlocked', Cplayer, serial )
	end
end;
addEventHandler( 'onClientGUIDoubleClick', root, privateChatDoubleClicks );

addEvent( 'onClientReceiveMessage', true );
addEventHandler( 'onClientReceiveMessage', root,
function( player, message )
	if ( not chat_Windows[player] ) then
		BuildChatting( player ) 
	end
		local oldMessages = guiGetText( chat_Windows[player].memo )
			local newString = oldMessages..getPlayerName( player ):gsub( '#%x%x%x%x%x%x', '' )..' : '..message..'\n'
		guiSetText( chat_Windows[player].memo, newString )
	guiMemoSetCaretIndex( chat_Windows[player].memo, string.len( oldMessages ) )
		if ( guiGetVisible( GUIEditor.window[1] ) == false ) then
			if ( getElementData( Cplayer, 'donotDisturb' ) ~= 'Enabled' ) then
				outputChatBox( '#FFFF00• Chat System :#FFFFFF The player : [ '..getPlayerName( player )..' ] - Sent you a message !', 255, 255, 255, true )
			playSound( 'Message.mp3' )
		end
	end
end );

function addPlayer( player )
	local data = getElementData( player, 'chatStatus' ) or 'Online'
		local name = getPlayerName( player )
			local r, g, b = getPlayerNametagColor( player )
				local row = guiGridListAddRow( GUIEditor.gridlist[1] )
					guiGridListSetItemText( GUIEditor.gridlist[1], row, 1, name, false, false )
						guiGridListSetItemText( GUIEditor.gridlist[1], row, 2, data, false, false )
					guiGridListSetItemColor( GUIEditor.gridlist[1], row, 1, r, g, b )
				if ( data == 'Online' ) then
				guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 0, 200, 0 )
			else
		guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 200, 0, 0 )
	end
end;

function addOnlinePlayer( player )
	local data = getElementData( player, 'chatStatus' ) or 'Online'
		if ( data == 'Online' ) then
			local name = getPlayerName( player )
				local r, g, b = getPlayerNametagColor( player )
					local row = guiGridListAddRow( GUIEditor.gridlist[1] )
					guiGridListSetItemText( GUIEditor.gridlist[1], row, 1, name, false, false )
				guiGridListSetItemText( GUIEditor.gridlist[1], row, 2, data, false, false )
			guiGridListSetItemColor( GUIEditor.gridlist[1], row, 1, r, g, b )
		guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 0, 200, 0 )
	end
end;

function addOfflinePlayer( player )
	local data = getElementData( player, 'chatStatus' ) or 'Offline'
		if ( data == 'Offline' ) then
			local name = getPlayerName( player )
		local r, g, b = getPlayerNametagColor( player )
		local row = guiGridListAddRow( GUIEditor.gridlist[1] )
	guiGridListSetItemText( GUIEditor.gridlist[1], row, 1, name, false, false )
		guiGridListSetItemText( GUIEditor.gridlist[1], row, 2, data, false, false )
			guiGridListSetItemColor( GUIEditor.gridlist[1], row, 1, r, g, b )
		guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 200, 0, 0 )
	end
end;

addEvent( 'onClientUpdateStatus', true );
addEventHandler( 'onClientUpdateStatus', root,
function( player, status )
	if ( status == 'Online' ) then
		removePlayer( player )
		local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
			if ( Sel == -1 ) then addPlayer( player ) return end
		if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
					addOnlinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
					addOfflinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
			addPlayer( player )
		end
	end
	else
		destroyChattingWindow( player )
			removePlayer( player )
		local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
			if ( Sel == -1 ) then addPlayer( player ) return end
		if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
					addOnlinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
					addOfflinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
			addPlayer( player )
		end
	end
	end
end );

addEvent( 'onClientDestroyChats', true );
addEventHandler( 'onClientDestroyChats', root,
function( player )
	destroyChattingWindow( player )
end );

function player_Join( player )
	if ( player ~= Cplayer ) then
	local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
			if ( Sel == -1 ) then addPlayer( player ) return end
		if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
					addOnlinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
					addOfflinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
			addPlayer( player )
		end
	end
end
end;
addEvent( 'onClientAddPlayer', true ); addEventHandler( 'onClientAddPlayer', root, player_Join )

function player_Quit( player )
	removePlayer( player )
	destroyChattingWindow( player )
end;
addEvent( 'onClientRemovePlayer', true ); addEventHandler( 'onClientRemovePlayer', root, player_Quit )

function player_ChangedName( player, name )
	for i = 0, guiGridListGetRowCount( GUIEditor.gridlist[1] ) do
		if ( guiGridListGetItemText( GUIEditor.gridlist[1], i, 1 ) == name ) then
			guiGridListRemoveRow( GUIEditor.gridlist[1], i )
		end
	end
		destroyChattingWindow( player )
	setTimer( function(  )
		local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
			if ( Sel == -1 ) then addPlayer( player ) return end
		if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
					addOnlinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
					addOfflinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
			addPlayer( player )
		end
	end
end, 1500, 1 )
end;
addEvent( 'onClientRemovePlayer_ChangedName', true ); addEventHandler( 'onClientRemovePlayer_ChangedName', root, player_ChangedName )

function sendMessage( eleEdit )
	local parent = getElementParent( source )
		if ( parent == false or not parent ) then return end
			local player = getPlayerFromName( guiGetText( parent ) )
		if ( player == false or not player ) then return end
	if ( eleEdit == chat_Windows[player].editBox ) then
		sendNewMessage( player )
	end
end;

addEventHandler( 'onClientGUIAccepted', root, sendMessage );

addEventHandler( 'onClientResourceStart', resourceRoot,
function(  )
	triggerServerEvent( 'onServerSetPlayerSerial', Cplayer )
		setTimer( function(  )
	for _, player in ipairs( getElementsByType( 'player' ) ) do
		addPlayer( player )
	end
end, 1000, 1 )
end );

اسف ع السحبة اكواد الكلنت ..

local chatSystemDB = dbConnect( 'sqlite', 'Chat System - Database.db' )
dbExec( chatSystemDB, 'CREATE TABLE IF NOT EXISTS `Chat_System` (sourceSerial, blockedSerial)' )

addEvent( 'onServerCheckShow', true );
addEventHandler( 'onServerCheckShow', root,
function( player, name )
	if ( player and player ~= source ) then
		triggerClientEvent( player, 'onClientShowWrite', source, source, name )
	end
end );

addEvent( 'onServerCheckHide', true );
addEventHandler( 'onServerCheckHide', root,
function( player )
	if ( player and player ~= source ) then
		triggerClientEvent( player, 'onClientHideWrite', source, source )
	end
end );

addEvent( 'onServerCheckIfBlocked', true );
addEventHandler( 'onServerCheckIfBlocked', root,
function( serial )
	local check = dbQuery( chatSystemDB, 'SELECT * FROM `Chat_System` WHERE sourceSerial = ? AND blockedSerial = ?', getPlayerSerial( source ), serial )
		local results = dbPoll( check, -1 )
	if ( type( results ) == 'table' and #results ~= 0 ) then outputChatBox( '#FF0000• ERROR :#FFFFFF Sorry, You cannot send a message to this player .. it\'s blocked !', source, 255, 255, 255, true ) return end
	local check = dbQuery( chatSystemDB, 'SELECT * FROM `Chat_System` WHERE sourceSerial = ? AND blockedSerial = ?', serial, getPlayerSerial( source ) )
		local results = dbPoll( check, -1 )
	if ( type( results ) == 'table' and #results ~= 0 ) then outputChatBox( '#FF0000• ERROR :#FFFFFF Sorry, You cannot send a message to this player .. he was blocked you !', source, 255, 255, 255, true ) return end
		triggerClientEvent( source, 'buildChattingWith', source )
end );

addEvent( 'onServerSendPoke', true );
addEventHandler( 'onServerSendPoke', root,
function( player, serial )
	local check = dbQuery( chatSystemDB, 'SELECT * FROM `Chat_System` WHERE sourceSerial = ? AND blockedSerial = ?', getPlayerSerial( source ), serial )
		local results = dbPoll( check, -1 )
			if ( type( results ) == 'table' and #results ~= 0 ) then outputChatBox( '#FF0000• ERROR :#FFFFFF Sorry, You cannot send a poke to this player .. it\'s blocked or he was blocked you !', source, 255, 255, 255, true ) return end
		if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
			outputChatBox( '#FF0000• ERROR :#FFFFFF Sorry, You cannot send a poke to this player .. it\'s offline !', source, 255, 255, 255, true ) return end
		triggerClientEvent( player, 'onClientPokePlayer', source, getPlayerName( source ) )
end );

addEvent( 'onServerCheckBlockStatus', true );
addEventHandler( 'onServerCheckBlockStatus', root,
function( serial )
	local check = dbQuery( chatSystemDB, 'SELECT * FROM `Chat_System` WHERE sourceSerial = ? AND blockedSerial = ?', getPlayerSerial( source ), serial )
		local results = dbPoll( check, -1 )
			if ( type( results ) == 'table' and #results == 0 or not results ) then triggerClientEvent( source, 'onClientChangeButton', source, 'Block Player' ) return end
		triggerClientEvent( source, 'onClientChangeButton', source, 'Unblock Player' )
end );

addEvent( 'onServerBlockPlayer', true );
addEventHandler( 'onServerBlockPlayer', root,
function( serial, player )
	local check = dbQuery( chatSystemDB, 'SELECT * FROM `Chat_System` WHERE sourceSerial = ? AND blockedSerial = ?', getPlayerSerial( source ), serial )
		local results = dbPoll( check, -1 )
			if ( type( results ) == 'table' and #results ~= 0 ) then return end
		dbExec( chatSystemDB, 'INSERT INTO `Chat_System` VALUES(?,?)', getPlayerSerial( source ), serial )
	triggerClientEvent( source, 'onClientChangeButton', source, 'Unblock Player' )
	triggerClientEvent( player, 'onClientDestroyChats', source, source )
	triggerClientEvent( source, 'onClientDestroyChats', source, player )
end );

addEvent( 'onServerUnblockPlayer', true );
addEventHandler( 'onServerUnblockPlayer', root,
function( serial )
	local check = dbQuery( chatSystemDB, 'SELECT * FROM `Chat_System` WHERE sourceSerial = ? AND blockedSerial = ?', getPlayerSerial( source ), serial )
		local results = dbPoll( check, -1 )
			if ( type( results ) == 'table' and #results == 0 or not results ) then triggerClientEvent( source, 'onClientChangeButton', source, 'Block Player' ) return end
		dbExec( chatSystemDB, 'DELETE FROM `Chat_System` WHERE sourceSerial = ? AND blockedSerial = ?', getPlayerSerial( source ), serial )
	triggerClientEvent( source, 'onClientChangeButton', source, 'Block Player' )
end );

addEventHandler( 'onPlayerJoin', getRootElement(  ),
function(  )
	triggerClientEvent( root, 'onClientAddPlayer', source, source )
end );

addEventHandler( 'onPlayerQuit', getRootElement(  ),
function(  )
	triggerClientEvent( root, 'onClientRemovePlayer', source, source )
end );

addEventHandler( 'onPlayerChangeNick', getRootElement(  ),
function( old, new )
	triggerClientEvent( root, 'onClientRemovePlayer_ChangedName', source, source, old )
end );

addEvent( 'onServerSetPlayerSerial', true );
addEventHandler( 'onServerSetPlayerSerial', root,
function(  )
	setElementData( source, 'chatSystem;playerSerial', getPlayerSerial( source ) )
end );

addEvent( 'onServerChangeStatus', true );
addEventHandler( 'onServerChangeStatus', root,
function( Status )
	triggerClientEvent( root, 'onClientUpdateStatus', source, source, Status )
end );

addEvent( 'onServerSendMessage', true );
addEventHandler( 'onServerSendMessage', root,
function( plr, message )
	triggerClientEvent( plr, 'onClientReceiveMessage', source, source, message )
end );

addEvent( 'onServerPutPlayers', true );
addEventHandler( 'onServerPutPlayers', root,
function(  )
	for _, player in ipairs( getElementsByType( 'player' ) ) do
			local plrName = getPlayerName( player )
		local plrStatus = getElementData( player, 'privateChatSystem;playerStatus' ) or 'Online'
	triggerClientEvent( root, 'onClientPutPlayers', player, plrName, plrStatus )
	end
end );

سيرفر ..حل شباب.

Link to comment
function TOUNSI( x2, y2, width2, height2, titleBarText2, relative2 )
	local mainBackground = guiCreateStaticImage ( x2, y2, width2, height2, "n.png", relative2 )
	return mainBackground
end

local mainKey = 'F2' -- The key to open panel </>
-- If you don't know anything in programming don't edit anything down .
local Cplayer = getLocalPlayer(  );
local screenW, screenH = guiGetScreenSize(  );
setElementData( Cplayer, 'chatStatus', 'Online' )
setElementData( Cplayer, 'donotDisturb', nil )
local chat_Windows = {  };
GUIEditor = {
    edit = {},
    button = {},
    window = {},
    label = {},
    gridlist = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
local screenW, screenH = guiGetScreenSize()	
GUIEditor.window[1] = TOUNSI(screenW - 573 - 10, (screenH - 481) / 2, 573, 481, "", false)
guiSetVisible(GUIEditor.window[1], false)
		
        GUIEditor.label[1] = guiCreateLabel(278, 37, 152, 60, "- الــــدردشــــات ", false, GUIEditor.window[1])
        guiLabelSetColor(GUIEditor.label[1], 253, 0, 0)
		guiSetFont(GUIEditor.label[1],font)
        GUIEditor.label[2] = guiCreateLabel(198, 37, 152, 60, "الــخــاصــة -", false, GUIEditor.window[1])
        guiLabelSetColor(GUIEditor.label[2], 3, 242, 251)
		guiSetFont(GUIEditor.label[2],font)
        GUIEditor.label[3] = guiCreateLabel(10, 38, 558, 49, "_______________________________________________________________________________________", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.label[3], "sa-header")
        GUIEditor.gridlist[1] = guiCreateGridList(187, 150, 365, 242, false, GUIEditor.window[1])
        guiGridListAddColumn(GUIEditor.gridlist[1], "Player Name", 0.9)
        GUIEditor.edit[1] = guiCreateEdit(370, 97, 182, 43, "", false, GUIEditor.window[1])
        GUIEditor.label[4] = guiCreateLabel(312, 107, 48, 15, "Serach :", false, GUIEditor.window[1])
        GUIEditor.button[4] = guiCreateButton(9, 151, 168, 39, "Disable Chat F2", false, GUIEditor.window[1])
        local font0_PetitFormalScript = guiCreateFont("PetitFormalScript.ttf", 12)
        guiSetFont(GUIEditor.button[4], font0_PetitFormalScript)
        guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFFD0000")
        GUIEditor.button[2] = guiCreateButton(9, 232, 168, 39, "Block Player", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[2], font0_PetitFormalScript)
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF03BD79")
        GUIEditor.button[5] = guiCreateButton(9, 316, 168, 39, "| Close |", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[5], font0_PetitFormalScript)
        guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFC8FEEA")
        GUIEditor.label[5] = guiCreateLabel(167, 416, 385, 47, "", false, GUIEditor.window[1])
        local font1_PetitFormalScript = guiCreateFont("PetitFormalScript.ttf", 10)
        guiSetFont(GUIEditor.label[5], font1_PetitFormalScript)
        guiLabelSetColor(GUIEditor.label[5], 43, 243, 184)
        GUIEditor.label[6] = guiCreateLabel(32, 99, 236, 36, "Grand", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.label[6], font1_PetitFormalScript)
        guiLabelSetColor(GUIEditor.label[6], 167, 251, 34)    
    end
)
guiSetEnabled( GUIEditor.button[2], false )
bindKey( mainKey, 'down', function(  )
	guiSetVisible( GUIEditor.window[1], not guiGetVisible( GUIEditor.window[1] ) )
		showCursor( guiGetVisible( GUIEditor.window[1] ) )
		guiSetInputEnabled( guiGetVisible( GUIEditor.window[1] ) )
	for cNumber, _ in pairs( chat_Windows ) do
		guiSetVisible( chat_Windows[cNumber].window, guiGetVisible( GUIEditor.window[1] ) )
	end
end );
addEventHandler( 'onClientGUIChanged', root,
function(  )
	if ( source == GUIEditor.edit[1] ) then
		local plrString = guiGetText( GUIEditor.edit[1] )
			if ( plrString == '' or not plrString ) then
				local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
				if ( Sel == -1 ) then
					guiGridListClear( GUIEditor.gridlist[1] )
					for _, player in ipairs( getElementsByType( 'player' ) ) do
				addPlayer( player ) 
					end return end
			if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
					addOnlinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
					addOfflinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
			addPlayer( player )
		end
			end
				else
				local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
				if ( Sel == -1 ) then
					guiGridListClear( GUIEditor.gridlist[1] )
					for _, player in ipairs( getElementsByType( 'player' ) ) do
					if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
				addPlayer( player ) 
				end end return end
			if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
				if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
					addOnlinePlayer( player )
				end
			end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
				if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
					addOfflinePlayer( player )
				end
			end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( string.find( string.upper( getPlayerName( player ) ), string.upper( plrString ) ) ) then
			addPlayer( player )
			end
		end
		end
	end
end
end );
function BuildChatting( player )
chat_Windows[player] = {  };
chat_Windows[player].window = guiCreateWindow((screenW - 629) / 2, (screenH - 314) / 2, 629, 314, getPlayerName( player ), false)
guiWindowSetSizable(chat_Windows[player].window, false)
guiSetAlpha(chat_Windows[player].window, 1.00)
chat_Windows[player].memo = guiCreateMemo(10, 21, 609, 242, "", false, chat_Windows[player].window)
guiMemoSetReadOnly(chat_Windows[player].memo, true)
chat_Windows[player].editBox = guiCreateEdit(10, 278, 401, 26, "", false, chat_Windows[player].window)
chat_Windows[player].SendButton = guiCreateButton(421, 280, 104, 24, "Send Message", false, chat_Windows[player].window)
chat_Windows[player].Xclose = guiCreateButton(582, 278, 37, 26, "X", false, chat_Windows[player].window)
chat_Windows[player].Label = guiCreateLabel(10, 263, 609, 15, "* [N/A] is typing ...", false, chat_Windows[player].window)
guiSetFont(chat_Windows[player].Label, "default-small")
guiLabelSetVerticalAlign(chat_Windows[player].Label, "center")
guiSetVisible(chat_Windows[player].Label, false)
chat_Windows[player].Emoji = guiCreateButton(535, 278, 37, 26, "^ᴥ^", false, chat_Windows[player].window)
guiSetProperty(chat_Windows[player].Emoji, "NormalTextColour", "FF4080FF")
guiSetProperty(chat_Windows[player].Xclose, "NormalTextColour", "FFFE0000")
guiSetProperty(chat_Windows[player].SendButton, "NormalTextColour", "FF1FC100")
	if ( guiGetVisible( GUIEditor.window[1] ) == true ) then
		guiSetVisible( chat_Windows[player].window, true )
	else
		guiSetVisible( chat_Windows[player].window, false )
	end
end;
function clickTimer( element, timer )
	guiSetEnabled( element, false )
		setTimer( guiSetEnabled, timer * 1000, 1, element, true )
end;
function sendNewMessage( player )
	if ( isTimer( sendTimer ) ) then return end
	if ( chat_Windows[player] and isElement( chat_Windows[player].window ) ) then
		local message = guiGetText( chat_Windows[player].editBox )
			for _, badWord in ipairs( badWordsTable ) do
				if ( string.find( message, badWord[1] ) ) then
					guiSetProperty( chat_Windows[player].editBox, 'NormalTextColour', 'FFFF0000' )
						guiSetText( chat_Windows[player].editBox, 'السب والشتم سيعرضك للمخالفات !' )
							guiSetEnabled( chat_Windows[player].editBox, false )
								guiEditSetReadOnly( chat_Windows[player].editBox, true )
									setTimer( function(  )
										guiSetText( chat_Windows[player].editBox, '' )
											guiSetEnabled( chat_Windows[player].editBox, true )
										guiEditSetReadOnly( chat_Windows[player].editBox, false )
									guiSetProperty( chat_Windows[player].editBox, 'NormalTextColour', 'FF000000' )
								end, 3000, 1 )
							sendTimer = setTimer( function(  )
						killTimer( sendTimer )
					end, 2500, 1 )
						return
					end 
				end
			if ( string.len( message ) > 0 ) then
				local oldMessages = guiGetText( chat_Windows[player].memo )
					local newString = oldMessages..getPlayerName( Cplayer ):gsub( '#%x%x%x%x%x%x', '' )..' : '..message..'\n'
				guiSetText( chat_Windows[player].memo, newString )
			guiSetText( chat_Windows[player].editBox, '' )
				guiMemoSetCaretIndex( chat_Windows[player].memo, string.len( oldMessages ) )
			triggerServerEvent( 'onServerSendMessage', Cplayer, player, message )
		sendTimer = setTimer( function(  )
			killTimer( sendTimer )
			end, 2500, 1 )
		end
	end
end;
function destroyChattingWindow( player )
	if ( chat_Windows[player] and isElement( chat_Windows[player].window ) ) then
		destroyElement( chat_Windows[player].window )
		chat_Windows[player] = nil
	end
end;
function removePlayer( player )
	local name = getPlayerName( player )
		for i = 0, guiGridListGetRowCount( GUIEditor.gridlist[1] ) do
			if ( guiGridListGetItemText( GUIEditor.gridlist[1], i, 1 ) == name ) then
		guiGridListRemoveRow( GUIEditor.gridlist[1], i )
	end
end
end;
function privateChatClicks(  )
if ( getElementType( source ) ~= 'gui-button' ) then return end
	local parent = getElementParent( source )
		if ( parent == false or not parent ) then return end
			local player = getPlayerFromName( guiGetText( parent ) )
		if ( player == false or not player ) then return end
	if ( source == chat_Windows[player].SendButton ) then
		sendNewMessage( player )
	elseif ( source == chat_Windows[player].Xclose ) then
		destroyChattingWindow( player )
	elseif ( source == chat_Windows[player].Emoji ) then
		if ( isTimer( emojiTimer ) ) then return end
		local oldMessages = guiGetText( chat_Windows[player].memo )
			local newString = oldMessages..getPlayerName( Cplayer ):gsub( '#%x%x%x%x%x%x', '' )..' : '..'^ᴥ^'..'\n'
				guiSetText( chat_Windows[player].memo, newString )
			guiMemoSetCaretIndex( chat_Windows[player].memo, string.len( oldMessages ) )
		triggerServerEvent( 'onServerSendMessage', Cplayer, player, '^ᴥ^' )
			guiSetEnabled( chat_Windows[player].Emoji, false )
				emojiTimer = setTimer( function(  )
					if ( chat_Windows[player] and isElement( chat_Windows[player].Emoji ) ) then
				guiSetEnabled( chat_Windows[player].Emoji, true )
					end
			killTimer( emojiTimer )
		end, 2500, 1 )
	end
end;
addEventHandler( 'onClientGUIClick', root, privateChatClicks );
addEventHandler( 'onClientGUIClick', root,
function(  )
	if ( source == GUIEditor.button[1] ) then
		clickTimer( GUIEditor.button[1], 3 )
			local Sel = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
				if ( Sel == -1 ) then outputChatBox( '#FF0000• ERROR :#FFFFFF Please select the player which you want to begin chat with it !', 255, 255, 255, true ) return end
				local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], Sel, 1 ) )
					if ( player == Cplayer ) then outputChatBox( '#FF0000• ERROR :#FFFFFF You cannot chatting with yourself !', 255, 255, 255, true ) return end
			local serial = getElementData( player, 'chatSystem;playerSerial' )
		triggerServerEvent( 'onServerCheckIfBlocked', Cplayer, serial )
	elseif ( source == GUIEditor.button[4] ) then
		clickTimer( GUIEditor.button[4], 5 )
		if ( guiGetText( GUIEditor.button[4] ) == 'Turn Off Chat' ) then
			guiSetEnabled( GUIEditor.button[1], false )
				guiSetEnabled( GUIEditor.button[3], false )
				guiSetEnabled( GUIEditor.button[2], false )
				guiSetEnabled( GUIEditor.gridlist[1], false )
				guiSetEnabled( GUIEditor.combobox[1], false )
				guiSetEnabled( GUIEditor.edit[1], false )
				guiSetEnabled( GUIEditor.checkbox[1], false )
				guiSetText( GUIEditor.button[4], 'Turn On Chat' )
			setElementData( Cplayer, 'chatStatus', 'Offline' )
			triggerServerEvent( 'onServerChangeStatus', Cplayer, 'Offline' )
			for cNumber, _ in pairs( chat_Windows ) do
				if ( chat_Windows[cNumber] and isElement( chat_Windows[cNumber].window ) ) then
					destroyElement( chat_Windows[cNumber].window )
					chat_Windows[cNumber] = nil
				end
			end
				else
			guiSetEnabled( GUIEditor.button[1], true )
				guiSetEnabled( GUIEditor.button[3], true )
				guiSetEnabled( GUIEditor.gridlist[1], true )
				guiSetEnabled( GUIEditor.combobox[1], true )
				guiSetEnabled( GUIEditor.edit[1], true )
				guiSetEnabled( GUIEditor.checkbox[1], true )
				guiSetText( GUIEditor.button[4], 'Turn Off Chat' )
			setElementData( Cplayer, 'chatStatus', 'Online' )
			triggerServerEvent( 'onServerChangeStatus', Cplayer, 'Online' )
		end
	elseif ( source == GUIEditor.button[5] ) then
		guiSetVisible( GUIEditor.window[1], false )
			showCursor( false )
		guiSetInputEnabled( false )
		for cNumber, _ in pairs( chat_Windows ) do
		guiSetVisible( chat_Windows[cNumber].window, false )
		end
	elseif ( source == GUIEditor.gridlist[1] ) then
		local Sel = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
			if ( Sel == -1 ) then
				guiSetEnabled( GUIEditor.button[2], false )
				guiSetText( GUIEditor.button[2], 'Block Player' )
			else
				guiSetEnabled( GUIEditor.button[2], true )
					local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], Sel, 1 ) )
				local serial = getElementData( player, 'chatSystem;playerSerial' )
					if ( serial and string.len( serial ) == 32 ) then
				triggerServerEvent( 'onServerCheckBlockStatus', Cplayer, serial )
			end
		end
	elseif ( source == GUIEditor.button[2] ) then
		clickTimer( GUIEditor.button[2], 3 )
		local Sel = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
			if ( Sel == -1 ) then return end
		local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], Sel, 1 ) )
			local serial = getElementData( player, 'chatSystem;playerSerial' )
		if ( guiGetText( GUIEditor.button[2] ) == 'Block Player' ) then
			triggerServerEvent( 'onServerBlockPlayer', Cplayer, serial, player )
		else
			triggerServerEvent( 'onServerUnblockPlayer', Cplayer, serial )
		end
	elseif ( source == GUIEditor.button[3] ) then
		clickTimer( GUIEditor.button[3], 10 )
		local Sel = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
			if ( Sel == -1 ) then outputChatBox( '#FF0000• ERROR :#FFFFFF Please select the player which you want to poke it !', 255, 255, 255, true ) return end
				local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], Sel, 1 ) )
			local serial = getElementData( player, 'chatSystem;playerSerial' )
		triggerServerEvent( 'onServerSendPoke', Cplayer, player, serial )
	elseif ( source == GUIEditor.combobox[1] ) then
		local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
			if ( Sel == -1 ) then return end
		if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
					addOnlinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
					addOfflinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				addPlayer( player )
			end
		end
	elseif ( source == GUIEditor.checkbox[1] ) then
		if ( guiCheckBoxGetSelected( GUIEditor.checkbox[1] ) == true ) then
			setElementData( Cplayer, 'donotDisturb', 'Enabled' )
			triggerServerEvent( 'onServerChangeStatus', Cplayer, 'Online' )
		else
			setElementData( Cplayer, 'donotDisturb', nil )
			triggerServerEvent( 'onServerChangeStatus', Cplayer, 'Online' )
		end
	end
end );
local txtValue = 0
function showWriteMessage( player, name )
	if ( isTimer( writeTimer ) ) then return end
		guiSetText( chat_Windows[player].Label, '* ['..name..'] is typing')
			guiSetVisible( chat_Windows[player].Label, true )
				writeTimer = setTimer( function(  )
					if ( txtValue >= 3 ) then
						guiSetText( chat_Windows[player].Label, '* ['..name..'] is typing' )
					txtValue = 0
				end
			guiSetText( chat_Windows[player].Label, guiGetText( chat_Windows[player].Label )..'.' )
		txtValue = txtValue + 1
	end, 500, 0 )
end;
addEvent( 'onClientShowWrite', true ); addEventHandler( 'onClientShowWrite', root, showWriteMessage )
function hideWriteMessage( player )
	if ( isTimer( writeTimer ) ) then killTimer( writeTimer ) end
	guiSetText( chat_Windows[player].Label, '* [N/A] is typing ...')
	guiSetVisible( chat_Windows[player].Label, false )
end;
addEvent( 'onClientHideWrite', true ); addEventHandler( 'onClientHideWrite', root, hideWriteMessage )
addEventHandler( 'onClientGUIChanged', root,
function(  )
	local parent = getElementParent( source )
		if ( not parent ) then return end
			local player = getPlayerFromName( guiGetText( parent ) )
		if ( not player ) then return end
			if ( source == chat_Windows[player].editBox ) then
				if ( guiGetText( chat_Windows[player].editBox ) ~= '' ) then
					triggerServerEvent( 'onServerCheckShow', Cplayer, player, getPlayerName( Cplayer ) )
				local messageStringText = guiGetText( chat_Windows[player].editBox )
					checkIfTextChanged( player, messageStringText )
				else
			triggerServerEvent( 'onServerCheckHide', Cplayer, player )
		end
	end
end );
function checkIfTextChanged( player, text )
	setTimer( function(  )
		if ( guiGetText( chat_Windows[player].editBox ) == text ) then
			triggerServerEvent( 'onServerCheckHide', Cplayer, player )
		end
	end, 1000, 1 )
end;
addEvent( 'onClientPokePlayer', true );
addEventHandler( 'onClientPokePlayer', root,
function( pokedBy )
	if ( getElementData( Cplayer, 'donotDisturb' ) ~= 'Enabled' ) then
		playSound( 'Wakeup.mp3' )
		outputChatBox( '#FFFF00• Chat System :#FFFFFF The player : [ '..pokedBy..' ] - Poked you !', 255, 255, 255, true )
	end
end );
addEvent( 'onClientChangeButton', true );
addEventHandler( 'onClientChangeButton', root,
function( Text )
	guiSetText( GUIEditor.button[2], Text )
end );
function buildChattingWith(  )
	local row, column = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
			if ( row == -1 or column == -1 ) then return end
		local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], row, column ) )
			if ( getElementData( player, 'chatStatus' ) ~= 'Online' ) then
				outputChatBox( '#FF0000• ERROR :#FFFFFF Sorry, You cannot send a message to this player .. it\'s offline !', 255, 255, 255, true ) return end
				if ( not chat_Windows[player] ) then
			BuildChatting( player )
		guiBringToFront( chat_Windows[player].window )
	end
end;
addEvent( 'buildChattingWith', true ); addEventHandler( 'buildChattingWith', root, buildChattingWith )
function privateChatDoubleClicks(  )
	if ( source == GUIEditor.gridlist[1] ) then
		local Sel = guiGridListGetSelectedItem( GUIEditor.gridlist[1] )
			if ( Sel == -1 ) then return end
		local player = getPlayerFromName( guiGridListGetItemText( GUIEditor.gridlist[1], Sel, 1 ) )
			if ( player == Cplayer ) then outputChatBox( '#FF0000• ERROR :#FFFFFF You cannot chatting with yourself !', 255, 255, 255, true ) return end
			local serial = getElementData( player, 'chatSystem;playerSerial' )
		triggerServerEvent( 'onServerCheckIfBlocked', Cplayer, serial )
	end
end;
addEventHandler( 'onClientGUIDoubleClick', root, privateChatDoubleClicks );
addEvent( 'onClientReceiveMessage', true );
addEventHandler( 'onClientReceiveMessage', root,
function( player, message )
	if ( not chat_Windows[player] ) then
		BuildChatting( player ) 
	end
		local oldMessages = guiGetText( chat_Windows[player].memo )
			local newString = oldMessages..getPlayerName( player ):gsub( '#%x%x%x%x%x%x', '' )..' : '..message..'\n'
		guiSetText( chat_Windows[player].memo, newString )
	guiMemoSetCaretIndex( chat_Windows[player].memo, string.len( oldMessages ) )
		if ( guiGetVisible( GUIEditor.window[1] ) == false ) then
			if ( getElementData( Cplayer, 'donotDisturb' ) ~= 'Enabled' ) then
				outputChatBox( '#FFFF00• Chat System :#FFFFFF The player : [ '..getPlayerName( player )..' ] - Sent you a message !', 255, 255, 255, true )
			playSound( 'Message.mp3' )
		end
	end
end );
function addPlayer( player )
	local data = getElementData( player, 'chatStatus' ) or 'Online'
		local name = getPlayerName( player )
			local r, g, b = getPlayerNametagColor( player )
				local row = guiGridListAddRow( GUIEditor.gridlist[1] )
					guiGridListSetItemText( GUIEditor.gridlist[1], row, 1, name, false, false )
						guiGridListSetItemText( GUIEditor.gridlist[1], row, 2, data, false, false )
					guiGridListSetItemColor( GUIEditor.gridlist[1], row, 1, r, g, b )
				if ( data == 'Online' ) then
				guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 0, 200, 0 )
			else
		guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 200, 0, 0 )
	end
end;
function addOnlinePlayer( player )
	local data = getElementData( player, 'chatStatus' ) or 'Online'
		if ( data == 'Online' ) then
			local name = getPlayerName( player )
				local r, g, b = getPlayerNametagColor( player )
					local row = guiGridListAddRow( GUIEditor.gridlist[1] )
					guiGridListSetItemText( GUIEditor.gridlist[1], row, 1, name, false, false )
				guiGridListSetItemText( GUIEditor.gridlist[1], row, 2, data, false, false )
			guiGridListSetItemColor( GUIEditor.gridlist[1], row, 1, r, g, b )
		guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 0, 200, 0 )
	end
end;
function addOfflinePlayer( player )
	local data = getElementData( player, 'chatStatus' ) or 'Offline'
		if ( data == 'Offline' ) then
			local name = getPlayerName( player )
		local r, g, b = getPlayerNametagColor( player )
		local row = guiGridListAddRow( GUIEditor.gridlist[1] )
	guiGridListSetItemText( GUIEditor.gridlist[1], row, 1, name, false, false )
		guiGridListSetItemText( GUIEditor.gridlist[1], row, 2, data, false, false )
			guiGridListSetItemColor( GUIEditor.gridlist[1], row, 1, r, g, b )
		guiGridListSetItemColor( GUIEditor.gridlist[1], row, 2, 200, 0, 0 )
	end
end;
addEvent( 'onClientUpdateStatus', true );
addEventHandler( 'onClientUpdateStatus', root,
function( player, status )
	if ( status == 'Online' ) then
		removePlayer( player )
		local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
			if ( Sel == -1 ) then addPlayer( player ) return end
		if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
					addOnlinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
					addOfflinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
			addPlayer( player )
		end
	end
	else
		destroyChattingWindow( player )
			removePlayer( player )
		local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
			if ( Sel == -1 ) then addPlayer( player ) return end
		if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
					addOnlinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
					addOfflinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
			addPlayer( player )
		end
	end
	end
end );
addEvent( 'onClientDestroyChats', true );
addEventHandler( 'onClientDestroyChats', root,
function( player )
	destroyChattingWindow( player )
end );
function player_Join( player )
	if ( player ~= Cplayer ) then
	local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
			if ( Sel == -1 ) then addPlayer( player ) return end
		if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
					addOnlinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
					addOfflinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
			addPlayer( player )
		end
	end
end
end;
addEvent( 'onClientAddPlayer', true ); addEventHandler( 'onClientAddPlayer', root, player_Join )
function player_Quit( player )
	removePlayer( player )
	destroyChattingWindow( player )
end;
addEvent( 'onClientRemovePlayer', true ); addEventHandler( 'onClientRemovePlayer', root, player_Quit )
function player_ChangedName( player, name )
	for i = 0, guiGridListGetRowCount( GUIEditor.gridlist[1] ) do
		if ( guiGridListGetItemText( GUIEditor.gridlist[1], i, 1 ) == name ) then
			guiGridListRemoveRow( GUIEditor.gridlist[1], i )
		end
	end
		destroyChattingWindow( player )
	setTimer( function(  )
		local Sel = guiComboBoxGetSelected( GUIEditor.combobox[1] )
			if ( Sel == -1 ) then addPlayer( player ) return end
		if ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Online' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Online' ) then
					addOnlinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Offline' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
				if ( getElementData( player, 'chatStatus' ) == 'Offline' ) then
					addOfflinePlayer( player )
				end
			end
		elseif ( guiComboBoxGetItemText( GUIEditor.combobox[1], Sel ) == 'Both (All)' ) then
				guiGridListClear( GUIEditor.gridlist[1] )
			for _, player in ipairs( getElementsByType( 'player' ) ) do
			addPlayer( player )
		end
	end
end, 1500, 1 )
end;
addEvent( 'onClientRemovePlayer_ChangedName', true ); addEventHandler( 'onClientRemovePlayer_ChangedName', root, player_ChangedName )
function sendMessage( eleEdit )
	local parent = getElementParent( source )
		if ( parent == false or not parent ) then return end
			local player = getPlayerFromName( guiGetText( parent ) )
		if ( player == false or not player ) then return end
	if ( eleEdit == chat_Windows[player].editBox ) then
		sendNewMessage( player )
	end
end;
addEventHandler( 'onClientGUIAccepted', root, sendMessage );
addEventHandler( 'onClientResourceStart', resourceRoot,
function(  )
	triggerServerEvent( 'onServerSetPlayerSerial', Cplayer )
		setTimer( function(  )
	for _, player in ipairs( getElementsByType( 'player' ) ) do
		addPlayer( player )
	end
end, 1000, 1 )
end );

 

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...