Lopaskurwa
Well-Known Member
- Joined
- Oct 6, 2017
- Messages
- 914
- Solutions
- 2
- Reaction score
- 50
I'm not sure how to make weapon like this. Maybe there is some attribute which i dont know 

It's not nosense. Its a pretty close code.Who told u that i'm starting project where did i mentioned it? I'm just editing tfs for fun without any desires to start project. Or i'm not allowed to make something that i like?
You gave not enough information how to make .lua so with your explanation it should look like this not sure but still its something, didn't tried because it looks like big nonsense
Code:function onEquip(cid, item, slot) local slots = getPlayerSlotItem(cid, slot) if slots.itemid ~= item.itemid then if isInArray(items, slots.itemid) then player:setAttackSpeed end return true end function onDeEquip(cid, item, slot) local slots = getPlayerSlotItem(cid, slot) if next(slots) then if isInArray(items, slots.itemid) then player:setAttackSpeed end end return true end
function onEquip(cid, item, slot)
var player = Player(cid)
player:setAttackSpeed(player:getVocation():getAttackSpeed() - <Value to decrease>)
return true
end
function onDeEquip(cid, item, slot)
var player = Player(cid)
player:setAttackSpeed(player:getVocation():getAttackSpeed())
return true
end
local modifier = 100 -- 100 ms attack speed increase
function onEquip(player, item, slot)
local slotItem = player:getSlotItem(slot)
-- workaround for a bug in tfs, onEquip gets executed twice
if slotItem and slotItem.itemid == item.itemid then
return true
end
player:setAttackSpeed(player:getAttackSpeed() - modifier)
return true
end
function onDeEquip(player, item, slot)
player:setAttackSpeed(player:getAttackSpeed() + modifier)
return true
end
It's not nosense. Its a pretty close code.
LUA:function onEquip(cid, item, slot) var player = Player(cid) player:setAttackSpeed(player:getVocation():getAttackSpeed() - <Value to decrease>) return true end function onDeEquip(cid, item, slot) var player = Player(cid) player:setAttackSpeed(player:getVocation():getAttackSpeed()) return true end
And about project, even if its for fun, its a project.
It gives error in console something about player:setAttackSpeed. But probably there is way easer way to skill attack speed, without making lua scrip. So i was looking around other solution and i noticed that items.xml has <attribute key="weaponType" value="club" /> so which is attack speed so if i make item with club attribute it will skill my club (attack speed) so in this situation everything is perfect how i wanted, but there is problem about slot type. So where in source i can change slot type of club weapon. So if i manage to change slot type we can close this thread and everyone will be happyseems like you're having a hard time grasping what to do and how to use lua, you should read this Programming in Lua (first edition)
your code should look like this
LUA:local modifier = 100 -- 100 ms attack speed increase function onEquip(player, item, slot) local slotItem = player:getSlotItem(slot) -- workaround for a bug in tfs, onEquip gets executed twice if slotItem and slotItem.itemid == item.itemid then return true end player:setAttackSpeed(player:getAttackSpeed() - modifier) return true end function onDeEquip(player, item, slot) player:setAttackSpeed(player:getAttackSpeed() + modifier) return true end
Yea kinda but its still related with attack speed i just found better way to create weapon that skills attack speed. So i thinking it doesnt worth to create new thread because of this. But yea sorry about that.Mmmmmh i think what you are asking now is completely different from above
local modifier = 1000 -- 100 ms attack speed increase
function onEquip(player, item, slot)
local as = player:getAttackSpeed()
if player:getStorageValue(17000) == -1 then
local slotItem = player:getSlotItem(slot)
-- workaround for a bug in tfs, onEquip gets executed twice
if slotItem and slotItem.itemid == item.itemid then
return true
end
player:setStorageValue(17000, 1)
player:setAttackSpeed(player:getAttackSpeed() - modifier)
print(""..as.."")
end
return true
end
function onDeEquip(player, item, slot)
if player:getStorageValue(17000) == 1 then
player:setStorageValue(17000, -1)
player:setAttackSpeed(player:getAttackSpeed() + modifier)
end
return true
end