R?wnie? spr?bowa?em, nadal w to samo miejscu, po usuni?ciu tak?e spr?bowa?em tej linijki co mi da?e? wilq, w sensie zmienieniu jej i usuni?ciu bo itak nie dzia?a?u (teraz ju? wkei?em spowrotem j?), te? nadal nie dzia?a?o i tepa?o
Tak, zrestartowa?em. I teraz zaczynam dalej szuka? tak jak radzisz.
Krzemo, zrobi?em, zastopowa?em skrypt i po wy??czeniu i potem zgini?ciu kamera si? oddala a ja sie nie respie, wi?c nie dzia?a ;/
addEvent("core:spawnPlayer", true)
addEventHandler("core:spawnPlayer", root, function()
local pos=getElementData(source,"player:spawn")
if not pos then return end
fadeCamera(source, true)
spawnPlayer(source, pos[1], pos[2], pos[3])
setCameraTarget(source,source)
toggleControl(source,"fire", false)
toggleControl(source,"aim_weapon", false)
local load=loadPlayerData(source)
if load then outputChatBox("* Pomy?lnie wczytano Twoje dane, ?yczymy mi?ej gry.",source) end
setElementData(source,'HS_accountName',getPlayerName(source));
setElementData(source,"player:online",0)
if getElementData(source,"player:premium") then
local queryA=string.format("SELECT * FROM pystories_users WHERE id=%d AND premiumdate>NOW() LIMIT 1", getElementData(source,"player:sid"))
local resultA=exports["DB2"]:pobierzWyniki(queryA)
if (resultA) then
outputChatBox("* Twoje konto premium, wa?ne do " ..resultA["premiumdate"], source)
end
end
triggerClientEvent(source,"core:blipyaut",root,source)
end)
Nie, logowanie nie ma tutaj nic do tego.
Musi to by? event onPlayerWasted oraz funkcja w nim spawnPlayer, wy?lij wszystko co zawiera te 2 wy?ej wymienione elementy.
addEventHandler("onPlayerWasted", root, function()
plr=source
if getElementData(plr,"player:job") then
triggerClientEvent(plr,"onFinish", root, plr)
setElementData(plr,"player:job", false)
end
setTimer(function()
fadeCamera(plr, true)
setElementInterior(plr,0)
setElementDimension(plr,0)
setCameraTarget(plr, plr)
setElementModel(plr, getElementData(plr, "player:skin"))
end, 60, 1)
end)
2.
addEvent("core:spawnPlayer", true)
addEventHandler("core:spawnPlayer", root, function()
local pos=getElementData(source,"player:spawn")
if not pos then return end
fadeCamera(source, true)
spawnPlayer(source, pos[1], pos[2], pos[3])
setCameraTarget(source,source)
toggleControl(source,"fire", false)
toggleControl(source,"aim_weapon", false)
local load=loadPlayerData(source)
if load then outputChatBox("* Pomy?lnie wczytano Twoje dane, ?yczymy mi?ej gry.",source) end
setElementData(source,'HS_accountName',getPlayerName(source));
setElementData(source,"player:online",0)
if getElementData(source,"player:premium") then
local queryA=string.format("SELECT * FROM pystories_users WHERE id=%d AND premiumdate>NOW() LIMIT 1", getElementData(source,"player:sid"))
local resultA=exports["DB2"]:pobierzWyniki(queryA)
if (resultA) then
outputChatBox("* Twoje konto premium, wa?ne do " ..resultA["premiumdate"], source)
end
end
triggerClientEvent(source,"core:blipyaut",root,source)
end)
3.
setTimer(function()
for i,v in ipairs(getElementsByType("player")) do
if not getElementData(v,"player:spawn") then return end
if isPedDead(v) then
local pos=getElementData(v,"player:spawn")
fadeCamera(v, true)
setElementInterior(v,0)
setElementDimension(v,0)
spawnPlayer(v, pos[1], pos[2], pos[3])
setCameraTarget(v, plr)
setElementModel(v, getElementData(plr, "player:skin"))
end
if( getPlayerIdleTime(v) > 1 ) then
setElementData(v, "player:afk", true)
elseif ( getPlayerIdleTime(v) < 1 ) then
setElementData(v, "player:afk", false)
end
end
end, 10000, 0)
4.
addEvent("core:spawnPlayer", true)
addEventHandler("core:spawnPlayer", root, function()
local pos=getElementData(source,"player:spawn")
if not pos then return end
fadeCamera(source, true)
spawnPlayer(source, pos[1], pos[2], pos[3])
setCameraTarget(source,source)
toggleControl(source,"fire", false)
toggleControl(source,"aim_weapon", false)
local load=loadPlayerData(source)
if load then outputChatBox("* Pomy?lnie wczytano Twoje dane, ?yczymy mi?ej gry.",source) end
setElementData(source,'HS_accountName',getPlayerName(source));
setElementData(source,"player:online",0)
if getElementData(source,"player:premium") then
local queryA=string.format("SELECT * FROM pystories_users WHERE id=%d AND premiumdate>NOW() LIMIT 1", getElementData(source,"player:sid"))
local resultA=exports["DB2"]:pobierzWyniki(queryA)
if (resultA) then
outputChatBox("* Twoje konto premium, wa?ne do " ..resultA["premiumdate"], source)
end
end
triggerClientEvent(source,"core:blipyaut",root,source)
end)
5.
setTimer(function()
for i,v in ipairs(getElementsByType("player")) do
if not getElementData(v,"player:spawn") then return end
if isPedDead(v) then
local pos=getElementData(v,"player:spawn")
fadeCamera(v, true)
setElementInterior(v,0)
setElementDimension(v,0)
spawnPlayer(v, pos[1], pos[2], pos[3])
setCameraTarget(v, plr)
setElementModel(v, getElementData(plr, "player:skin"))
end
if( getPlayerIdleTime(v) > 1 ) then
setElementData(v, "player:afk", true)
elseif ( getPlayerIdleTime(v) < 1 ) then
setElementData(v, "player:afk", false)
end
end
end, 10000, 0)
Wszystko co znalaz?em pod tymi nazwami co poda?e? w pystories-core
setTimer(function()
for i,v in ipairs(getElementsByType("player")) do
if not getElementData(v,"player:spawn") then return end
if isPedDead(v) then
local pos=getElementData(v,"player:spawn")
fadeCamera(v, true)
setElementInterior(v,0)
setElementDimension(v,0)
if getElementData(v, "faction") == "SAPD" then
spawnPlayer(v, 2711.45, 2369.87, 6.73)
else
spawnPlayer(v, 2553.36, 2376.77, 7.91)
end
setCameraTarget(v, plr)
setElementModel(v, getElementData(plr, "player:skin"))
end
if( getPlayerIdleTime(v) > 1 ) then
setElementData(v, "player:afk", true)
elseif ( getPlayerIdleTime(v) < 1 ) then
setElementData(v, "player:afk", false)
end
end
end, 10000, 0)
i upewnij si?, ?e masz poni?szy kod w jakim? skrypcie:
addEventHandler("onPlayerWasted", getRootElement(), function()
if getElementData(source, "faction") == "SAPD" then
spawnPlayer(source, 2711.45, 2369.87, 6.73)
else
spawnPlayer(source, 2553.36, 2376.77, 7.91)
end
end)
Dzia?a, lecz spawnuje tylko w kordach gracza tam gdzie ustawi?em, a jak zgin? jako sapd to respi tam gdzie gracza
[ Dodano: 2018-12-05, 23:05 ]
Edit: zmieni?em w kodzie
if getElementData(source, "faction") == "SAPD" then
na
if getElementData(source, "player:faction") == "SAPD" then
i dzia?a ! dzi?kuje i jeszcze mam pytanie, czy da?oby rade ?eby na np cuboid zrobic ze jak gracz np jest w lv i cuboid jakby jest zrobiony w lv to go respi w ustalone kordy w lv, a jak jest drugi cuboid na ls i gracz zginal w ls to go respi w ustalonych kordach w ls? Tak samo w sapd? Oczywi?cie piwko daje wam obu za pomoc!
Jasne, ?e mo?na. Ale lepiej b?dzie por?wnywa? koordynaty X Y z miejsca, gdzie zgin??.
Tak b?dzie ?atwiej i obejdzie si? bez zb?dnych cuboid?w ale oczywi?cie wyb?r nale?y do Ciebie.
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