LucasFerraz
Systems Analyst
-----------------------------------------------------------------------
Player receive reward for frags and skull when reach X kills(not frags)
Lua:
function onKill(cid, target, lastHit)
if cid ~= target and isPlayer(target) then
if getPlayerIp(cid) == getPlayerIp(target) then
doCreatureAddHealth(cid, -200)
doCreatureAddMana(cid, -200)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have been punished for killing a player of the same IP.')
else
doPlayerAddItem(cid, 2152, 1)
setPlayerStorageValue(cid, 6776, getCreatureStorage(cid, 6776) + 1)
end
end
if(getPlayerStorageValue(cid, 6776) == 5) and getCreatureStorage(cid, 6001) == -1 then
broadcastMessage(getCreatureName(cid) .. " is on killing spree! He killed 5 players!")
setPlayerStorageValue(cid, 6001, 1)
doCreatureSetSkullType(cid, 3) -- 3 is white
elseif(getPlayerStorageValue(cid, 6776) == 10) and getCreatureStorage(cid, 6002) == -1 then
broadcastMessage(getCreatureName(cid) .. " is dominating! He killed 10 players!")
setPlayerStorageValue(cid, 6002, 1)
doCreatureSetSkullType(cid, 4) -- 3 is red
elseif(getPlayerStorageValue(cid, 6776) == 25) and getCreatureStorage(cid, 6003) == -1 then
broadcastMessage(getCreatureName(cid) .. " is CRAZY! He killed 25 players!")
setPlayerStorageValue(cid, 6003, 1)
doCreatureSetSkullType(cid, 5) -- 5 is black
elseif(getPlayerStorageValue(cid, 6776) == 50) and getCreatureStorage(cid, 6004) == -1 then
broadcastMessage(getCreatureName(cid) .. " is UNSTOPPABLE!! He killed 50 players! DO SOMETHING!")
setPlayerStorageValue(cid, 6004, 1)
doPlayerAddItem(cid, 2640, 1) -- soft boots as reward for killing 50 players
elseif(getPlayerStorageValue(cid, 6776) == 100) and getCreatureStorage(cid, 6005) == -1 then
broadcastMessage("Bow down to your new god! " ..getCreatureName(cid).. " has 100 frags!")
setPlayerStorageValue(cid, 6005, 1)
doPlayerAddItem(cid, 8266, 1) -- kosheis amulet as reward for killing 100 players
elseif(getPlayerStorageValue(cid, 6776) == 150) and getCreatureStorage(cid, 6006) == -1 then
broadcastMessage(getCreatureName(cid) .. " is not a human! He killed 150 players!")
setPlayerStorageValue(cid, 6006, 1)
doPlayerAddItem(cid, 9932, 1) -- firewalker boots as reward for killing 150 players
return true
end
Player in guild receive 5% extra exp
By Summ
Lua:
function onLogin(cid)
local gid = getPlayerGuildId(cid)
if gid ~= 0 then
local ex = getPlayerRates(cid)[SKILL__LEVEL]
doPlayerSetRate(cid, SKILL__LEVEL, (ex+0.05))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You received 5% extra experience for being in a guild.")
end
return true
end
When player logout he loses his frags and get teleported to temple
Made by me and someone else helped me with db.executeQuery(If you helped me pm me)
Lua:
function onLogout(cid)
if getPlayerLevel(cid) < 150 then
doPlayerAddExperience(cid, (getExperienceForLevel(150) - getPlayerExperience(cid)))
db.executeQuery("UPDATE `killers` SET `unjustified` = 0 WHERE `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ")")
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
end
return true
end
Anti-MC/Magebomb
Bogart posted in forum
Lua:
local config = {
max = 1, -- max chars with the same ip
text = "Multi-Client is not allowed.", -- text on kick
group_id = 1 -- only kick player with group id 1 (normal players)
}
local accepted_ip_list = {} -- list of ip's then can use MC
local function antiMC(p)
if #getPlayersByIp(getPlayerIp(p.pid)) >= p.max then
doRemoveCreature(p.pid)
end
return TRUE
end
function onLogin(cid)
if getPlayerGroupId(cid) <= config.group_id then
if isInArray(accepted_ip_list,getPlayerIp(cid)) == FALSE then
addEvent(antiMC, 2000, {pid = cid, max = config.max+1})
doPlayerSendTextMessage(0, cid, 22, "Multi-Client is not allowed.")
end
end
return TRUE
end
Frags on look
When I found this script it contains "--Script By Theax"
Lua:
--Script By Theax ""
function getPlayerFrags(cid)
local time = os.time()
local times = {today = (time - 86400), week = (time - (7 * 86400))}
local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
if(result:getID() ~= -1) then
repeat
local content = {date = result:getDataInt("date")}
if(content.date > times.today) then
table.insert(contents.day, content)
elseif(content.date > times.week) then
table.insert(contents.week, content)
else
table.insert(contents.month, content)
end
until not result:next()
result:free()
end
local size = {
day = table.maxn(contents.day),
week = table.maxn(contents.week),
month = table.maxn(contents.month)
}
return size.day + size.week + size.month
end
function onLogin(cid)
registerCreatureEvent(cid, "fraglook")
return true
end
function onLook(cid, thing, position, lookDistance)
if isPlayer(thing.uid) and thing.uid ~= cid then
doPlayerSetSpecialDescription(thing.uid,' [Frags: '..getPlayerFrags(thing.uid)..']')
return true
elseif thing.uid == cid then
doPlayerSetSpecialDescription(cid,' [Frags: '..getPlayerFrags(cid)..']')
local string = 'You see yourself.'
if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
string = string..' You are '.. getPlayerGroupName(cid) ..'.'
elseif getPlayerVocation(cid) ~= 0 then
string = string..' You are '.. getPlayerVocationName(cid) ..'.'
else
string = string..' You have no vocation.'
end
string = string..getPlayerSpecialDescription(cid)..''
if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then
string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.'
end
if getPlayerGuildId(cid) > 0 then
string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid)
string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.'
end
if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then
string = string..'nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].'
string = string..'nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.'
end
if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then
string = string..'nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].'
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)
return false
end
return true
end
Reward for killing player, no reward to same iP
Found this script here
Lua:
function onKill(cid, target, lastHit)
if cid ~= target and isPlayer(target) then
if getPlayerIp(cid) == getPlayerIp(target) then
doCreatureAddHealth(cid, -200)
doCreatureAddMana(cid, -200)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have been punished for killing a player of the same IP.')
else
doPlayerAddItem(cid, 2152, 1)
setPlayerStorageValue(cid, 6776, getCreatureStorage(cid, 6776) + 1)
end
end
return true
end
Players receive bless onlogin
I made this, I think, don't remember.
Lua:
function onLogin(cid)
if isPlayer(cid) then
doPlayerAddBlessing(cid, 1)
doPlayerAddBlessing(cid, 2)
doPlayerAddBlessing(cid, 3)
doPlayerAddBlessing(cid, 4)
doPlayerAddBlessing(cid, 5)
end
return true
end
If player is vip and less than level 150 he receive level 160 onlogin. If player without vip login less than level 150 he receive 150 (Vip system by mock)
Found this here
Lua:
function onLogin(cid)
local setPlayerLevelOnLogin = 150
local setPlayerLevelOnLoginVIP = 160
if(getPlayerLevel(cid) < 150) and vip.getVip(cid) >= 1 then
doPlayerAddExperience(cid, (getExperienceForLevel(setPlayerLevelOnLoginVIP) - getPlayerExperience(cid)))
doPlayerSendTextMessage(0, cid, 22, "Go kill someone!")
else
doPlayerAddExperience(cid, (getExperienceForLevel(setPlayerLevelOnLogin) - getPlayerExperience(cid)))
doPlayerSendTextMessage(0, cid, 22, "Go kill someone!")
end
return TRUE
end
Change Map
Found it in another forum
Lua:
local config, new = {
minTownId = 1,
maxTownId = 3
}, 0
function onThink(interval, lastExecution)
for _, pid in ipairs(getPlayersOnline()) do
local town = getPlayerTown(pid)
new = town < config.maxTownId and town + 1 or config.minTownId
doPlayerSetTown(pid, new)
doTeleportThing(pid, getTownTemplePosition(new))
doRemoveCondition(pid, CONDITION_INFIGHT)
doCreatureAddHealth(pid, getCreatureMaxHealth(pid))
doCreatureAddMana(pid, getCreatureMaxMana(pid))
end
db.executeQuery("UPDATE players SET town_id = ".. new ..", posx = 0, posy = 0, posz = 0;")
doBroadcastMessage("Map has been changed! Next map change will be in 25 minutes!", MESSAGE_STATUS_WARNING)
return true
end
You must add this scripts in creaturescripts.xml/login.lua/globalevents.xml
Last edited: