Jump to content

كيف ..؟


Recommended Posts

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
		guiSetVisible( chat_Windows[cNumber].window, guiGetVisible( privtechat ) )
	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 );


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

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