Olá,
Hoje vou esta ensinado como Adicionar o Sistema de Coma.
Vamos Começar !
(Faça Backup - Nao serei responsável por qualquer modificação mal feita.)
Primeiramente Abrimos o Login.lua.
Procuramos por:
triggerClientEvent(player, "onClientPlayerDayZLogin", player)
Você Vai Ver Isso:
Abaixo Adicione:
triggerEvent("putPlayerInComaServer", player)
Ficando Assim:
Agora Salvamos, e Vamos Abrir o SurvivorSystem.lua.
No Final do Arquivo Adicionamos:
- -- em coma:
- local dyingPlayers = {}
- putPlayerInComaServer = function ()
- if getElementData ( source, "blood" ) <= 2000 and getElementData ( source, "blood" ) > 0then
- setPedAnimation ( source, "BEACH", "Lay_Bac_Loop",-1,true,false,false)
- toggleAllControls ( source, false, true, false)
- toggleControl ( source, "jump", false)
- setElementData ( source, "inComa", true)
- table.insert ( dyingPlayers, source)
- setTimer ( function( player )
- dyingPlayers[tostring(player)] = false
- if isElement( player ) then
- if getElementData ( player, "inComa") then
- setElementData ( player, "isDead", true)
- toggleAllControls ( player, true)
- triggerEvent ( "kilLDayZPlayer", player)
- end
- end
- end, 120000, 1, source)
- end
- end
- addEvent("putPlayerInComa", true)
- addEventHandler("putPlayerInComa", getRootElement(), putPlayerInComaServer)
-
- function useAdrenalin ( player )
- local x,y,z = getElementPosition ( player )
- local found = 0
- for i, v in ipairs ( dyingPlayers ) do
- if isElement ( v ) then
- if getElementData ( v, "inComa" ) then
- local x2, y2, z2 = getElementPosition ( v )
- if getDistanceBetweenPoints3D ( x,y,z, x2, y2, z2 ) < 3 then
- found = 1
- toggleAllControls (v, true )
- if getElementData(v, "brokenbone") then
- toggleControl (v, "jump", false)
- end
- setElementData (v, "inComa", false)
- setPedAnimation (v, false)
- toggleAllControls (v, false, false, false)
- table.remove ( dyingPlayers, i)
- break
- end
- else
- dyingPlayers[i] = nil
- end
- else
- dyingPlayers[i] = nil
- end
- end
- if found == 1 then
- setElementData ( player,"Painkiller",getElementData(player,"Painkiller") -1)
- end
- end
Salvamos.
Agora Vamos Em SurvivorSystem_client.lua.
Procuramos por:
function playerGetDamageDayZ ( attacker, weapon, bodypart, loss )
E Agora procuramos por:
if number == 3 then
setElementData(getLocalPlayer(),"pain",true)
end
E Adicionamos logo Abaixo:
Ficando Assim:
Procuramos por:
function checkStats()
Subsistimos toda essa função por:
(ou Copie e Cole Abaixo toda essa função e desative a outra com
--[[ e --]] )
- function checkStats()
- if getElementData(getLocalPlayer(),"logedin") then
- if getElementData(getLocalPlayer(),"bleeding") > 20 then
- setElementData(getLocalPlayer(),"blood",getElementData(getLocalPlayer(),"blood")-getElementData(getLocalPlayer(),"bleeding"))
- else
- setElementData(getLocalPlayer(),"bleeding",0)
- end
- if getElementData(getLocalPlayer(), "blood") < 0 and notgetElementData(getLocalPlayer(), "isDead") then
- triggerServerEvent("kilLDayZPlayer", getLocalPlayer(), false, false)
- toggleAllControls ( true )
- setElementData ( localPlayer, "inComa", false )
- end
- end
- end
- setTimer(checkStats,3000,0)
Ficando Assim:
Salve e Pronto, foi adicionado o sistema de coma.
Teste seu server antes de colocar ele online com os players.
Criador do Sistema:
italo - MTAz
Tutorial Feito por:
O sistema pode ter bugs , então Teste antes de colocar no seu server com players !!
Nenhum comentário :
Postar um comentário