Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2020-08-27, 14:14


StifMaster







Wiek: 30
Na forum: 3525 dni
Posty: 57
Nick w MP: Sztefi

Piwa: 5

Respekt: 50

Problem polega na tym, ?e jak kto? zginie, to ginie ka?dy na serwerze. Oraz mo?na biega? podczas bw.

c.lua
--[[
    ModernMTA
    AuthorR35 
    Contact authorDiscord R35#5507      
    Copyright © The rights to use the code are held by the ModernMTA server and author.
]]


local screen = {guiGetScreenSize()};
scale 1;
if screen[1] < 1920 then scale math.min(21920/screen[1]); end

local bw = {};

bw.visible nil;
bw.time 0;
bw.tick nil;

bw.font dxCreateFont('files/Roboto-Regular.ttf'14 scalefalse'cleartype_natural');
bw.skull dxCreateTexture('files/skull.png''argb'true'clamp');

bw.scale = {
    bg = {00screen[1], screen[2]},
    skull = {screen[1] / - (128 2) / scalescreen[2] / 160 scale128 scale128 scale},
    title = {00screen[1], screen[2]},
    scd = {0100 scalescreen[1], screen[2] - (50 scale)},
};

bw.camera_rot 0;
bw.draw = function()
    dxDrawRectangle(bw.scale.bg[1], bw.scale.bg[2], bw.scale.bg[3], bw.scale.bg[4], 0x99000000);
    dxDrawImage(bw.scale.skull[1], bw.scale.skull[2], bw.scale.skull[3], bw.scale.skull[4], bw.skull0000xFFBEBEBE);
    dxDrawText('Straci?e?/a? przytomno??'bw.scale.title[1], bw.scale.title[2], bw.scale.title[3], bw.scale.title[4], 0xFFFF11001bw.font'center''center');
    dxDrawText('Wybudzisz si? za '..secondsToTimeDesc(bw.time), bw.scale.scd[1], bw.scale.scd[2], bw.scale.scd[3], bw.scale.scd[4], 0xFFD4D4D41bw.font'center''center');
    
    if bw.tick and getTickCount() - bw.tick >= 1000 then
        bw.time bw.time 1;
        bw.tick getTickCount();
        if bw.time <= 0 then
            bw.time 0;
            bw.destroy();
        end
    end
    
    local pos = {getElementPosition(localPlayer)};
    local r_pos = {getPointFromDistanceRotation(pos[1], pos[2], 3bw.camera_rot)};
    setCameraMatrixr_pos[1], r_pos[2], pos[3]+3pos[1], pos[2], pos[3]);
    bw.camera_rot bw.camera_rot 0.3;
end


bw.create = function( time )
    if bw.visible then return end

    showChatfalse );
    triggerEvent('hud:toggle'localPlayerfalse);

    bw.time time;
    bw.tick getTickCount();
    bw.visible true;
    addEventHandler('onClientRender'rootbw.draw);

end
addEvent('bw:create'true);
addEventHandler('bw:create'localPlayerbw.create);

bw.destroy = function()
    --if bw.visible then
    
        showChattrue );
        triggerEvent('hud:toggle'localPlayertrue);

        bw.time 0;
        bw.tick nil;
        bw.visible nil;
        removeEventHandler('onClientRender'rootbw.draw);
        triggerServerEvent('bw:spawn'resourceRoot);
   -- end
end
addEvent('bw:destroy'true);
addEventHandler('bw:destroy'localPlayerbw.destroy);

addEventHandler('onClientPlayerWasted'root, function()
    bw.create10true );
end);

function createBW( ... )
    bw.create(...);
end

function destroyBW()
    bw.destroy();
end


s.lua
--[[
    ModernMTA
    AuthorR35 
    Contact authorDiscord R35#5507      
    Copyright &#169; The rights to use the code are held by the ModernMTA server and author.
]]

local noti exports['psrpg_noti'];
local bw = {};

bw.spawn = function()
    spawnPlayer(clientVector3(getElementPosition(client)), 0getElementModel(client), getElementInterior(client), getElementDimension(client));
    setCameraTarget(client);
end
addEvent('bw:spawn'true);
addEventHandler('bw:spawn'resourceRootbw.spawn);

bw.create = function( playertime )
    triggerClientEvent(player'bw:create'playertime);
end

bw.destroy = function( player )
    triggerClientEvent(player'bw:destroy'player);
end

function createBW(...)
    bw.create(...);
end

function destroyBW(...)
    bw.destroy(...);
end


addCommandHandler('bw', function(playercmdtargettime)
    if not getElementData(player'user:admin'then return end
    if not target or not time or not tonumber(timethen noti:alert(player'info''U?yj: /bw [nazwa/id] [czas w sekundach]') return end
    local target exports['mm-core']:findPlayer(playertarget);
    if not target then noti:alert(player'error''Nie znaleziono podanego gracza.') return end
    if not getElementData(target'user:uid'then noti:alert(player'error''Ten gracz nie jest zalogowany.') return end
    if isPedDead(targetthen noti:alert(player'error''Ten gracz ju? posiada BW.') return end
    bw.create(targettime);
    noti:alert(target'info'getPlayerName(player):gsub('#%x%x%x%x%x%x','')..' na?o?y? tobie bw na czas '..time..' sekund.');
    noti:alert(player'info''Na?o?y?e?/a? BW graczu '..getPlayerName(target):gsub('#%x%x%x%x%x%x','')..' na '..time..' sekund');

    killPed(player);
end);

addCommandHandler('unbw', function(playercmdtarget)
    if not getElementData(player'user:admin'then return end
    if not target then noti:alert(player'info''U?yj: /unbw [nazwa/id]') return end
    local target exports['mm-core']:findPlayer(playertarget);
    if not target then noti:alert(player'error''Nie znaleziono podanego gracza.') return end
    if not isPedDead(targetthen noti:alert(player'error''Ten gracz nie posiada BW.') return end
    bw.destroy(target);
    noti:alert(target'info''BW zosta?o tobie zdj?te przez '..getPlayerName(player):gsub('#%x%x%x%x%x%x',''));
    noti:alert(player'info''Zdje?e?/a? BW graczu '..getPlayerName(target):gsub('#%x%x%x%x%x%x',''));
end);


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-27, 14:18


VVirmex

Sgrypter luja






Wiek: 21
Na forum: 3365 dni
Posty: 281
Nick w MP: AxyZ

Piwa: 234

Respekt: 110
Respekt: 110

Hmmm..
A przy bieganiu pr?bowa?e? u?ywa?:

Więcej informacji znajdziesz w Wikipedii MTA:

setPedAnimation

by na?o?y? animacj? z komendy ./umierasz ?

Albo nie wiem czy to to, ale na?o?y?e? root na onClientRender.
 addEventHandler('onClientRender'rootbw.draw); 


Je?li co? ?le napisa?em z tym clientrenderem, to poprawcie mnie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-27, 14:59


StifMaster







Wiek: 30
Na forum: 3525 dni
Posty: 57
Nick w MP: Sztefi

Piwa: 5

Respekt: 50

VVirmex, Juz naprawi?em ze kazdy ginie>
Kod:

addEventHandler('onClientPlayerWasted', root, function()

zamieni?em na local player, ale kolejna sprawa zeby nie respilo na spawnie tylko zeby postac tam gdzie zginela byla, i ta animacja

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-27, 15:07


TheSebaPL

Mod-team






Wiek: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

Respekt: 640,5
Respekt: 640,5Respekt: 640,5

StifMaster, no to funkcja pobierania pozycji gracza nast?pnie teleportowania ci? do niej.


Więcej informacji znajdziesz w Wikipedii MTA:

getElementPosition



Więcej informacji znajdziesz w Wikipedii MTA:

setElementPosition


Je?eli pomyli?em si? z funkcjami poprawcie mnie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-27, 15:08


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Pobieraj pozycj?, zapisuj? j? gdzie? i spawnuj gracza.


Więcej informacji znajdziesz w Wikipedii MTA:

getElementPosition


Więcej informacji znajdziesz w Wikipedii MTA:

setElementData


Więcej informacji znajdziesz w Wikipedii MTA:

spawnPlayer


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-27, 15:14


StifMaster







Wiek: 30
Na forum: 3525 dni
Posty: 57
Nick w MP: Sztefi

Piwa: 5

Respekt: 50

Wilq,

Kod:

addEvent("dm:respawn", true)
addEventHandler("dm:respawn", root, function()
local x, y, z = getElementPosition(source)
spawnPlayer(source, x, y, z, 0, getElementModel(source))
setCameraTarget(source, source)
setPedAnimation(source)
end)


tak?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-27, 15:18


TheSebaPL

Mod-team






Wiek: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

Respekt: 640,5
Respekt: 640,5Respekt: 640,5

StifMaster, wklej i zobacz, je?eli b?dziesz mia? b??d to poka? go i wklej kod pami?taj nikt nie da ci gotowca mo?e ci pom?c w zrobieniu, ale nie da ci ca?y gotowy kod.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-27, 15:25


StifMaster







Wiek: 30
Na forum: 3525 dni
Posty: 57
Nick w MP: Sztefi

Piwa: 5

Respekt: 50

TheSebaPL, Niestety nadal respi na spawnie, brak bledow db3

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-27, 15:44


TheSebaPL

Mod-team






Wiek: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

Respekt: 640,5
Respekt: 640,5Respekt: 640,5

"StifMaster" napisał/a:

TheSebaPL, Niestety nadal respi na spawnie, brak bledow db3



kurna ile mam pisa? podawaj kod po twojej edycji....

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-27, 15:59


StifMaster







Wiek: 30
Na forum: 3525 dni
Posty: 57
Nick w MP: Sztefi

Piwa: 5

Respekt: 50

TheSebaPL,

Kod:

s.lua
--[[
ModernMTA
Author: R35
Contact author: Discord R35#5507
Copyright © The rights to use the code are held by the ModernMTA server and author.
]]

local noti = exports['psrpg_noti'];
local bw = {};

bw.spawn = function()
spawnPlayer(client, Vector3(getElementPosition(client)), 0, getElementModel(client), getElementInterior(client), getElementDimension(client));
setCameraTarget(client);
end
addEvent('bw:spawn', true);
addEventHandler('bw:spawn', resourceRoot, bw.spawn);

bw.create = function( player, time )
triggerClientEvent(player, 'bw:create', player, time);
end

bw.destroy = function( player )
triggerClientEvent(player, 'bw:destroy', player);
end

function createBW(...)
bw.create(...);
end

function destroyBW(...)
bw.destroy(...);
end

addEvent("dm:respawn", true)
addEventHandler("dm:respawn", root, function()
local x, y, z = getElementPosition(source)
spawnPlayer(source, x, y, z, 0, getElementModel(source))
setCameraTarget(source, source)
setPedAnimation(source)
end)


addCommandHandler('bw', function(player, cmd, target, time)
if not getElementData(player, 'user:admin') then return end
if not target or not time or not tonumber(time) then noti:alert(player, 'info', 'U?yj: /bw [nazwa/id] [czas w sekundach]') return end
local target = exports['mm-core']:findPlayer(player, target);
if not target then noti:alert(player, 'error', 'Nie znaleziono podanego gracza.') return end
if not getElementData(target, 'user:uid') then noti:alert(player, 'error', 'Ten gracz nie jest zalogowany.') return end
if isPedDead(target) then noti:alert(player, 'error', 'Ten gracz ju? posiada BW.') return end
bw.create(target, time);
noti:alert(target, 'info', getPlayerName(player):gsub('#%x%x%x%x%x%x','')..' na?o?y? tobie bw na czas '..time..' sekund.');
noti:alert(player, 'info', 'Na?o?y?e?/a? BW graczu '..getPlayerName(target):gsub('#%x%x%x%x%x%x','')..' na '..time..' sekund');

killPed(player);
end);

addCommandHandler('unbw', function(player, cmd, target)
if not getElementData(player, 'user:admin') then return end
if not target then noti:alert(player, 'info', 'U?yj: /unbw [nazwa/id]') return end
local target = exports['mm-core']:findPlayer(player, target);
if not target then noti:alert(player, 'error', 'Nie znaleziono podanego gracza.') return end
if not isPedDead(target) then noti:alert(player, 'error', 'Ten gracz nie posiada BW.') return end
bw.destroy(target);
noti:alert(target, 'info', 'BW zosta?o tobie zdj?te przez '..getPlayerName(player):gsub('#%x%x%x%x%x%x',''));
noti:alert(player, 'info', 'Zdje?e?/a? BW graczu '..getPlayerName(target):gsub('#%x%x%x%x%x%x',''));
end);


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-27, 16:07


TheSebaPL

Mod-team






Wiek: 21
Na forum: 3098 dni
Posty: 964

Piwa: 3102

Respekt: 640,5
Respekt: 640,5Respekt: 640,5

StifMaster, skoro masz tutaj wczytywanie pozycji itd to jak mo?e ci? teleportowa? gdzie indziej ?
    spawnPlayer(clientVector3(getElementPosition(client)), 0getElementModel(client), getElementInterior(client), getElementDimension(client));


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-27, 16:28


StifMaster







Wiek: 30
Na forum: 3525 dni
Posty: 57
Nick w MP: Sztefi

Piwa: 5

Respekt: 50

TheSebaPL, Sam nie wiem, dlatego szukam pomocy :/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-27, 17:02


VVirmex

Sgrypter luja






Wiek: 21
Na forum: 3365 dni
Posty: 281
Nick w MP: AxyZ

Piwa: 234

Respekt: 110
Respekt: 110


spawnPlayer(clientxyz00); -- na miejsce xyz wpisz koordynaty szpitala.


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-27, 17:15


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Przy evencie onClientPlayerWasted wstaw.

local pos=Vector3(getElementPosition(localPlayer))


By zapisac do zmiennej "pos" vector pozycji


Bo respieniu wstaw


setElementPosition(localPlayer,pos.x,pos.y,pos.z)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-27, 22:32


Karolowatyy







Wiek: 25
Na forum: 3286 dni
Posty: 117
Nick w MP: Ripley

Piwa: 826

Respekt: 90

Ostrzeżeń: 20%
"Shuffle" napisał/a:

Przy evencie onClientPlayerWasted wstaw.

local pos=Vector3(getElementPosition(localPlayer))


By zapisac do zmiennej "pos" vector pozycji


Bo respieniu wstaw


setElementPosition(localPlayer,pos.x,pos.y,pos.z)


Po co robi? tak

local pos=Vector3(getElementPosition(localPlayer))


Skoro mo?na zrobi? r?wnie? tak

local pos= {getElementPosition(localPlayer)}


Postaw piwo autorowi tego posta
 

 
Tagi: system
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku