Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   TServerPlayer.onNickChanges(str, str) (https://forums.graalonline.com/forums/showthread.php?t=134257072)

salesman 11-25-2009 08:46 PM

TServerPlayer.onNickChanges(str, str)
 
Quote:

TServerPlayer.onNickChanges(str, str) event - nick changes: new and old nick name
I'm having trouble using this...Does anyone know how it works, or if it even works at all?

onPlayerNickChanges(pl) works, but it only passes a player object in the parameters so I would have to keep track of the players old nickname manually. That seems silly to do when there's supposed to be another event that does exactly what I need.

Tigairius 11-25-2009 08:50 PM

I believe you have to catch the event. I told Chris this but I don't know if he ever relayed the message to you.

Try something like:
PHP Code:

function onCreated() {
  
this.catchEvent(findplayer("salesman"), "onNickChanges""onNickChanged");
}

function 
onNickChanged(plold, new) {
  echo(
pl.account "'s old name: " old " new name: " @ new);



salesman 11-25-2009 08:56 PM

Quote:

Originally Posted by Tigairius (Post 1540396)
snip

Yeah we tried that, and I just tried it again...no luck. Unless I'm doing something wrong; does it matter where I put that? Control-NPC?

Edit: I'm wondering if this has something to do with having a custom nickname system on era?
Edit x2: enabled default nicknames and it still didn't work, so scratch that

WhiteDragon 11-25-2009 09:45 PM

I tried as well with no luck, both serverside and clientside. I also searched the wiki for onNickChanges, with no results.
There is no mention of it in graal -listscriptfunctions either, but that doesn't list events at all, so no surprises there I guess.

Maybe it just somehow got added into /scripthelp without the event actually being triggered, or maybe it's just not catchable.

Tigairius 11-25-2009 10:20 PM

Maybe it just doesn't work, or maybe it will work in the new version.

salesman 11-26-2009 10:38 PM

I sent a PM to Stefan, so incase anyone was wondering...

Quote:

Originally Posted by Stefan
Ok it was bugged it seems, I've modified it now so it should work with the next npcserver update.


callimuc 12-05-2011 07:34 PM

*bump*

Looks like this havenīt been fixed. I also tried the code Tig posted (serverside and clientside)
PHP Code:

function onCreated() {
  
this.catchEvent(findplayer("callimuc"), "onNickChanges""onNickChanged");
}
function 
onNickChanged(ploldnewn) {
  echo(
pl.account "'s old name: " old " new name: " newn);


Any way Stefan is adding it? Seems like he mentioned he will add it into the next npcserver update, but thats also 2 years ago now.

fowlplay4 12-05-2011 10:04 PM

You could do a check like this:

PHP Code:

//#CLIENTSIDE
function ChatBar.onAction() {
  if (
ChatBar.text.starts("setnick")) {
    
temp.new_nickname ChatBar.text.substring("setnick".length());
    
temp.old_nickname player.nick;
  }




All times are GMT +2. The time now is 11:10 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.