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 CreatureScript Here -> http://otland.net/f82/advanced-player-points-system-reset-system-36134/#post364937
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 talkactions and add this:
Add this to talkactions.xml
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 CreatureScript Here -> http://otland.net/f82/advanced-player-points-system-reset-system-36134/#post364937
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';
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, levelLimit, 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)
}
if getPlayerLevel(cid) >= levelLimit then
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 .. ";")
else
return LUA_ERROR
end
end
Later, create a file in talkactions and add this:
Lua:
function onSay(cid, words, param, channel)
local t = string.explode(param, ",")
local params =
{
player =
{
["health"] = {set = setCreatureMaxHealth, get = getCreatureMaxHealth},
["mana"] = {set = setCreatureMaxMana, get = getCreatureMaxMana}
},
item =
{
["weaponattack"] = {set = setItemExtraAttack, get = getItemExtraAttack, msg = "attack"},
["weapondefense"] = {set = setItemExtraDefense, get = getItemExtraDefense, msg = "defense"}
}
}
if(words == "!getpoints") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have " .. getPlayerPoints(cid).. " points.")
return TRUE
end
if(words == "!addpoints") then
if(params.player[t[1]]) then
local m = tonumber(t[2])
if(not m) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "No point specified.")
return TRUE
end
if(getPlayerPoints(cid) < m) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have enought points.")
return TRUE
end
m = math.abs(m)
doPlayerRemovePoints(cid, m)
params.player[t[1]].set(cid, params.player[t[1]].get(cid) + (m * 2))
return TRUE
elseif(params.item[t[1]]) then
local m = tonumber(t[2])
if(not m) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "No point specified.")
return TRUE
end
if(getPlayerPoints(cid) < m) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have enought points.")
return TRUE
end
local weapon = getPlayerWeapon(cid, TRUE)
local extraLimit = 15
if(weapon.itemid == 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not any weapon equiped.")
return TRUE
end
local weaponAttribute = params.item[t[1]].get(weapon.uid)
if (m > extraLimit) or ((weaponAttribute + m) > extraLimit) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You only can add " .. extraLimit .. " extra " .. params.item[t[1]].msg .. " points to your weapon.")
return TRUE
end
if(weaponAttribute >= extraLimit) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot add more extra " .. params.item[t[1]].msg .. " to this weapon.")
return TRUE
end
m = math.abs(m)
doPlayerRemovePoints(cid, m)
params.item[t[1]].set(weapon.uid, weaponAttribute + m)
return TRUE
else
return TRUE
end
end
end
Add this to talkactions.xml
Lua:
<talkaction log="yes" words="!getpoints" event="script" value="points.lua" />
<talkaction log="yes" words="!addpoints" event="script" value="points.lua" />
Lua:
local extraLimit = 15 --Limit of extra attack-defense that can have the weapon
- 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: