• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

a question about guild methods

Status
Not open for further replies.

DndTheTroll

Respected Member
Hello, I've learnt lua today but i've a small problem here

// Guild
GUILD_EVENT_ON_CREATE = 33, - Implemented -- Commented out

Why there's no (event, player) or something like that? cuz im trying to make if someone made new guild it will announce and here's my the code that i wrote so far
-- coded by DndTheTroll
local function GuildOnCreate()
player:SendBroadcastMessage(""..player:GetName().." has created a guild "..guild:GetName().."")
end

RegisterServerHook(33, GuildOnCreate)

if someone can fix it for me will be great :) and sorry for my bad English.
 

Tommy

Founder
What are you talking about? You use it like this:

Code:
[COLOR=#000000]-- coded by DndTheTroll
local function GuildOnCreate(event, guild, leader, guildName)
player:SendBroadcastMessage(""..player:GetName()..  " has created a guild "..guild:GetName().."")
end

RegisterServerHook(33, GuildOnCreate)[/COLOR]
 

Tommy

Founder
h means that the wiki is outdated maybe o.o

Nothing is up there about the wiki being outdated.

I think so

You think that you're talking about the wiki? Really?..

The wiki probably won't be updated until we get some contributors. Normally when we get people, they leave without saying anything. Typical internet, huh? Anyway, I gave you the updated version of the hook variables.
 

DndTheTroll

Respected Member
Nothing is up there about the wiki being outdated.



You think that you're talking about the wiki? Really?..

The wiki probably won't be updated until we get some contributors. Normally when we get people, they leave without saying anything. Typical internet, huh? Anyway, I gave you the updated version of the hook variables.
No, Tommy i don't mean that at all I'm just starter in lua and i want to make the script work, and i showed you the code.. also i tried with the code u gave me but didn't work.
 

Foereaper

Founder
No, Tommy i don't mean that at all I'm just starter in lua and i want to make the script work, and i showed you the code.. also i tried with the code u gave me but didn't work.

Feel free to elaborate, just saying it didn't work won't make us able to help you :p give specific errors and we can tell you what's wrong or not
 

Tommy

Founder
I don't see how it didn't work..

Code:
            sEluna->BeginCall((*itr));

            sEluna->PushUnsigned(sEluna->LuaState, GUILD_EVENT_ON_CREATE); -- event

            sEluna->PushGuild(sEluna->LuaState, guild); -- guild

            sEluna->PushUnit(sEluna->LuaState, leader); -- leader

            sEluna->PushString(sEluna->LuaState, name.c_str());  -- guildName

            sEluna->ExecuteCall(4, 0);

Code:
-- coded by DndTheTroll
local function GuildOnCreate(event, guild, leader, guildName)
leader:SendBroadcastMessage(""..leader:GetName()..  " has created a guild "..guild:GetName().."")
end

RegisterServerHook(33, GuildOnCreate)

Well, it probably doesn't work because I thought you would change everything to its original place. Let me do that for you.
 

Rochet2

Moderator / Eluna Dev
The same thing is in the core. I wrote that there. The hooks did not work at all when I tested and ran on wrong events. Havent tested them since. (they were coded differently at that time)
The hook codes were commented out and were unusable, but now they should be coded but are not yet documented, even in the core code.

Here they are;
Code:
    // Guild
    GUILD_EVENT_ON_ADD_MEMBER               =     29,           // (event, guild, player, rank)
    GUILD_EVENT_ON_REMOVE_MEMBER            =     30,           // (event, guild, isDisbanding, isKicked)
    GUILD_EVENT_ON_MOTD_CHANGE              =     31,           // (event, guild, newMotd)
    GUILD_EVENT_ON_INFO_CHANGE              =     32,           // (event, guild, newInfo)
    GUILD_EVENT_ON_CREATE                   =     33,           // (event, guild, leader, name)
    GUILD_EVENT_ON_DISBAND                  =     34,           // (event, guild)
    GUILD_EVENT_ON_MONEY_WITHDRAW           =     35,           // (event, guild, player, amount, isRepair)
    GUILD_EVENT_ON_MONEY_DEPOSIT            =     36,           // (event, guild, player, amount)
    GUILD_EVENT_ON_ITEM_MOVE                =     37,           // (event, guild, player, item, isSrcBank, srcContainer, srcSlotId, isDestBank, destContainer, destSlotId)
    GUILD_EVENT_ON_EVENT                    =     38,           // (event, guild, eventType, plrGUIDLow1, plrGUIDLow2, newRank)
    GUILD_EVENT_ON_BANK_EVENT               =     39,           // (event, guild, eventType, tabId, playerGUIDLow, itemOrMoney, itemStackCount, destTabId)

The guild name is one of the hook args btw:
Code:
local function GuildOnCreate(event, guild, leader, name)
    leader:SendBroadcastMessage(leader:GetName().." has created a guild "..[COLOR=#008000]name[/COLOR])
end

RegisterServerHook(33, GuildOnCreate)
 
Last edited:

Tommy

Founder
The same thing is in the core. I wrote that there. The hooks did not work at all when I tested and ran on wrong events. Havent tested them since. (they were coded differently at that time)
The hook codes were commented out and were unusable, but now they should be coded but are not yet documented, even in the core code.

Here they are;
Code:
    // Guild
    GUILD_EVENT_ON_ADD_MEMBER               =     29,           // (event, guild, player, rank)
    GUILD_EVENT_ON_REMOVE_MEMBER            =     30,           // (event, guild, isDisbanding, isKicked)
    GUILD_EVENT_ON_MOTD_CHANGE              =     31,           // (event, guild, newMotd)
    GUILD_EVENT_ON_INFO_CHANGE              =     32,           // (event, guild, newInfo)
    GUILD_EVENT_ON_CREATE                   =     33,           // (event, guild, leader, name)
    GUILD_EVENT_ON_DISBAND                  =     34,           // (event, guild)
    GUILD_EVENT_ON_MONEY_WITHDRAW           =     35,           // (event, guild, player, amount, isRepair)
    GUILD_EVENT_ON_MONEY_DEPOSIT            =     36,           // (event, guild, player, amount)
    GUILD_EVENT_ON_ITEM_MOVE                =     37,           // (event, guild, player, item, isSrcBank, srcContainer, srcSlotId, isDestBank, destContainer, destSlotId)
    GUILD_EVENT_ON_EVENT                    =     38,           // (event, guild, eventType, plrGUIDLow1, plrGUIDLow2, newRank)
    GUILD_EVENT_ON_BANK_EVENT               =     39,           // (event, guild, eventType, tabId, playerGUIDLow, itemOrMoney, itemStackCount, destTabId)

The guild name is one of the hook args btw:
Code:
local function GuildOnCreate(event, guild, leader, name)
    leader:SendBroadcastMessage(leader:GetName().." has created a guild "..[COLOR=#008000]name[/COLOR])
end

RegisterServerHook(33, GuildOnCreate)

He almost had everything correct, just didn't look thoroughly at the hook. :D
 
Status
Not open for further replies.
Top