(facepalm), zapomnia?e? o argumencie gracza. Jak to powiedzia? kiedy? Piorun, 'Znajd? mi argument source do addCommandHandler'.
function god(player, cmd,cel)
if cel then
local gracz = getPlayerFromName(cel)
setElementData(gracz,'GOD', 0)
if ( getElementData(gracz, 'GOD') == 0 ) then
setElemenData(gracz, 'GOD', 1)
outputChatBox('Uruchomiono Goda dla gracza'..gracz..'.', player,255,255,255)
else
setElementData(gracz,'GOD', 0)
outputChatBox('Error',player,255,255,255)
end
end
end
addCommandHandler('god', god)
W kliencie te? dodaj cudzys??w do zera w getElementData czyli
if (getElementData(getLocalPlayer(),'GOD') == '1' ) then
function god(player, cmd,cel)
if cel then
local gracz = getPlayerFromName(cel)
setElementData(gracz,'GOD', '0')
if ( getElementData(gracz, 'GOD') == '0' ) then
setElemenData(gracz, 'GOD', '1')
outputChatBox('Uruchomiono Goda dla gracza'..gracz..'.', player,255,255,255)
else
setElementData(gracz,'GOD', '0')
outputChatBox('Error',player,255,255,255)
end
end
end
addCommandHandler('god', god)
if (getElementData(getLocalPlayer(),'godmode') == 'on' ) then
server:
function god(player, cmd,cel)
if cel then
local gracz = getPlayerFromName(cel)
setElementData(gracz,'godmode','off')
if ( getElementData(gracz, 'godmode') == 'off' ) then
setElemenData(gracz, 'godmode', 'on')
outputChatBox('Uruchomiono Goda dla gracza'..gracz..'.', player,255,255,255)
else
setElementData(gracz,'godmode', 'off')
outputChatBox('Error',player,255,255,255)
end
end
end
addCommandHandler('god', god)
[ Dodano: 2013-10-22, 19:26 ]
Mam te? inn? wersj? na konto przypisanie:
server:
function wlaczgoda(Player,cmd,cel)
if cel then
local gracz = getPlayerAccount(cel)
if (getAccountData(gracz,'god') == false) or (getAccountData(gracz,'god') == nil) then
setAccountData(gracz,'god', true)
outputChatBox('Wlaczono goda dla:' ..gracz,Player,255,255,255)
else
setAccountData(gracz,'god', false)
end
end
end
end
addCommandHandler('god',wlaczgoda)
function wylaczgoda(gracz)
if (getAccountData(getPlayerAccount(gracz),'god') == true) or (getAccountData(getPlayerAccount(gracz),'god') == nil ) then
setAccountData(getPlayerAccount(gracz),'god', false)
end
end
addEventHandler('onPlayerLogout',getRootElement(),wylaczgoda)
addEventHandler('onPlayerQuit',getRootElement(),wylaczgoda)
client:
function anulujdmg(gracz)
if (getAccountData(getPlayerAccount(gracz),'god') == true ) then
cancelEvent()
end
end
addEventHandler('onClientPlayerDamage',getRootElement(),anulujdmg)
ochrona = 0
Function spawnochrona()
if ochrona == 0 then
ochrona = 1
setTimer(
function()
if ochrona == 1 then
ochrona = 0
outputChatBox('Ochrona po spawnie wylaczona',source,255,255,255)
end
end,180000,1)
end
end
addEventHandler('onClientPlayerSpawn',getRootElement(),spawnochrona)
function dmg()
if ochrona == 1 then
cancelEvent()
end
end
addEventHandler('onClientPlayerDamage',getRootElement(),dmg)
Podpis
Multi Drive Unlimited:Nowy projekt już wkrótce
Ostatnio zmieniony przez krydianero 2013-10-22, 20:22, w całości zmieniany 1 raz
function ustawGod(player, cmd, graczName)
if graczName then
local gracz = getPlayerFromName(graczName)
if gracz then
if (getElementData(gracz, "GodWlaczony")==true) then
outputChatBox("Gracz posiada ju? w??czonego goda.", player)
else
setElementData(gracz, "GodWlaczony", true)
outputChatBox("Ustawi?e? graczowi " .. graczName .. " goda.", player)
end
else
outputChatBox("Nie ma gracza o takim nicku na serwerze.", player)
end
else
outputChatBox("Przyk?ad: /god [gracz]", player)
end
end
addCommandHandler("god", ustawGod)
Client:
function cancelDamage()
if (source==getLocalPlayer()) then
jestGod = getElementData(getLocalPlayer(), "GodWlaczony")
if jestGod then
cancelEvent()
end
end
end
addEventHandler("onClientPlayerDamage", cancelDamage)
Przetestuj, zrobi?em to teraz na szybko, mo?e zadzia?a.
function cancelDamage()
if (source==getLocalPlayer()) then
jestGod = getElementData(getLocalPlayer(), "GodWlaczony")
if jestGod then
cancelEvent()
end
end
end
addEventHandler("onClientPlayerDamage", root, cancelDamage)
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