[YARDIM] Side Chat Sistemi

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı SARl

  • Acemi Üye
  • *
    • İleti: 145
: 21 Aralık 2018, 17:25:18
Merhaba Linki görebilmek için Kayıt olun yada Giriş yapın. Bunu /tkt Türk Komando Timi Karargah'ına Işınlandı Diye Yapar mısınız Altına boşluk bırakın ben daha ekliyeceğim.
« Son Düzenleme: 21 Aralık 2018, 17:55:29 Gönderen: +LJ »
Linki görebilmek için Kayıt olun yada Giriş yapın.
 


MTASATURK

[YARDIM] Side Chat Sistemi
« : 21 Aralık 2018, 17:25:18 »

Çevrimdışı Mahlukat

  • Uzman Üye
  • *
    • İleti: 637
Yanıtla #1 : 21 Aralık 2018, 20:40:03
Kod: lua
addCommandHandler("tkt",function(oyuncu)
exports["SIDECHAT_SCRİPTİNİN_İSMİ_BURAYA"]:outputSideChat(getPlayerName(oyuncu).." Türk Komando Timi Karargah'ına Işınlandı",root,255,0,0)
end)
Linki görebilmek için Kayıt olun yada Giriş yapın.
 


Çevrimdışı SARl

  • Acemi Üye
  • *
    • İleti: 145
Yanıtla #2 : 22 Aralık 2018, 06:38:46
Tamam bunu bana script olarak atsan sana zahmet ben çok anlamadım.
Yukarda Script var zaten

Mesaj Birleştirildi: [time]23 Aralık 2018, 08:52:19[/time]
Yardım Eder misiniz Kodlar Oyle Linki görebilmek için Kayıt olun yada Giriş yapın. Yardım Eder misin ?
Server Lua
Kod: lua
--[[
+----------------------------------------------------------------------------
|   Dx Side Chat Script
|   ========================================
|   by MrTasty
|   (c) 2012-2014 | Creative Commons 3.0
|   http://creativecommons.org/licenses/by/3.0/
|   ========================================
+-----------------------------------------------------------------------------
|   You are allowed to adapt, copy, redistribute this script.
|   You are not allowed to remove the original author of this script.
+-----------------------------------------------------------------------------
]]--

function outputSideChat(message, to, r, g, b)
triggerClientEvent(to or root, "onSCMessageSend", root, string.format("#%.2X%.2X%.2X", r,g,b)..message)
end

-- ADVANCED EXAMPLE | /scSay <message | use ~ to toggle golden colour>
-- "~" replaces "|c%%%%|" (from BF2 engine, used in BFH and BFP4F) | * % = Wildcard
function subString(str,chunkSize)
if not str or type(str) ~= "string" or not chunkSize or type(chunkSize) ~= "number" then return false end
local returnTable = {}
while #str >= chunkSize do
table.insert(returnTable,str:sub(1,chunkSize))
str = str:sub(chunkSize+1)
if #str < chunkSize then
table.insert(returnTable,str)
end
end
return returnTable
end

function getTextColorAtEnd(text)
local text = text:reverse()
if text:find("%x%x%x%x%x%x#") then
local sp, ep = text:find("%x%x%x%x%x%x#")
return text:sub(sp, ep):reverse() or false
end
end

function adminSay(pla, cmd, ...)
local message = {...}
local messageText = table.concat(message, " ")
while messageText:find("#%x%x%x%x%x%x") do
messageText = messageText:gsub("#%x%x%x%x%x%x", "")
end
local message2 = subString(messageText,1)
for k, v in ipairs(message2) do
if v == "~" then
local messageText = table.concat(message2, "")
local color = getTextColorAtEnd(messageText)
if color and color == "#ffd000" then
message2[k] = "#32ff64"
else
message2[k] = "#ffd000"
end
end
end
local messageText = table.concat(message2, "")
if messageText and #messageText > 0 then else return end
local name = getPlayerName(pla)
repeat name = name:gsub("#%x%x%x%x%x%x", "")
until not name:find("#%x%x%x%x%x%x")
triggerClientEvent(root, "onSCMessageSend", root, "#32ff64"..name.."#32ff64: "..messageText)
end
addCommandHandler("scSay", adminSay)
Client Lua
Kod: lua
--[[
+----------------------------------------------------------------------------
|   Dx Side Chat Script
|   ========================================
|   by MrTasty
|   (c) 2012-2014 | Creative Commons 3.0
|   http://creativecommons.org/licenses/by/3.0/
|   ========================================
+-----------------------------------------------------------------------------
|   You are allowed to adapt, copy, redistribute this script.
|   You are not allowed to remove the original author of this script.
+-----------------------------------------------------------------------------
]]--

function outputSideChat(message, r, g, b)
triggerEvent("onSCMessageSend", root, string.format("#%.2X%.2X%.2X", r,g,b)..message)
end

--The Actual Code | Do not modify unless you know what you're doing--
local sx,sy = guiGetScreenSize ()
local scState = true
local maxLines = 8
local oocMessages = {}
local font = "default-bold" --chatData["chat_font"]

addEventHandler ("onClientRender",getRootElement(),
function ()
if isPlayerHudComponentVisible ("radar") then
if scState then
local chatData = getChatboxLayout()
local _,scale = chatData["chat_scale"]
local bg = {chatData["chat_color"]}
local color = --[[{205,205,205,255}]] chatData["chat_text_color"]
local lines = chatData["chat_lines"]
local chatX,chatY = 0.015625*sx,16 + 15*lines + 25
for k,v in ipairs(oocMessages) do
local tx,ty = chatX,chatY + (maxLines+1)*15 - k*15
local vNC = v
repeat vNC = vNC:gsub("#%x%x%x%x%x%x", "")
until not vNC:find("#%x%x%x%x%x%x")
dxDrawText (vNC,tx+1,ty+1,0,0,tocolor(0,0,0,255),1,font,"left","top",false,false,false,false)
dxDrawText (v,tx,ty,0,0,tocolor(color[1],color[2],color[3],color[4]),1,font,"left","top",false,false,false,true)
end
end
end
end
)

addEvent ("onSCMessageSend",true)
addEventHandler ("onSCMessageSend",getRootElement(),
function (message)
if message then
local length = #oocMessages
if #oocMessages >= maxLines then
table.remove (oocMessages,maxLines)
end
local text = message
table.insert (oocMessages,1,text)
local textNC = text
repeat textNC = textNC:gsub("#%x%x%x%x%x%x", "")
until not textNC:find("#%x%x%x%x%x%x")
outputConsole (textNC)
if removeMssagesTimer and isTimer(removeMssagesTimer) then killTimer(removeMssagesTimer) end
removeMssagesTimer = setTimer(function() oocMessages = {} end, 50000, 1)
end
end)

function isOOCChatToggled ()
return scState
end

function toggleSideChat (state)
if state ~= scState then
scState = state
end
end

function togOOCCMD (cname,arg)
if arg:lower() == "sidechat" or arg:lower() == "sc" then
toggleSideChat (not scState)
end
end
--addCommandHandler ("tog",togOOCCMD)
--addCommandHandler ("toggle",togOOCCMD)
Yardım Ederseniz Sevinirim.
« Son Düzenleme: 23 Aralık 2018, 07:47:38 Gönderen: kemal0101 »
Linki görebilmek için Kayıt olun yada Giriş yapın.