Renusek
beton beton beton punk!
Hm. Slawkens, something is wrong with my script, I added one weapon:
And error in log:
I did something wrong? .
Code:
--[[
** Monster weapon upgrader by slawkens **
kills - how much monsters must be killed
extraAttack - how much extraAttack points will this weapon get
extraAttackLimit - you can set limit of extraAttack points added
]]--
local monsters = {
["rat"] = {
[2395] = {
kills = 30,
extraAttack = 1,
extraAttackLimit = 3,
storage = 34001
}
[2399] = {
kills = 2,
extraAttack = 1,
extraAttackLimit = 5,
storage = 34002
}
},
["dragon"] = {
[2383] = {
kills = 500,
extraAttack = 1,
extraAttackLimit = 20,
storage = 34003
}
}
}
function onKill(cid, target)
if(isPlayer(target) == TRUE) then
return TRUE
end
local monster = monsters[string.lower(getCreatureName(target))]
if(not monster) then
return TRUE
end
local playerWeapon = getPlayerWeapon(cid, TRUE)
if(playerWeapon.itemid == 0) then
return TRUE
end
local weapon = monster[playerWeapon.itemid]
if(not weapon) then
return TRUE
ebd
local killedMonsters = getPlayerStorageValue(cid, weapon.storage)
if(killedMonsters == -1) then
killedMonsters = 1
end
local currentExtraAttack = getItemExtraAttack(playerWeapon.uid)
if(killedMonsters % weapon.kills == 0 and currentExtraAttack < weapon.extraAttackLimit) then
setItemExtraAttack(playerWeapon.uid, currentExtraAttack + weapon.extraAttack)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Congratulations! Your weapon received +" .. weapon.extraAttack .. " attack points and now have total extra damage of +" .. getItemExtraAttack(playerWeapon.uid) .. " points!")
end
setPlayerStorageValue(cid, weapon.storage, killedMonsters + 1)
return TRUE
end
And error in log:
Code:
[08/06/2009 18:20:06] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/monster_weapon_upgrade.lua)
[08/06/2009 18:20:06] data/creaturescripts/scripts/monster_weapon_upgrade.lua:17: '}' expected (to close '{' at line 10) near '['
[08/06/2009 18:20:06] Reloaded creature events.
I did something wrong? .