PDA

View Full Version : Catching cross server guilds on login?


scriptless
08-18-2014, 05:37 AM
This might be confusing but..

Is it possible, for example for me to set my nickname to my global guild when I login. And catch that on a server that has global guilds disabled? I wan't to try and get the guild before it takes it away. The reason is this could be nice if servers with scripted guilds could automatically reconnect after a player reconnects or gets disconnected.

I was thinking maybe theres a GUI control that can catch the event already? Can't remember.

shrimps
08-18-2014, 06:42 AM
Ahh, for example if I'm on Zodiac with *shrimps (Steele) and I log into Kingdoms, I get to keep the *shrimps (Steele) with the Clan system on Kingdoms? Instead of having to put my tag back on?

scriptless
08-18-2014, 03:11 PM
Ahh, for example if I'm on Zodiac with *shrimps (Steele) and I log into Kingdoms, I get to keep the *shrimps (Steele) with the Clan system on Kingdoms? Instead of having to put my tag back on?

Or kingdom tag for example. Would be pretty cool. I only ask because I notice sometimes it takes a second before it removes my tag. So if theres a way to catch it that would be cool. Not sure if Nico would use it but other servers might.

Edit:

Apparently using onActionPlayerOnline() in the Control-NPC will works. But it could be confusing. I will explain.

function onActionPlayerOnline(){
echo("result:" SPC player.guild);
}

This is the code I used to test. I logged on my server and set my nick to Scriptless (Canavi) via script knowing it would remove my tag when I reconnected. When I reconnected the rc echo'd that nick and guild. So success. However, when I logged on GK and put my kingdom tag on then logged back onto my server it read my nickname as the last nickname used on my server. So anyone got any ideas on if it's possible to check what your last guild tag was while logging on a server before it gets removed?

Also, while I can read the variable to a client flag, I still cannot get it to automatically set the tag. :( Any ideas on that would be great.

Restraint
08-21-2014, 02:45 AM
Did you try something like...


function onPlayerLogout(pl) {
pl.clientr.lastGuild = pl.guild;
}


combined with:


function onPlayerLogin(pl) {
pl.guild = pl.clientr.lastGuild;
}


If that doesn't work, try a simple delay on the onPlayerLogin, such as:


function onPlayerLogin(pl) {
scheduleEvent("fixGuild", 1, pl);
}
function onFixGuild(pl) {
pl.guild = pl.clientr.lastGuild;
}

scriptless
08-22-2014, 03:50 AM
Did you try something like...


function onPlayerLogout(pl) {
pl.clientr.lastGuild = pl.guild;
}


combined with:


function onPlayerLogin(pl) {
pl.guild = pl.clientr.lastGuild;
}


If that doesn't work, try a simple delay on the onPlayerLogin, such as:


function onPlayerLogin(pl) {
scheduleEvent("fixGuild", 1, pl);
}
function onFixGuild(pl) {
pl.guild = pl.clientr.lastGuild;
}


That would force a guild tag change when player logs on even if they want to use another tag. Which is a bad idea. This kinda worked. (Sorry didn't copy from my server tried typing it from memory)

Control-NPC
function onActionPlayerOnline(){
player.clientr.lastguild = player.guild;
}

WNPC
function onPlayerNickChanges(obj){
obj.guild = obj.clientr.lastguild;
}

Restraint
08-22-2014, 05:03 PM
Ah okay. Didn't understand what you were trying to do.

So you want to always preserve the player's guild through nickname changes unless they set a new guild?

Then your function looks correct, minus giving players the ability to specify a new guild tag. What's wrong with it?