darkmu
Well-Known Member
I am currently using the OTG Premium Version, the
Using OTG 1.3 Premium Version with client 12.40
Modules.xml
Callback:
Data msg:
Function
Source
Prey Wildcart
system has not been implemented and I am trying to implement it, however I am having a hard time understanding about these bytes, here's what I'm analyzing.Using OTG 1.3 Premium Version with client 12.40
Modules.xml
XML:
<!-- Prey System -->
<module type="recvbyte" byte="235" script="prey_system/prey.lua" />
<module type="recvbyte" byte="237" script="prey_system/prey.lua" />
Callback:
Lua:
player:preyAction(msg)
Data msg:
C++:
userdata: 0x04707c58
Function
Lua:
local slot = msg:getByte()
local action = msg:getByte()
print(slot)
if not slot then
return self:sendErrorDialog("Sorry, there was an issue, please relog-in.")
end
-- Verify whether the slot is unlocked
--print(self:getPreyUnlocked(slot))
if (self:getPreyUnlocked(slot) ~= 2) then
return self:sendErrorDialog("Sorry, you don't have this slot unlocked yet.")
end
Source
C++:
int LuaScriptInterface::luaPlayerGetPreyUnlocked(lua_State* L)
{
// player:getPreyUnlocked(slot)
Player* player = getUserdata<Player>(L, 1);
uint16_t slot = getNumber<uint16_t>(L, 2);
std::cout << slot << std::endl;
if (player) {
lua_pushnumber(L, player->getPreyUnlocked(slot));
}
else {
lua_pushnil(L);
}
return 1;
}
0
(ZERO) is always returning me, why?