Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Question about PMs with NPC server (https://forums.graalonline.com/forums/showthread.php?t=74471)

Sum41Freeeeek 06-09-2007 01:13 AM

Question about PMs with NPC server
 
I'm trying to insert a command that a player can PM to the NPC server but I have no clue how. I'm assuming I have to put the script into the Control-NPC but I don't know what to put in there.

Joey told me

function onPM(text)
{
}

but he is unsure.

Chompy 06-09-2007 01:15 AM

hmm
I think it is something like
PHP Code:

function onPM() {
  if (
params[0] == "test") {
    
sendpm("Test Message");
  }


Not sure tho..
I think params[0] is what you pm the player

Sum41Freeeeek 06-09-2007 01:19 AM

nope, didn't work :[

I just got that "I am the npc server and all actions are controlled by me" or whatever.

Chompy 06-09-2007 01:22 AM

have you tried to see if onRC() returns any parameters?

PHP Code:

function onRC()
  echo(
params); 


Sum41Freeeeek 06-09-2007 01:24 AM

it doesn't :x

Chompy 06-09-2007 02:07 AM

PHP Code:

function onPM() {
  if (
params[1] == "testmsg") {
    
sendpm("woot, you got a message back!");
  }


just have setpm(NULL); in the onCreated() part of Control-NPC,
then it should work :)

params[0] is something
params[1] is the text being sent to the npcserver

also, try this when you have setpm(NULL);
PHP Code:

function onRC()
  echo(
params); 


godofwarares 06-09-2007 02:40 AM

Quote:

Originally Posted by Sum41Freeeeek (Post 1316359)
nope, didn't work :[

I just got that "I am the npc server and all actions are controlled by me" or whatever.

Under the onCreated() event, Put this:

PHP Code:

setPm(null); 


Chompy 06-09-2007 02:46 AM

Quote:

Originally Posted by godofwarares (Post 1316384)
Under the onCreated() event, Put this:

PHP Code:

setPm(null); 


:-)

Sum41Freeeeek 06-09-2007 01:58 PM

I don't really understand, can you explain further to what setPM(null); does? :x

does that just allow the NPC server to receive PMs and do further things with it? not to sure.

Admins 06-09-2007 02:42 PM

Quote:

Originally Posted by Sum41Freeeeek (Post 1316481)
I don't really understand, can you explain further to what setPM(null); does? :x

does that just allow the NPC server to receive PMs and do further things with it? not to sure.

It just disables the default automatic answering of PMs. You can also do setPM("This is an automatic message");, that will replace the automatic reply message. The onPM-event is only invoked if the default automatic message is empty.

Sum41Freeeeek 06-09-2007 03:43 PM

got it, thanks!


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

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