• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Attempt to call method 'sendExtendedOpcode' (a nil value)

Lopaskurwa

Well-Known Member
Joined
Oct 6, 2017
Messages
890
Solutions
2
Reaction score
50
Getting this attempt to call method 'sendExtendedOpcode' (a nil value) on my spell, strangely i noticed for some reason it happens only for few people but for some it works perfectly, for some people are just executing the spell that does nothing just applies cooldown, but for some works perfectly and i see in terminal it gives this error and legit i dont understand how its possible, speculation is that some people losing player status somehow, because getting prints saying "Caster is not a Player object." this is the spell sendextendedopcode that i use
LUA:
local function sendExtendedJson(player, action, data)
    if not player or not player:isPlayer() then
        print("Caster is not a Player object.")
        return
    end

    if data == nil then
        data = {}
    end
    player:sendExtendedOpcode(config.opCode, json.encode({action = action, data = data}))
end
And this is in data\lib\core\player.lua
Code:
function Player.sendExtendedOpcode(self, opcode, buffer)
    if not self:isUsingOtClient() then
        return false
    end

    local networkMessage = NetworkMessage()
    networkMessage:addByte(0x32)
    networkMessage:addByte(opcode)
    networkMessage:addString(buffer)
    networkMessage:sendToPlayer(self)
    networkMessage:delete()
    return true
end

Legit lost and dont know how its even possible
Post automatically merged:

Interesting factor is that it seems that relog fixes the issue after it starts happening again after multiple spell uses
 
Last edited:
Hi, you can try sending cid and check userdata.

LUA:
local function sendExtendedJson(cid, action, data)
    local player = Player(cid)
    if (not player) then
        return
    end

    if data == nil then
        data = {}
    end
    player:sendExtendedOpcode(config.opCode, json.encode({action = action, data = data}))
end
 
Hi, you can try sending cid and check userdata.

LUA:
local function sendExtendedJson(cid, action, data)
    local player = Player(cid)
    if (not player) then
        return
    end

    if data == nil then
        data = {}
    end
    player:sendExtendedOpcode(config.opCode, json.encode({action = action, data = data}))
end
Okay thanks gonna try if it helped or not
 
Why dont pring some player data in the error? But sendind player in the parameter doesnt seems correct. Its aleays better send cid and retrieve player later
 
Why dont pring some player data in the error? But sendind player in the parameter doesnt seems correct. Its aleays better send cid and retrieve player later
Umm just found out it looks like spamming of that spell can be causing extendedopcode not to send it, because after high spam of it, it breaks that would explain why it was happening only for few people and fixes after a relog and breaks again if you spam it like crazy
 
Back
Top