function onKill(cid, target, damage, flags)
if isPlayer(target) then
if getCreatureStorage(cid, achievements['gladiator'].doneStorage) < 1 then
if getCreatureStorage(cid, achievements['gladiator'].storage)+1 < achievements['gladiator'].kills then
doCreatureSetStorage(cid, achievements['gladiator'].storage, math.max(getCreatureStorage(cid, achievements['gladiator'].storage),0)+1)
else
doCreatureSetStorage(cid, achievements['gladiator'].doneStorage, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You killed '..achievements['gladiator'].kills..' players and you obtain [gladiator] achievement.')
end
end
end
return true
end
['gladiator'] = {doneStorage = 1310700, storage = 1310800, kills = 200},
Lua:function onKill(cid, target, damage, flags) if isPlayer(target) then if getCreatureStorage(cid, achievements['gladiator'].doneStorage) < 1 then if getCreatureStorage(cid, achievements['gladiator'].storage)+1 < achievements['gladiator'].kills then doCreatureSetStorage(cid, achievements['gladiator'].storage, math.max(getCreatureStorage(cid, achievements['gladiator'].storage),0)+1) else doCreatureSetStorage(cid, achievements['gladiator'].doneStorage, 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You killed '..achievements['gladiator'].kills..' players and you obtain [gladiator] achievement.') end end end return true end
local wat, sthk = {
{["kills"] = 5, ["rewardID"] = 2160, ["rewardCount"] = 1},
{["kills"] = 5, ["rewardID"] = 2160, ["rewardCount"] = 5}
}, 29303
local storage = getPlayerStorageValue(cid, sthk)
function onKill(cid, target)
if storage < 1 then
setPlayerStorageValue(cid, sthk, 0)
end
setPlayerStorageValue(cid, sthk, storage + 1)
for wut = 1, #wat do
if storage == wat[wut].kills then
doPlayerAddItem(cid, wat[wut].rewardID, wat[wut].rewardCount)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have been rewarded for killing '.. storage ..' players.')
end
end
return true
end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local erexo, sthl, sfbp = {10,50,100}, 59349, 24321
local killValue = erexo[sthl] - getPlayerStorageValue(cid, 29303)
if(msgcontains(msg, 'mission')) then
if getPlayerStorageValue(cid, sfbp) < 1 then
for i = 1, #erexo do
if getPlayerStorageValue(cid, sthl) < 1 then
setPlayerStorageValue(cid, sthl, 1)
end
if getPlayerStorageValue(cid, sthl) == i then
setPlayerStorageValue(cid, sfbp, 1)
setPlayerStorageValue(cid, 29303, 0)
selfSay('Lets see, you want a mission? Oke, kill ' .. erexo[i] .. ' players for me', cid)
talkState[talkUser] = 0
return true
end
selfSay('I dont have more missions for you.', cid)
talkState[talkUser] = 0
end
else
selfSay('You did not complete my last mission? Go and kill ' .. killValue .. ' players more', cid)
talkState[talkUser] = 0
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
local wat, sthk = {
{["kills"] = 10, ["rewardID"] = 2160, ["rewardCount"] = 1},
{["kills"] = 50, ["rewardID"] = 2160, ["rewardCount"] = 5},
{["kills"] = 100, ["rewardID"] = 2160, ["rewardCount"] = 15}
}, 29303
local erexo, sthl, sfbp = {10,50,100}, 59349, 24321
local killValue = erexo[sthl] - getPlayerStorageValue(cid, sthk)
local storage = getPlayerStorageValue(cid, sthk)
function onKill(cid, target)
if getPlayerStorageValue(cid, sfbp) == 1 then
if storage < 1 then
setPlayerStorageValue(cid, sthk, 0)
end
setPlayerStorageValue(cid, sthk, storage + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have killed ' .. storage .. ' players, need [' .. killValue .. '] more.')
for wut = 1, #wat do
if storage == wat[wut].kills then
doPlayerAddItem(cid, wat[wut].rewardID, wat[wut].rewardCount)
setPlayerStorageValue(cid, sfbp)
setPlayerStorageValue(cid, sthk, 0)
setPlayerStorageValue(cid, sthl, getPlayerStorageValue(cid, sthl) + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have been rewarded for killing '.. storage ..' players.')
end
end
end
return true
end
You need to check if is player too fixed it so it checksLua:local wat, sthk = { {["kills"] = 10, ["rewardID"] = 2160, ["rewardCount"] = 1}, {["kills"] = 50, ["rewardID"] = 2160, ["rewardCount"] = 5}, {["kills"] = 100, ["rewardID"] = 2160, ["rewardCount"] = 15} }, 29303 local erexo, sthl, sfbp = {10,50,100}, 59349, 24321 local killValue = erexo[sthl] - getPlayerStorageValue(cid, sthk) local storage = getPlayerStorageValue(cid, sthk) function onKill(cid, target) if getPlayerStorageValue(cid, sfbp) == 1 and isPlayer(cid) == true then if storage < 1 then setPlayerStorageValue(cid, sthk, 0) end setPlayerStorageValue(cid, sthk, storage + 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have killed ' .. storage .. ' players, need [' .. killValue .. '] more.') for wut = 1, #wat do if storage == wat[wut].kills then doPlayerAddItem(cid, wat[wut].rewardID, wat[wut].rewardCount) setPlayerStorageValue(cid, sfbp) setPlayerStorageValue(cid, sthk, 0) setPlayerStorageValue(cid, sthl, getPlayerStorageValue(cid, sthl) + 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have been rewarded for killing '.. storage ..' players.') end end end return true end
You need to check if is player too fixed it so it checks
local wat, sthk = {
{["kills"] = 10, ["rewardID"] = 2160, ["rewardCount"] = 1},
{["kills"] = 50, ["rewardID"] = 2160, ["rewardCount"] = 5},
{["kills"] = 100, ["rewardID"] = 2160, ["rewardCount"] = 15}
}, 29303
local erexo, sthl, sfbp = {10,50,100}, 59349, 24321
function onKill(cid, target)
if isPlayer(target) and isPlayer(cid) then
if getPlayerStorageValue(cid, sfbp) == 1 then
if(getPlayerStorageValue(cid, sthk) < 1) then
setPlayerStorageValue(cid, sthk, 0)
end
setPlayerStorageValue(cid, sthk, getPlayerStorageValue(cid, sthk) + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have killed ' .. getPlayerStorageValue(cid, sthk) .. ' players.')
for wut = 1, #wat do
if getPlayerStorageValue(cid, sthk) == wat[wut].kills then
doPlayerAddItem(cid, wat[wut].rewardID, wat[wut].rewardCount)
setPlayerStorageValue(cid, sfbp)
setPlayerStorageValue(cid, sthk, 0)
setPlayerStorageValue(cid, sthl, getPlayerStorageValue(cid, sthl) + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have been rewarded for killing '.. getPlayerStorageValue(cid, sthk) ..' players.')
end
end
end
end
return true
end
bro how i can add more than 1 task i mean i want add 500 kills 100 kills and 1000 kills.NPC:
Lua:local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end function onThink() npcHandler:eek:nThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid local erexo, sthl, sfbp = {10,50,100}, 59349, 24321 local killValue = erexo[sthl] - getPlayerStorageValue(cid, 29303) if(msgcontains(msg, 'mission')) then if getPlayerStorageValue(cid, sfbp) < 1 then for i = 1, #erexo do if getPlayerStorageValue(cid, sthl) < 1 then setPlayerStorageValue(cid, sthl, 1) end if getPlayerStorageValue(cid, sthl) == i then setPlayerStorageValue(cid, sfbp, 1) setPlayerStorageValue(cid, 29303, 0) selfSay('Lets see, you want a mission? Oke, kill ' .. erexo[I] .. ' players for me', cid) talkState[talkUser] = 0 return true end selfSay('I dont have more missions for you.', cid) talkState[talkUser] = 0 end else selfSay('You did not complete my last mission? Go and kill ' .. killValue .. ' players more', cid) talkState[talkUser] = 0 end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
script:
Lua:local wat, sthk = { {["kills"] = 10, ["rewardID"] = 2160, ["rewardCount"] = 1}, {["kills"] = 50, ["rewardID"] = 2160, ["rewardCount"] = 5}, {["kills"] = 100, ["rewardID"] = 2160, ["rewardCount"] = 15} }, 29303 local erexo, sthl, sfbp = {10,50,100}, 59349, 24321 local killValue = erexo[sthl] - getPlayerStorageValue(cid, sthk) local storage = getPlayerStorageValue(cid, sthk) function onKill(cid, target) if getPlayerStorageValue(cid, sfbp) == 1 then if storage < 1 then setPlayerStorageValue(cid, sthk, 0) end setPlayerStorageValue(cid, sthk, storage + 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have killed ' .. storage .. ' players, need [' .. killValue .. '] more.') for wut = 1, #wat do if storage == wat[wut].kills then doPlayerAddItem(cid, wat[wut].rewardID, wat[wut].rewardCount) setPlayerStorageValue(cid, sfbp) setPlayerStorageValue(cid, sthk, 0) setPlayerStorageValue(cid, sthl, getPlayerStorageValue(cid, sthl) + 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have been rewarded for killing '.. storage ..' players.') end end end return true end
local erexo, sthl, sfbp = {10,50,100}, 59349, 24321
Frags amount, must be same as amount in script.
Not tested[/I]