AR/showChat

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

هذه الوظيفة تستخدم لاخفاء واظهار الكلام بالشات.

Syntax

Click to collapse [-]
Client
bool showChat ( bool show )

شرح الارقمنات

  • show: الظهور true = اظهار الشات , false = اخفاء الشات.

Returns

Returns true if the player's chat was shown or hidden successfully, false otherwise.

Click to collapse [-]
Server
bool showChat ( player thePlayer, bool show )

شرح الارقمنات

  • thePlayer: الاعب الذي تبي تخفي له الشات.
  • show: الظهور true = اظهار الشات , false = اخفاء الشات.

Returns

Returns true if the player's chat was shown or hidden successfully, false otherwise.

Example

Click to collapse [-]
Client

هذا المثال يخفي الشات عند الضغط على حر ف 'i'

--This example below is for all versions until 1.4:
local isChatVisible = true --Let's assume the chat is visible as soon as the resource starts.

function chat(key, keyState)
    if isChatVisible then --Check or the chat is visible.
        showChat(false) --If it is, hide it.
        isChatVisible = false
    else
        showChat(true) --If it is not, show it.
        isChatVisible = true
    end
end

bindKey("i", "down", chat) --Make a bind key to start the function as soon as a player presses the key 'i'


--This example below is for version 1.4 and up:
function chat(key, keyState)
    if isChatVisible() then --Check or the chat is visible.
        showChat(false) --If it is, hide it.
    else
        showChat(true) --If it is not, show it.
    end
end

bindKey("i", "down", chat) --Make a bind key to start the function as soon as a player presses the key 'i'

See Also