Hello, here i'm releasing my newest script, Player Points System.
If you have played Mu-Online, then you know what i'm talking about. (This system works only with player max health, player max mana, weapon attack-defense)
These sytem contains a talk-action and creature-script. You can found the Talkaction Script Here -> http://otland.net/f81/advanced-player-points-system-reset-system-36131/#post364933
First of all, execute this with SQL if you have not done it yet.
Then, add this to data/lib/function.lua if you have not done it yet.
Later, create a file in creaturescripts and add this:
Enjoy
If you have played Mu-Online, then you know what i'm talking about. (This system works only with player max health, player max mana, weapon attack-defense)
These sytem contains a talk-action and creature-script. You can found the Talkaction Script Here -> http://otland.net/f81/advanced-player-points-system-reset-system-36131/#post364933
First of all, execute this with SQL if you have not done it yet.
Code:
ALTER TABLE `players` ADD `points` INT( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `players` ADD `resets` INT( 11 ) NOT NULL DEFAULT '0';
Then, add this to data/lib/function.lua if you have not done it yet.
Lua:
function getPlayerPoints(cid)
local Info = db.getResult("SELECT `points` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. " LIMIT 1")
local p = Info:getDataInt("points")
Info:free()
return p
end
function doPlayerAddPoints(cid, points)
local dif = getPlayerPoints(cid) + points
if dif >= 0 then
db.executeQuery("UPDATE `players` SET `points` = `points` + " .. points .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";")
return TRUE
end
return FALSE
end
function doPlayerRemovePoints(cid, points)
local dif = getPlayerPoints(cid) - points
if dif >= 0 then
db.executeQuery("UPDATE `players` SET `points` = `points` - " .. points .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";")
return TRUE
end
return FALSE
end
function resetPlayer(cid, newLevel, newExp, newMag, newCap, newHealth, newMaxHealth, newMana, newMaxMana, newSex, posX, posY, posZ)
local playerGUID = getPlayerGUID(cid)
local skill =
{
fist = getPlayerSkillLevel(cid, SKILL_FIST),
club = getPlayerSkillLevel(cid, SKILL_CLUB),
sword = getPlayerSkillLevel(cid, SKILL_SWORD),
axe = getPlayerSkillLevel(cid, SKILL_AXE),
distance = getPlayerSkillLevel(cid, SKILL_DISTANCE),
shielding = getPlayerSkillLevel(cid, SKILL_SHIELD),
fishing = getPlayerSkillLevel(cid, SKILL_FISHING)
}
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = " .. newLevel .. ", `health` = " .. newHealth .. ", `healthmax` = " .. newMaxHealth .. ", `experience` = " .. newExp .. ", `maglevel` = " .. newMag .. ", `mana` = " .. newMana .. ", `manamax` = " .. newMaxMana .. ", `posx` = " .. posX .. ", `posy` = " .. posY .. ", `posz` = " .. posZ .. ", `cap` = " .. newCap .. ", `sex` = " .. newSex .. ", `resets` = `resets` + 1 WHERE `id` = " .. playerGUID .. ";")
db.executeQuery("UPDATE `player_skills` SET `value` = " .. (skill.fist / 2) .. ", `count` = 0 WHERE `skillid` = 0 and `player_id` = " .. playerGUID .. ";")
db.executeQuery("UPDATE `player_skills` SET `value` = " .. (skill.club / 2) .. ", `count` = 0 WHERE `skillid` = 1 and `player_id` = " .. playerGUID .. ";")
db.executeQuery("UPDATE `player_skills` SET `value` = " .. (skill.sword / 2) .. ", `count` = 0 WHERE `skillid` = 2 and `player_id` = " .. playerGUID .. ";")
db.executeQuery("UPDATE `player_skills` SET `value` = " .. (skill.axe / 2) .. ", `count` = 0 WHERE `skillid` = 3 and `player_id` = " .. playerGUID .. ";")
db.executeQuery("UPDATE `player_skills` SET `value` = " .. (skill.distance / 2) .. ", `count` = 0 WHERE `skillid` = 4 and `player_id` = " .. playerGUID .. ";")
db.executeQuery("UPDATE `player_skills` SET `value` = " .. (skill.shielding / 2) .. ", `count` = 0 WHERE `skillid` = 5 and `player_id` = " .. playerGUID .. ";")
db.executeQuery("UPDATE `player_skills` SET `value` = " .. (skill.fishing / 2) .. ", `count` = 0 WHERE `skillid` = 6 and `player_id` = " .. playerGUID .. ";")
end
Later, create a file in creaturescripts and add this:
Lua:
local levelLimit = 400
local time = 30 --in seconds
function onAdvance(cid, skill, oldLevel, newLevel)
local pointsPerLevel = 5
local formula =
{
newMag = getPlayerMagLevel(cid) / 2,
newHealth = (getCreatureHealth(cid) / 6) + 200,
newMaxHealth = (getCreatureMaxHealth(cid) / 6) + 200,
newMana = (getCreatureMana(cid) / 6) + 200,
newMaxMana = (getCreatureMaxMana(cid) / 6) + 200
}
if(skill == SKILL__LEVEL) == TRUE then
if getPlayerLevel(cid) >= levelLimit then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your character will be reset in " .. time .. " seconds.")
addEvent(resetPlayer, (time * 1000), cid, 8, 4200, formula.newMag, 1000, formula.newHealth, formula.newMaxHealth, formula.newMana, formula.newMaxMana, getPlayerSex(cid), getTownTemplePosition(getPlayerTown(cid)).x, getTownTemplePosition(getPlayerTown(cid)).y, getTownTemplePosition(getPlayerTown(cid)).z)
doPlayerAddPoints(cid, (newLevel - oldLevel) * pointsPerLevel)
return TRUE
end
doPlayerAddPoints(cid, (newLevel - oldLevel) * pointsPerLevel)
return TRUE
end
end
Lua:
local levelLimit = 400 --level to be reseted.
local time = 30 --in seconds, after level 400, player will be disconected in 30 seconds to be reseted.
local pointsPerLevel = 5 --points that gain the player per level
local formula =
{
newMag = getPlayerMagLevel(cid) / 2, --formula to new magic level, example: Player have ml 80, then after reset will have ml 40.
newHealth = (getCreatureHealth(cid) / 6) + 200, --formula to new health
newMaxHealth = (getCreatureMaxHealth(cid) / 6) + 200, --formula to new maxHealth
newMana = (getCreatureMana(cid) / 6) + 200, --formula to new mana
newMaxMana = (getCreatureMaxMana(cid) / 6) + 200 --formula to new maxmana
}
- Info (Creature Script)
- When player get level limit (400), he is disconected and reseted.
- Player get level 8 again, teleported to him temple position
- Player get 50% of Magic level, more health and mana that a player without resets and level 8.
- For each level, player gain 5 points (You can edit it).
- Info (Talkaction)
- For each level, player gain 5 points (You can edit it).
[*]If you add points to your health, your max health will increasem, example: !addpoints health, 10 (10 points), then player get 20 health points more to her max health (The same thing with the mana).[*]If you add points to attack-defense, the extra attack-defense of the weapon that you have equiped will increase (The limit of extra attack-defense is +15)
Enjoy
Last edited: