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

Request 1 Script

Sonnyxz

New Member
Joined
Jan 8, 2009
Messages
34
Reaction score
1
Location
Brasil
I would like a script, every time a player dies and you have your magic level above 100 he lost 10 magic level.
Example: a player has his magic level 105, when he dies his magic level will go back to 95.

Rp ++

Sorry for my english sucks, I'm using Google Translator :)~
 
Last edited:
I would like a script, every time a player dies and you have your magic level above 100 he lost 10 magic level.
Example: a player has his magic level 105, when he dies his magic level will go back to 95.

Rp ++

Sorry for my english sucks, I'm using Google Translator ~

Well you dont need a script to fix that i had same problem with that but my friend helped me so if you want help only pm me
 
Lua:
function onDeath(cid, corpse, deathList)
	for i = 1, #deathList do
		if isPlayer(deathList[i]) then
			doPlayerAddMagLevel(cid, getPlayerMagLevel(cid) - 10)
		end
	end
	
	return true
end
 
Lua:
function onDeath(cid, corpse, deathList)
	for i = 1, #deathList do
		if isPlayer(deathList[i]) then
			doPlayerAddMagLevel(cid, getPlayerMagLevel(cid) - 10)
		end
	end
	
	return true
end
you can't remove spent mana without using queries, and why are you looping through deathlist? that would remove 10 of victim's magic levels for each player in deathlist
 
you can't remove spent mana without using queries, and why are you looping through deathlist? that would remove 10 of victim's magic levels for each player in deathlist

Actually it's not quite what I want is the following players on my server has magic level above 150, when one of them dies i do not lose much magic level, so I wanted them to lose at least one level magic when he died

Lua:
function onDeath(cid, corpse, deathList)
	for i = 1, #deathList do
		if isPlayer(deathList[i]) then
			doPlayerAddMagLevel(cid, getPlayerMagLevel(cid) - 10)
		end
	end
	
	return true
end

this script did not work. = (
 
Last edited:
Actually it's not quite what I want is the following players on my server has magic level above 150, when one of them dies i do not lose much magic level, so I wanted them to lose at least one level magic when he died
never said it was
 
you can't remove spent mana without using queries, and why are you looping through deathlist? that would remove 10 of victim's magic levels for each player in deathlist

Because I obviously don't know how to script, right? Why do you criticize all of my posts? Just fix it if you know everything.

Your post didn't even attempt to help this person. It should be considered spam.
 
im just doing the right thing. and it's not just your posts, don't know why you feel like it.
if you consider it spam then all posts except for OP's bumps may be deleted aswell
 
maybe something like this?
Lua:
function onKill(cid, target, lastHit)
	if isPlayer(target) then
		if getPlayerMagicLevel(cid) >= 100 then 
			db.executeQuery("UPDATE `players` SET `magic level` = "..getPlayerMagLevel(getPlayerGUID(target))-10.." WHERE `id` = "..getPlayerGUID(target))
		end
	end
	return true
end
 
Last edited:
maybe something like this?
Lua:
function onKill(cid, target, lastHit)
	if isPlayer(target) then
		if getPlayerMagicLevel(cid) >= 100 then 
			db.executeQuery("UPDATE `players` SET `magic level` = "..getPlayerMagLevel(getPlayerGUID(target))-10.." WHERE `id` = "..getPlayerGUID(target))
		end
	end
	return true
end

did not work


[Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/ml.lua:4: malformed number near '10..'
[Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/ml.lua)
data/creaturescripts/scripts/ml.lua:4: malformed number near '10..'
 
no. it needs to be executed after the player is saved, or it's going to get overwritten by the save on death
 
PHP:
function mlv(pid)
	return db.executeQuery("UPDATE `players` SET `maglevel` = maglevel-10 WHERE `id` = "..pid..";")
end
function onKill(cid, target, lastHit)
	if isPlayer(target) then
		if getPlayerMagicLevel(cid) >= 100 then 
			addEvent(mlv, 100, getPlayerGUID(cid))
		end
	end
	return true
end

should work.
 
Back
Top