Exedion
Active Member
- Joined
- Jun 11, 2007
- Messages
- 629
- Reaction score
- 30
i tried to make the function "doSendCooldown" but that give me this console error:
this are the line what i'm using:
this is the code i made:
[cpp]
int32_t LuaInterface::luaDoSendCooldown(lua_State* L)
{
//doSendCooldown(cid, icon, cooldown[, isGroup])
bool isGroup = false;
uint16_t icon = popNumber(L);
uint32_t cooldown = popNumber(L);
ScriptEnviroment* env = getEnv();
if(Player* player = env->getPlayerByUID(popNumber(L)))
{
player->sendSpellCooldown(icon, cooldown, isGroup);
lua_pushboolean(L, true);
}
else{
errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushboolean(L, false);
}
return 1;
}
[/cpp]
and this are the lua function with parameters:
Code:
[17:24:26.495] [Error - CreatureScript Interface]
[17:24:26.497] data/creaturescripts/scripts/login.lua:onLogin
[17:24:26.498] Description:
[17:24:26.499] attempt to index a number value
[17:24:26.500] stack traceback:
[17:24:26.500] [C]: in function 'doSendCooldown'
[17:24:26.501] data/creaturescripts/scripts/login.lua:46: in function <data/cre
aturescripts/scripts/login.lua:6>
this are the line what i'm using:
LUA:
doSendCooldown(cid, 20, 1000, false)
this is the code i made:
[cpp]
int32_t LuaInterface::luaDoSendCooldown(lua_State* L)
{
//doSendCooldown(cid, icon, cooldown[, isGroup])
bool isGroup = false;
uint16_t icon = popNumber(L);
uint32_t cooldown = popNumber(L);
ScriptEnviroment* env = getEnv();
if(Player* player = env->getPlayerByUID(popNumber(L)))
{
player->sendSpellCooldown(icon, cooldown, isGroup);
lua_pushboolean(L, true);
}
else{
errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushboolean(L, false);
}
return 1;
}
[/cpp]
and this are the lua function with parameters:
LUA:
doSendCooldown(cid, icon, cooldown[, isGroup])