• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Need a doKillPlayer function.

Oneda

Aspiring Spriter
Joined
Dec 3, 2013
Messages
159
Solutions
2
Reaction score
104
Location
Brazil
Hey there, I need a function that makes the player die, simple as that. (Atleast I tho it was.)

Tried this:

Code:
function doKillPlayer(cid)
return doCreatureAddHealth(cid, -getCreatureMaxHealth(cid))
end

But nah, just got this error:

Code:
[20/4/2014 15:42:59] data/lib/050-function.lua:21: attempt to perform arithmetic on a boolean value
[20/4/2014 15:42:59] stack traceback:
[20/4/2014 15:42:59]    data/lib/050-function.lua:21: in function <data/lib/050-function.lua:20>

Distro: TFS0.4 REV 3777
 
cid - can be any player.

Code:
function doKillPlayer(cid)
    if isPlayer(cid) == true then
        return doCreatureAddHealth(cid, -getCreatureHealth(cid))
    end
    return false
end

If you still gets errors, there is an bug in your code where are you using that doKillPlayer. Try to debug it with this:
Code:
doCreatureSay(cid, target, 1)
doKillPlayer(target)

If your character says something, like a big number then you should change your distro. It even wasn't a beta. Released version of 0.4 is named TFS 1.0

@EDIT:
You can't use that code in creaturescripts as a onDeath if your code haven't return true inside the code. Becouse whenever player's health drops to 0 and a script is executed what returns sth other then true, then that player will stay stuck at 0 health.
 
Last edited:
cid - can be any player.
If your character says something, like a big number then you should change your distro. It even wasn't a beta. Released version of 0.4 is named TFS 1.0

wut? 0.4 has nothing to do with 1.0 and never did. 1.0 originated from 0.2, which was lead by Talaturen himself.
 
wut? 0.4 has nothing to do with 1.0 and never did. 1.0 originated from 0.2, which was lead by Talaturen himself.
Looks like I was confused by few ppl who talks like that in the past. Anyway, 0.4 isn't bug free. Everyone for who I made scripts - reported different issues, even with functions what wasn't changed from previous versions.

You have to say, @Oneda's function is correct. TFS is reporting: "attempt to perform arithmetic on a boolean value". I'd like to see the script where he is using it. Maybe there is a boolean value. What's causing errors.

@EDIT
Anyway good to know @EvulMastah
 
Yeah, I was trying to place it inside a spell, something like addEvent(doKillPlayer, 2500)

And it was just giving the error, but just changed my distro now, upgraded to Mystic Spirit 0.2.1.5 (9.6 one).
Hope it's better now, the 0.4 rev 3777 had several bugs in functions and shit like that, which would make my progress way slower and/or harder.

What about TFS 1.0? Is it even good? (tibia version 10... ones)
 
Yeah, I was trying to place it inside a spell, something like addEvent(doKillPlayer, 2500)

And it was just giving the error, but just changed my distro now, upgraded to Mystic Spirit 0.2.1.5 (9.6 one).
Hope it's better now, the 0.4 rev 3777 had several bugs in functions and shit like that, which would make my progress way slower and/or harder.

What about TFS 1.0? Is it even good? (tibia version 10... ones)
tfs 1.0 is the supreme thing!
 
Back
Top