Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   getguildnick(guild, account) (https://forums.graalonline.com/forums/showthread.php?t=73057)

Chandler 03-25-2007 02:36 PM

getguildnick(guild, account)
 
So, does this feature work? I think not.
Working on a basic tag feature, can anyone see why?
HTML Code:

function onPlayerChats()
  {
  if (this.guildowner.index(player.account) == -1)
    return false;
  temp.playerChat = player.chat.tokenize();
  temp.playerOption = temp.playerChat[0];
  temp.playerParams = player.chat.substring((temp.playerOption.length() + 1)).tokenize();
  switch(temp.playerOption.substring(1))
    {
    case "add":
      this.chat = getguildnick("FAQ", player.account);
      if (getguildnick("FAQ", temp.playerParams[0]) == "")
        {
        temp.playerAccount = findPlayer(temp.playerParams[0]);
        if (temp.playerAccount.account)
          {
          addguildmember("FAQ", temp.playerParams[0], temp.playerParams[1]);
          this.doMessage({{player.account, format(_("You've added %s [%s]!"), temp.playerParams[0], temp.playerParams[1])},
                          {temp.playerAccount.account, format(_("You've been added to the FAQ Team!\n%s (FAQ)"), temp.playerParams[1])}
                        });
          }
        else
          {
          this.doMessage({{player.account, format(_("%s Isn't online!"),temp.playerParams[0])}});
          }
        }
      else
        {
        this.doMessage({{player.account, format(_("%s already has a tag! [%s]"), temp.playerParams[0], getguildnick("FAQ", temp.playerParams[0]))}});
        }
    break;
    case "remove":
      if (getguildnick("FAQ", temp.playerParams[0]))
        { 
          removeguildmember("FAQ", temp.playerParams[0]);
          this.doMessage({{player.account, format(_("You've removed %s!"), temp.playerParams[0])},
                          {temp.playerParams[0], "You've been removed from the FAQ Team!"}
                        });   
        }
      else
        {
        this.doMessage({{player.account, format(_("%s Isn't in the FAQ Team!"),temp.playerParams[0])}});
        }
    break; 
    }
  }
function doMessage(messageData)
  for (temp.currentMessage: temp.messageData)
    findPlayer(temp.currentMessage[0]).sendpm(temp.currentMessage[1]);


Skyld 03-25-2007 03:40 PM

Maybe you would like to explain why the code is not working and what behaviour you are expecting. :|

Chandler 03-25-2007 03:55 PM

right.
PHP Code:

getguildnick(guildaccount

Does this work? [Answer being yes or no of cause]
If answer is to be yes, what am I doing wrong.

godofwarares 03-25-2007 04:06 PM

Quote:

Originally Posted by Chandler (Post 1292874)
right.
PHP Code:

getguildnick(guildaccount

Does this work? [Answer being yes or no of cause]
If answer is to be yes, what am I doing wrong.

Yes, but it has to be called from serverside. Clientside doesn't work.

Chandler 03-25-2007 05:28 PM

Quote:

Originally Posted by godofwarares (Post 1292876)
Yes, but it has to be called from serverside. Clientside doesn't work.

The code that I posted isn't clientside, rofl

Inverness 03-25-2007 05:45 PM

Quote:

Originally Posted by Chandler (Post 1292889)
The code that I posted isn't clientside, rofl

I didn't know that the PlayerChats event was called serverside...?

Chandler 03-25-2007 05:50 PM

Quote:

Originally Posted by Inverness (Post 1292891)
I didn't know that the PlayerChats event was called serverside...?

I should make it clear, it's for a class.

Inverness 03-25-2007 06:00 PM

Quote:

Originally Posted by Chandler (Post 1292894)
I should make it clear, it's for a class.

How does this change the fact that onPlayerChats() is not called on the serverside? Which is obviously the initial function of your script.

godofwarares 03-25-2007 06:06 PM

You don't call onPlayerChats() on serverside ...

Chandler 03-25-2007 06:12 PM

ok... explain why not? Also explain how it works for that matter. Thank you.

godofwarares 03-25-2007 06:18 PM

Quote:

Originally Posted by Chandler (Post 1292900)
ok... explain why not? Also explain how it works for that matter. Thank you.

When the player chats, its triggered clientside, not serverside. You can't receive triggers serverside if they are triggered clientside.

Use a triggerServer();.

Chandler 03-25-2007 06:20 PM

You're making no sense. You are aware of what a class is right?

Inverness 03-25-2007 06:33 PM

And you're aware of the fact that classes also have a clientside and serverside right?

If the object is in a level and you want to send info to the serverside, then you can set a shape to the object on both sides and trigger an action on the object with the parameters you need, the action will be called on serverside & clientside as a result.

Rapidwolve 03-25-2007 06:42 PM

I know of format() but not of format(_()) whats that do?

Chandler 03-25-2007 06:45 PM

Lets move along from the calling of the function. Is anyone else having any problems with
PHP Code:

getguildnick(guildaccount

Thank you...

Just more organized.
PHP Code:

format(_("%s hiya"), player.account


godofwarares 03-25-2007 06:56 PM

Quote:

Originally Posted by Chandler (Post 1292903)
You're making no sense. You are aware of what a class is right?

No duh. You're not listening to what i'm saying:

PHP Code:

function onPlayerChats() // WON'T work

//#CLIENTSIDE
function onPlayerChats() // WILL work 

Simple as that.

P.S:
PHP Code:

triggerServer("class""classname""function""params"); 

:asleep:

Angel_Light 03-25-2007 07:02 PM

I've used player.chat/onPlayerChats on Serverside and it worked fine, well it was a Tad slower but it still worked none the less

EDIT: Also I've never really heard of this function. What exactly are you trying to do? Add the guild tag to the player no matter what their nick is? Maybe something else?

Chandler 03-25-2007 07:03 PM

Quote:

Originally Posted by godofwarares (Post 1292916)
No duh. You're not listening to what i'm saying:

PHP Code:

function onPlayerChats() // WON'T work

//#CLIENTSIDE
function onPlayerChats() // WILL work 

Simple as that.

P.S:
PHP Code:

triggerServer("class""classname""function""params"); 

:asleep:

rofl, you don't understand at all.

Quote:

Originally Posted by Angel_Light (Post 1292918)
I've used player.chat serverside and it worked fine, well it's a tad slower than the clientside but it still worked, o.O

Yeah. I don't think either of them understand.
Thank you :)


Upon debugging with a friend, we found the error.
Thanks

Inverness 03-25-2007 07:13 PM

*shrug*
You need to be more specific next time.

Chandler 03-25-2007 07:14 PM

Yeah, I guess when people don't understand how a class or a level object work it can be rather difficult.
Quote:

Originally Posted by Inverness (Post 1292891)
I didn't know that the PlayerChats event was called serverside...?

I should make it clear, it's for a class.

xXziroXx 03-26-2007 01:12 AM

Newbs.

onPlayerChats() only doesn't work on serverside in a wNPC, if its in a local npc/class/DB it WILL work serverside.

And to answer your question Chandler, yes - your getguildname(guild, account) will (should) work, I've used it in the same way and it works.

I refer you to this thread: http://forums.graalonline.com/forums...ad.php?t=71885

Chandler 03-26-2007 08:36 AM

Quote:

Originally Posted by xXziroXx (Post 1293073)
Newbs.

onPlayerChats() only doesn't work on serverside in a wNPC, if its in a local npc/class/DB it WILL work serverside.

And to answer your question Chandler, yes - your getguildname(guild, account) will (should) work, I've used it in the same way and it works.

I refer you to this thread: http://forums.graalonline.com/forums...ad.php?t=71885

That's where I got the idea from, hehe. I have a problem with adding myself though, but it works for everyone else. Thank you.

xXziroXx 03-26-2007 09:08 AM

Quote:

Originally Posted by Chandler (Post 1293174)
That's where I got the idea from, hehe. I have a problem with adding myself though, but it works for everyone else. Thank you.

You're welcome!

Twinny 03-28-2007 09:39 AM

Lol @ the "lol nub onPlayerChats can't be called serverside?!?!?!"

Perhaps you were thinking about ChatBar.onAction? That can't be read serverside ^^.

If you have onPlayerChats serverside in a weapon, everyone in that level can call that event - even if only one player has it.

xXziroXx 03-28-2007 11:00 AM

Quote:

Originally Posted by Twinny (Post 1293877)
Lol @ the "lol nub onPlayerChats can't be called serverside?!?!?!"

Perhaps you were thinking about ChatBar.onAction? That can't be read serverside ^^.

If you have onPlayerChats serverside in a weapon, everyone in that level can call that event - even if only one player has it.

I'm quite sure that it cant be called from a Weapon on serverside, atleast it couldn't in the past.

EDIT: I just tried it, it didn't work. I tried to make a wNPC with only a serversided onPlayerChats and I tried making one with some useless script on clientside and a onPlayerChats serverside. None worked.

Twinny 03-28-2007 02:07 PM

Quote:

Originally Posted by xXziroXx (Post 1293884)
I'm quite sure that it cant be called from a Weapon on serverside, atleast it couldn't in the past.

EDIT: I just tried it, it didn't work. I tried to make a wNPC with only a serversided onPlayerChats and I tried making one with some useless script on clientside and a onPlayerChats serverside. None worked.

Yeah...damn.. I thought of a time where i had a 'if (playerchats)' serverside on a N-pulse weapon (damn gs1) and i remember everyone getting affected by it when they spoke even though i was the only one who had it. I thought i used a weapon >_<.

zokemon 03-29-2007 08:28 AM

What the hell are you guys talking about...onPlayerChats is a global function both serverside and clientside o_O

xXziroXx 03-29-2007 08:36 AM

Quote:

Originally Posted by zokemon (Post 1294197)
What the hell are you guys talking about...onPlayerChats is a global function both serverside and clientside o_O

NOT in a Weapon. Never has been, never will be. Try it and see for yourself if you can not take us on our word.

zokemon 03-29-2007 08:40 AM

Quote:

Originally Posted by xXziroXx (Post 1294201)
NOT in a Weapon. Never has been, never will be. Try it and see for yourself if you can not take us on our word.

Oh maybe not in a weapon...
But for TServerNPC's it DEFINATLY is serverside o_O

xXziroXx 03-29-2007 08:42 AM

Quote:

Originally Posted by zokemon (Post 1294202)
Oh maybe not in a weapon...
But for TServerNPC's it DEFINATLY is serverside o_O

For everything other then a Weapon, aye.

Inverness 03-30-2007 11:32 PM

The only time I ever use onPlayerChats is for weapons so excuse me...

xXziroXx 03-31-2007 01:08 AM

Quote:

Originally Posted by Inverness (Post 1294746)
The only time I ever use onPlayerChats is for weapons so excuse me...

We're talking about onPlayerChats serversided in a weapon. That does NOT work.

Inverness 03-31-2007 04:41 AM

Quote:

Originally Posted by xXziroXx (Post 1294797)
We're talking about onPlayerChats serversided in a weapon. That does NOT work.

Thats the point, I doesn't work for a weapon so I assumed it didn't work for anything else :P

I do have a vague recollection of maybe using it for an npc sometime though...

Chandler 03-31-2007 05:28 AM

rofl, you were still wrong :p


All times are GMT +2. The time now is 05:53 PM.

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