[YARDIM] Killmessagese Rectangle Ekleme

Ky · 5 · 1029

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı Ky

  • Uzman Üye
  • *
    • İleti: 614
: 08 Mart 2019, 18:56:29
Arkadaşlar killmessages scriptine rectangle eklemek istiyorum denedim fakat çalıştıramadım rectanglelib aşağıda Bunu yapmamda yardımcı olucak arkadaşlar varsa şimdiden teşekkür ederim.
Kod
dxRectangle = {}
dxRectangle_mt = { __index = dxRectangle }
local g_screenX,g_screenY = guiGetScreenSize()
local visibleRectangles = {}
------
local defaults = {
fX = 0.5,
fY = 0.5,
fWidth = 0,
fHeight = 0,
bRelativePosition = true,
bRelativeSize = true,
tColor = {0,0,0,150},
bColor = {150,0,0,255},
tThickness = 1,
bPostGUI = false,
bVisible = true,
}

function dxRectangle:create(x, y, width, height, color )
assert(not self.fX, "attempt to call method 'create' (a nil value)")
if ( type(path) ~= "string" ) or ( not tonumber(x) ) or ( not tonumber(y) ) then
outputDebugString ( "dxRectangle:create - Bad argument", 0, 112, 112, 112 )
return false
end
    local new = {}
setmetatable( new, dxRectangle_mt )
--Add default settings
for i,v in pairs(defaults) do
new[i] = v
end
new.fX = x or new.fX
new.fY = y or new.fY
new.tColor = color
new.fWidth = width or new.fWidth
new.fHeight = height or new.fHeight
if type(relative) == "boolean" then
new.bRelativePosition = relative
new.bRelativeSize = relative
end
visibleRectangles[new] = true
return new
end
--[[
function dxRectangle:border(path)
if type(path) ~= "string" then return self.strPath end
self.strPath = path
return true
end]]

function dxRectangle:position(x,y,relative)
if not tonumber(x) then return self.fX, self.fY end
self.fX = x
self.fY = y
if type(relative) == "boolean" then
self.bRelativePosition = relative
else
self.bRelativePosition = true
end
return true
end

function dxRectangle:size(x,y,relative)
if not tonumber(x) then return self.fWidth, self.fHeight end
self.fWidth = x
self.fHeight = y
if type(relative) == "boolean" then
self.bRelativeSize = relative
else
self.bRelativeSize = true
end
return true
end

function dxRectangle:color(r,g,b,a)
if not tonumber(r) then return unpack(self.tColor) end
g = g or self.tColor[2]
b = b or self.tColor[3]
a = a or self.tColor[4]
self.tColor = { r,g,b,a }
return true
end

function dxRectangle:visible(bool)
if type(bool) ~= "boolean" then return self.bVisible end
self.bVisible = bool
if bool then
visibleRectangles[self] = true
else
visibleRectangles[self] = nil
end
return true
end

function dxRectangle:destroy()
self.bDestroyed = true
setmetatable( self, self )
return true
end

function dxRectangle:postGUI(bool)
if type(bool) ~= "boolean" then return self.bPostGUI end
self.bPostGUI = bool
return true
end

addEventHandler ( "onClientRender", getRootElement(),
function()
for self,_ in pairs(visibleRectangles) do
while true do
if self.bDestroyed then
visibleRectangles[self] = nil
break
end
local x,y,width,height = self.fX,self.fY,self.fWidth,self.fHeight
if self.bRelativePosition then
x = x/g_screenX
y = y/g_screenY
end
if self.bRelativeSize then
width = width/g_screenX
height = height/g_screenY
end
dxDrawRectangle ( x,y, width, height, tocolor(unpack(self.tColor)), self.bPostGUI )
break
end
end
end
)

« Son Düzenleme: 15 Mart 2019, 21:30:06 Gönderen: Narkoz »
 


MTASATURK

[YARDIM] Killmessagese Rectangle Ekleme
« : 08 Mart 2019, 18:56:29 »

Çevrimdışı furkan08

  • Yeni Üye
  • *
    • İleti: 75
Yanıtla #1 : 11 Mart 2020, 16:55:11
Bu Konudakini yapabilen varsa bende kullanmak isterim Linki görebilmek için Kayıt olun yada Giriş yapın.
 


Çevrimdışı musa62

  • Yeni Üye
  • *
    • İleti: 34
Yanıtla #2 : 11 Mart 2020, 18:21:25
güzel birşey cıkabilir tabi yapana   ::)
 


Çevrimdışı Ky

  • Uzman Üye
  • *
    • İleti: 614
Yanıtla #3 : 11 Mart 2020, 20:04:36
Linki görebilmek için Kayıt olun yada Giriş yapın.
güzel birşey cıkabilir tabi yapana   ::)
killmessages içerisine gir ardından textlib.lua gir bu fonksiyonu bul aşağıya attığım ile değiştir.
Kod
function dxCreateCustomDX(text,left,top,right,bottom,color,scale,font,alignX,alignY,clip,wordBreak,postGUI)
if not text or not left or not top then
return false
end
local xOffset = nil
local fpat = "(.-)#(%x%x%x%x%x%x)"
local s,e,cap,col = text:find(fpat,1)
local last_end = 1
if not alignX then
alignX = "left"
elseif alignX == "center" then
xOffset = -(dxGetTextWidth(string.gsub(text,"#%x%x%x%x%x%x",""),scale,font)/2)
else
xOffset = 0
end
while s do
if cap == "" and col then
color = tocolor(tonumber("0x"..col:sub(1,2)), tonumber("0x"..col:sub(3,4)), tonumber("0x"..col:sub(5,6)),255)
end
if s ~= 1 or cap ~= "" then
dxDrawText(cap,left+xOffset,top,left+xOffset,bottom,color,scale,font,alignX,alignY,false,false,postGUI)
xOffset = xOffset+dxGetTextWidth(cap,scale,font)
color = tocolor(tonumber("0x"..col:sub(1,2)), tonumber("0x"..col:sub(3,4)), tonumber("0x"..col:sub(5,6)),255)
end
last_end = e+1
s,e,cap,col = text:find(fpat,last_end)
end
if last_end <= #text then
cap = text:sub(last_end)
dxDrawText(cap,left+xOffset,top,left+xOffset,bottom,color,scale,font,alignX,alignY,false,false,postGUI)
dxDrawRectangle ( left+xOffset-30,top+900+113,300,20, tocolor(455,0,0,70), postGUI )
xOffset = xOffset+dxGetTextWidth(cap,scale,font)
end
return true
end
 


Çevrimdışı furkan08

  • Yeni Üye
  • *
    • İleti: 75
Yanıtla #4 : 11 Mart 2020, 23:47:28
her ekrana göre degil ama onu nasıl ayarlıcaz
« Son Düzenleme: 12 Mart 2020, 00:05:21 Gönderen: furkan08 »