Z tego co wiem jest to mo?liwe:
przy evencie addEventHandler("onPedDamage") dajesz cancelEvent() i ustawiasz timer na okre?lony czas.* Jestem na telefonie wi?c nie napisz? ci gotowego kodu ( reszte znajdziesz na wiki)
*Je?li si? myl? to niech kto? mnie poprawi ( Nie jestem profesjonalist? )
function ustaw(cmd, gracz)
if gracz then
if getPlayerFromName(gracz) then
local gracz = getPlayerFromName(gracz)
if getElementData(gracz, "saveGod") == false then
setElementData(gracz, "saveGod", true)
else
setElementData(gracz, "saveGod", false
end
end
end
end
addCommandHandler("god", ustaw)
I po stronie clienta.
function cancelDamage ()
if getElementData(getLocalPlayer(), "saveGod") == true then
cancelEvent()
end
end
addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), cancelDamage)
Sprawd? czy dzia?a, bo nie testowane i pisane na szyyyyyyyyyyyybko
Nie ma jednego nawiasu po stronie servera:
function ustaw(cmd, gracz)
if gracz then
if getPlayerFromName(gracz) then
local gracz = getPlayerFromName(gracz)
if getElementData(gracz, "saveGod") == false then
setElementData(gracz, "saveGod", true)
else
setElementData(gracz, "saveGod", false)
end
end
end
end
addCommandHandler("god", ustaw)
@edit:
Sprawd? czy dzia?a, bo nie testowane i pisane na szyyyyyyyyyyyybko
//Ziom11
Ostatnio zmieniony przez Riot 2013-10-19, 13:57, w całości zmieniany 2 razy
setElementData(source,"God", false)
function god(cmd, gracz)
if gracz then
local gracz = getPlayerFromName(gracz)
if (getElementData(gracz, "God") == false) then
setElementData(gracz, "God", true)
else
setElementData(gracz, "God", false)
end
end
end
addCommandHandler("god", god)
Client
function cancelDamage (thePlayer)
if (getElementData(thePlayer, "God") == true) then
cancelEvent()
end
end
addEventHandler ( "onClientPlayerDamage", getRootElement(), cancelDamage)
server.lua:5: Bad argument @ 'setElementData' [Expected element at argument 1, got boolean]
server.lua:6: Bad argument @ 'setElementData' [Expected element at argument 1, got boolean]
function god(cmd, cel)
if cel then
if getPlayerFromName(cel) then
local gracz = getPlayerFromName(cel)
if (getElementData(gracz, "God") == false) then
setElementData(gracz, "God", true)
outputChatBox("Wlaczono Goda",gracz,255,255,255)
else
outputChatBox("Error",gracz,255,255,255)
setElementData(gracz, "God", false)
end
end
end
end
addCommandHandler("god", god)
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