function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray({2433,7438,2390,2400,2408,2446}, itemEx.itemid) then
doItemSetAttribute(itemEx.uid, "description", " +50% attack speed.")
doItemSetAttribute(itemEx.uid, "attackspeed", 500)
doSendMagicEffect(toPosition,30)
doRemoveItem(item.uid)
else
doPlayerSendCancel(cid, "Sorry, not possible.")
end
return true
end
try this action script
Lua:function onUse(cid, item, fromPosition, itemEx, toPosition) if isInArray({2433,7438,2390,2400,2408,2446}, itemEx.itemid) then doItemSetAttribute(itemEx.uid, "description", " +50% attack speed.") doItemSetAttribute(itemEx.uid, "attackspeed", 500) doSendMagicEffect(toPosition,30) doRemoveItem(item.uid) else doPlayerSendCancel(cid, "Sorry, not possible.") end return true end
doItemSetAttribute(itemEx.uid, "attackspeed", [B]500[/B])
You can change the attack speed in vocations.xml?
<attribute key="attackspeed" value="800"/>
attackspeed="2000"
//
uint32_t attackSpeed;
if you don't want to make additional vocations for every vocation, you can add
don't like the solution? edit player.cpp
[cpp]uint32_t Player::getAttackSpeed()
{
Item* weapon = getWeapon();
if(weapon && weapon->getAttackSpeed() != 0)
return weapon->getAttackSpeed();
if(attackSpeed)
return attackSpeed;
return vocation->getAttackSpeed();
}[/cpp]
player.h
[cpp]
void setAttackSpeed(const uint32_t newSpeed) {attackSpeed = newSpeed;}[/cpp]
and
luascript.cppCode:// uint32_t attackSpeed;
[cpp]//
//doPlayerSetAttackSpeed(cid, newSpeed)
lua_register(m_luaState, "doPlayerSetAttackSpeed", LuaScriptInterface::luaDoPlayerSetAttackSpeed);[/cpp]
and
[cpp]
int32_t LuaScriptInterface::luaDoPlayerSetAttackSpeed(lua_State* L)
{
//doPlayerSetAttackSpeed(cid, newSpeed)
uint32_t newSpeed = popNumber(L);
ScriptEnviroment* env = getEnv();
if(Player* player = env->getPlayerByUID(popNumber(L)))
{
player->attackSpeed = newSpeed;
lua_pushboolean(L, true);
}
else
{
errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushboolean(L, false);
}
return 1;
}[/cpp]
luascript.h
[cpp]//
static int32_t luaDoPlayerSetAttackSpeed(lua_State* L);[/cpp]
1>..\player.cpp(4498): error C2660: 'Player::getWeapon' : function does not take 0 arguments
1>..\luascript.cpp(1519): error C2653: 'LuaScriptInterface' : is not a class or namespace name
1>..\luascript.cpp(1519): error C2065: 'luaDoPlayerSetAttackSpeed' : undeclared identifier
1>..\luascript.cpp(3993): error C2653: 'LuaScriptInterface' : is not a class or namespace name
1>..\luascript.cpp(3996): error C3861: 'popNumber': identifier not found
1>..\luascript.cpp(3998): error C3861: 'getEnv': identifier not found
1>..\luascript.cpp(3999): error C3861: 'popNumber': identifier not found
1>..\luascript.cpp(4001): error C2248: 'Player::attackSpeed' : cannot access private member declared in class 'Player'
1> c:\users\username\blablal\blablalba\blax1000\player.h(897) : see declaration of 'Player::attackSpeed'
1> c:\users\username\blabalba\blalba\blax100\player.h(130) : see declaration of 'Player'
1>..\luascript.cpp(4006): error C3861: 'error': identifier not found
1>..\luascript.cpp(4006): error C3861: 'getError': identifier not found
you can change attackspeed in items.xml
Lua:<attribute key="attackspeed" value="800"/>
also in vocations.xml find anLua:attackspeed="2000"
try this action script
Lua:function onUse(cid, item, fromPosition, itemEx, toPosition) if isInArray({2433,7438,2390,2400,2408,2446}, itemEx.itemid) then doItemSetAttribute(itemEx.uid, "description", " +50% attack speed.") doItemSetAttribute(itemEx.uid, "attackspeed", 500) doSendMagicEffect(toPosition,30) doRemoveItem(item.uid) else doPlayerSendCancel(cid, "Sorry, not possible.") end return true end
{
Item* weapon = getWeapon();
if(weapon && weapon->getAttackSpeed() != 0)
return weapon->getAttackSpeed();
if(attackSpeed)
return attackSpeed;
return vocation->getAttackSpeed();
}
1>..\player.cpp(4498): error C2660: 'Player::getWeapon' : function does not take 0 arguments