• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

zombie event

maper1

New Member
Joined
Aug 17, 2012
Messages
38
Reaction score
0
Hello, I'm using this system GlobalEvent - [TFS 1.2] Zombie Arena (https://otland.net/threads/tfs-1-2-zombie-arena.258250/)

tfs 1.3 revscript

but the player dies for the zombie (loses loot) and the event does not end, there is no error on the console


Lua:
local ZombieArenaKill = CreatureEvent("ZombieArenaKill")

-- When player dies in Zombie Arena
function ZombieArenaKill.onDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)

    -- Has the event started?
    if not zombieArena:isStarted() then
        return false
    end

    -- Did a player die?
    if player:isPlayer() then
       
        -- Is the player doing the event?
        if not zombieArena:isPlayerOnEvent(player) then
            return false
        end

        zombieArena:removePlayer(player)
        zombieArena:debug(player:getName() .. " got teleported to " .. player:getTown():getName() .. ".")

        zombieArena:checkArena()
    end
    return true
end

ZombieArenaKill:register()


Please help me
 

Snavy

Bakasta
Senator
Joined
Apr 1, 2012
Messages
1,244
Solutions
71
Reaction score
556
Location
Hell
This will not prevent players from dying in the event.
You should use onPrepareDeath instead of onDeath and return false if the player is in the event.
 
OP
OP
M

maper1

New Member
Joined
Aug 17, 2012
Messages
38
Reaction score
0
This will not prevent players from dying in the event.
You should use onPrepareDeath instead of onDeath and return false if the player is in the event.

if the player is at the event add that

function zombiearenakill.onPrepareDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
if player:isPlayerInEvent(player) then
return false
end
?

 

Snavy

Bakasta
Senator
Joined
Apr 1, 2012
Messages
1,244
Solutions
71
Reaction score
556
Location
Hell
if the player is at the event add that

function zombiearenakill.onPrepareDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
if player:isPlayerInEvent(player) then
return false
end
?


change Step 2 : GlobalEvent - [TFS 1.2] Zombie Arena (https://otland.net/threads/tfs-1-2-zombie-arena.258250/)

To this:
XML:
<event type="preparedeath" name="ZombieArenaDeath" script="zombie_arena/death.lua" />

Lua:
-- When player dies in Zombie Arena
function onPrepareDeath(player, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
    if zombieArena:isStarted() and zombieArena:isPlayerOnEvent(player) then
        zombieArena:removePlayer(player)
        zombieArena:debug(player:getName() .. " got teleported to " .. player:getTown():getName() .. ".")
        zombieArena:checkArena()
        return false
    end
    return true
end
 
OP
OP
M

maper1

New Member
Joined
Aug 17, 2012
Messages
38
Reaction score
0
thanks for the attention more i think that creturescript is not working, i'm going to revscript but i think i'm doing it wrong ... thanks
 
Top