[YARDIM] - Level Sistemi

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı ardaabo

  • Acemi Üye
  • *
    • İleti: 145
: 01 Eylül 2021, 11:04:46
Merhabalar, bu script de oyuncu öldürünce puan veriyor bunu hem oyuncu hem de zombi öldürünce de puan vermesini istiyor nasıl yapabiliriz

local oldurme = getElementData(localPlayer, "murders")      - buraya bir veri daha ekleyebiliyor muyum nasıl olabilir

datalar: murders , zombieskilled
client
Kod
local sx, sy = guiGetScreenSize ( )
local bg, bu = 500, 25
local x,y = (sx - bg) / 2, (sy  - bu) / 1
local bardurum = true
local tagdurum = true

local yukseklik = 1 -- Kafa üstünde yazan tagın ne kadar yüksekte olacağı(arttırmak için çoğaltın)

function render()
if isPlayerMapVisible()  then return end
if bardurum == false then return end
local veriler = getElementData(localPlayer, "Veriler")
local oldurme = getElementData(localPlayer, "murders")
local ceza = getElementData(localPlayer, "Ceza")

if veriler then

local sonrakiLevel = veriler.sonraki
local suankiLevel = veriler.suanki
local tag = tostring(veriler.tag)
local sonrakitag = tostring(veriler.sonrakitag)
local oncekitag = tostring(veriler.oncekitag)
if sonrakitag ~= "" then
levelilerleme = (100*(oldurme-suankiLevel)/(sonrakiLevel - suankiLevel))*(bg/100)
else
levelilerleme = 0
end


if ceza then
a = 255
dxDrawBorderedText("Cezanın bitmesina kalan süre: #CC0000"..ceza, sx/2-sx/4, sy-bu-100, sx-sx/4, sy, tocolor(255,255,255,a), 1.2, "clear","center","center",false,false,true, true)
else
a = 0
end

dxDrawRectangle( x,y,bg,bu, tocolor(0,0,0,150) ) -- arka siyah
addOutlines (x,y,bg,bu, tocolor (0, 0, 0, 255), 1) -- siyah kenar çizgiler
dxDrawRectangle( x+1,y+3,levelilerleme,bu-6, tocolor(155, 0, 0,255) ) -- kırmızı
dxDrawBorderedText("Öldürme: "..oldurme.." | Sonraki:  "..sonrakiLevel, sx/2-sx/4, sy-bu, sx-sx/4, sy, tocolor(255,255,255,255), 1, "clear","center","center",false,false,false)
dxDrawBorderedText(tag, sx/2-sx/4, sy-bu-50, sx-sx/4, sy, tocolor(255,255,255,255),  math.min ( 0.3*(150)*1.4,1.3 - (0.5 + math.sin(math.rad(getTickCount())) / 3) / 12) * 1, "clear","center","center",false,false,false)
dxDrawBorderedText(sonrakitag, sx/2-sx/8, sy-bu-50, sx-sx/8, sy, tocolor(255,255,255,200), 0.9, "clear","center","center",false,false,false)
dxDrawBorderedText(oncekitag, sx/2-sx/2, sy-bu-50, sx-sx/4, sy, tocolor(255,255,255,200), 0.9, "clear","center","center",false,false,false)
end
end
addEventHandler("onClientRender", root, render)

addCommandHandler("bar", function()
bardurum = not bardurum
end)

addCommandHandler("tag", function()
tagdurum = not tagdurum
end)

function dxDrawBorderedText( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded )
dxDrawText ( text, x - 1, y - 1, w - 1, h - 1, tocolor ( 0, 0, 0, 100 ), scale, font, alignX, alignY, clip, wordBreak, postGUI , colorCoded )
dxDrawText ( text, x + 1, y - 1, w + 1, h - 1, tocolor ( 0, 0, 0, 100 ), scale, font, alignX, alignY, clip, wordBreak, postGUI , colorCoded)
dxDrawText ( text, x - 1, y + 1, w - 1, h + 1, tocolor ( 0, 0, 0, 100 ), scale, font, alignX, alignY, clip, wordBreak, postGUI , colorCoded )
dxDrawText ( text, x + 1, y + 1, w + 1, h + 1, tocolor ( 0, 0, 0, 100 ), scale, font, alignX, alignY, clip, wordBreak, postGUI , colorCoded )
dxDrawText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded )
end

function addOutlines(x, y, width, height, lineColor, lineSize, postGUI)
    dxDrawLine(x - 1, (y - lineSize), x - 1, y + height + (lineSize - 1), lineColor, lineSize, postGUI); --left
    dxDrawLine(x + width, (y) - 1, (x) - 1, (y) - 1, lineColor, lineSize, postGUI); -- top
    dxDrawLine((x) - 1, y + height, x + width, y + height, lineColor, lineSize, postGUI); -- bottom
    dxDrawLine(x + width, y - lineSize, x + width, y + height + (lineSize - 1), lineColor, lineSize, postGUI); -- right
end

r,g,b = 155,155,155
rainbow = 0
function rainboww()
                if rainbow == 0 then
                        if r < 250  then
                                r = r + 3
                                if r > 255 then
                                        r = 250
                                end
                        else
                                rainbow = 1
                        end
                end
                if rainbow == 1 then
                        if g < 250 then
                                g = g + 3
                        else
                                rainbow = 2
                        end
                elseif rainbow == 2 then
                        if b < 255 then
                                if r > 0 then
                                        if r < 3 then
                                                r = r - 1
                                        else
                                                r = r - 3
                                        end
                                else
                                        r = 0
                                end
                                b = b + 3
                                if b > 255 then
                                        b = 255
                                end
                        else
                                rainbow = 3
                        end
                elseif rainbow == 3 then
                        if g > 0 then
                                if r > 0 then
                                        if r < 3 then
                                        r = r - 1
                                        else
                                                r = r - 3
                                        end
                                else
                                        r = 0
                                end
                                if g < 3 then
                                        g = g - 1
                                else
                                        g = g - 3
                                end
                                if g < 0 then
                                        g = 0
                                end
                        else
                                rainbow = 4
                        end
                elseif rainbow == 4 then
                        if b > 0 then
                                if b < 3 then
                                        b = b - 1
                                else
                                        b = b - 3
                                end
                                if b < 0 then
                                        b = 0
                                end
                        else
                                b = 0
                                rainbow = 0
                        end
                end
end
addEventHandler("onClientRender",getRootElement(),rainboww)

function kafaUstuTag()
if kafaustutag == true then
local streamedPlayers = getElementsByType ("player", root, true)
if streamedPlayers and #streamedPlayers ~= 0 then
local lpos = {getElementPosition(localPlayer)}
for _,p in ipairs (streamedPlayers) do
if p and isElement (p) then
local veriler = getElementData(p, "Veriler")
if veriler then
local ppos = {getElementPosition(p)}
if getDistanceBetweenPoints3D (lpos[1], lpos[2], lpos[3], ppos[1], ppos[2], ppos[3]) <= 20 then
local x, y = getScreenFromWorldPosition (ppos[1], ppos[2], ppos[3]+yukseklik)
if x and y then
if tagdurum == true then
dxDrawBorderedText (veriler.tag, x, y, x, y, tocolor (r,g,b), 1.5, "default-bold", "center")
end
end
end
end
end
end
end
end
end
addEventHandler ("onClientRender", root, kafaUstuTag)
« Son Düzenleme: 01 Eylül 2021, 11:07:18 Gönderen: ardaabo »
 


MTASATURK

[YARDIM] - Level Sistemi
« : 01 Eylül 2021, 11:04:46 »

Çevrimdışı Ivar The Boneless

  • Yeni Üye
  • *
    • İleti: 45
Yanıtla #1 : 01 Eylül 2021, 15:14:52
Zombilerin oluşturulduğu server kodlarını at bize o kısımda oluşturulan pedlere data verelim bu işleminde ardından onClientPedWasted eventi ile pedlerin ölümünü kontrol edelim sonra eğer ölen pedin datası bizim zombi pedlerine verdiğimiz data ile aynı ise saldıran oyuncunun sayısını 1 arttıralım eğer dediklerimden bir şey anlamadıysan zombi scripptini at.