• 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!

Lives System

Sportacus

Intermediate OT User
Joined
Aug 3, 2008
Messages
718
Reaction score
100
Just throwing this out there to see if anyone would like to make it.

A lives system.

A character starts with 1 life, with a maximum of 3 lives.

If a character dies, he loses 1 life, and if they reach 0 lives, their character is deleted.

The character name is locked, and can't be remade.

When a player logs in, it would tell them how many lives they have, and they'd be able to check their current lives by saying !lives

When a character is deleted like this, I want it to be saved in a log file stating what time they died at, what level, and which temple was their home (the temple value can just be the town number).

Example for the log would look like this

12/1/2012 12:43AM Sportacus Level: 50 Temple: 3



I'm guessing I'd either use sql entries, or a storage value for current levels, and another storage value for max lives.


And of course there would be items that would increase your current lifes, and your max lifes (just adding a +1 to the storage).
 
Tried to do it myself, obvioulsy I didn't try to add in logging part.. but here is what I wrote..

Lua:
local lives = 80000

function onDeath(cid, corpse, deathList)
	setPlayerStorageValue(cid, lives, getPlayerStorageValue(cid, lives) - 1)
		if getPlayerStorageValue(cid, lives) == 0 then
		  getCreatureName(cid) = name
			local players = db.getResult("SELECT * FROM `players` WHERE  `name` ")
			local name players:getDataString("name")
			db.executeQuery("UPDATE `players` SET `deleted` = '1' WHERE `players` ")
		end
	end


error on load is unexpected symbol near ' =' LINE 6
 
Tried to do it myself, obvioulsy I didn't try to add in logging part.. but here is what I wrote..

Lua:
local lives = 80000

function onDeath(cid, corpse, deathList)
	setPlayerStorageValue(cid, lives, getPlayerStorageValue(cid, lives) - 1)
		if getPlayerStorageValue(cid, lives) == 0 then
		  getCreatureName(cid) = name
			local players = db.getResult("SELECT * FROM `players` WHERE  `name` ")
			local name players:getDataString("name")
			db.executeQuery("UPDATE `players` SET `deleted` = '1' WHERE `players` ")
		end
	end


error on load is unexpected symbol near ' =' LINE 6

You defined lives in database as deleted ?
 
Ofc you get a error, its either:
Lua:
if getCreatureName(cid)
or
Lua:
local name = getCreatureName(cid)
 
Ofc you get a error, its either:
Lua:
if getCreatureName(cid)
or
Lua:
local name = getCreatureName(cid)

Blah, of course, just over looked it.

And @53701688, no, when a player gets to 0 lives, their character gets deleted. So I set them as deleted in the database

Wrong bloody account x.x
 
MM Try this...

Lua:
local lives = 80000
 
function onDeath(cid, corpse, deathList)
	setPlayerStorageValue(cid, lives, getPlayerStorageValue(cid, lives) - 1)
		if getPlayerStorageValue(cid, lives) == 0 then
		  local name = getCreatureName(cid)
			local players = db.getResult("SELECT * FROM `players` WHERE  `name` ")
			local name players:getDataString("name")
			db.executeQuery("UPDATE `players` SET `deleted` = '1' WHERE `players` ")
		end
	end

and if you want the name is locked try this...

Lua:
local lives = 80000
 
function onDeath(cid, corpse, deathList)
	setPlayerStorageValue(cid, lives, getPlayerStorageValue(cid, lives) - 1)
		if getPlayerStorageValue(cid, lives) == 0 then
		  local name = getCreatureName(cid)
			local players = db.getResult("SELECT * FROM `players` WHERE  `name` ")
			local name players:getDataString("name")
			db.executeQuery("UPDATE `players` SET `account_id` = '0' WHERE `players` ")
		end
	end

And the player is in the account 0, this account not exits... and the player exist, but nobody can choose this player blocked... and nobody can have the name of player deleted.

OR, I HAVE A IDEA...

Put this on death... if player have 0 lifes...
Lua:
function onDeath(cid, corpse, deathList)
	local live = 3
	live - 1
end

function onLogin(bla bla bla...)
	if live == 0
		bla bla bla
	end
end

or with SOURCE EDIT...

Lua:
m_confNumber[LIVE_HAVE] = getGlobalNumber("lives", 3);

and... on config.lua you put...
lives = x, placed on the x the number you want and... this is the script...
function onDeath(cid, corpse, deathList)
	getConfigInfo("lives") - 1
end

function onLogin(bla bla bla...)
	if getConfigInfo("lives") == 0
		bla bla bla
	end
end
No Tested...
 
Last edited:
Lua:
local lives = 80000

function onDeath(cid, corpse, deathList)
	setPlayerStorageValue(cid, lives, getPlayerStorageValue(cid, lives) - 1)
		if getPlayerStorageValue(cid, lives) == 0 then
				delplyr = getPlayerGUID(cid)
				db.executeQuery("UPDATE `players`SET`deleted`='1' WHERE`players`.`id`="..delplyr..";") 
			end
		end

Fixed it, just was being dumb before
 
Back
Top