Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   getnpc help (https://forums.graalonline.com/forums/showthread.php?t=64101)

talkingnoodle 02-13-2006 11:56 PM

getnpc help
 
PHP Code:

function onActionServerside(){
if (
params[0] == "check"){
this.accept 0;
with (getnpc("Police-DB")){
if (
player.account in this.admins){
this.accept 1;
}
}

if (
this.accept == 1){
player.chat "Accepted";
}else{
player.chat "Rejected";
}


Doesnt work :frown: it always says rejected

Bl0nkt 02-13-2006 11:59 PM

The correct format is

NPC Code:
with (findnpc(npc))



I don't use quotes when using it, but I don't think it will bother anything if there are quotes there.

napo_p2p 02-14-2006 02:32 AM

Quote:

Originally Posted by Bl0nkt
I don't use quotes when using it, but I don't think it will bother anything if there are quotes there.

I don't use quotes either, but I think with the '-' you might need to.

Also:
PHP Code:

this.accept = (player.account in ("Police-DB").admins); 

would work too.

ZeLpH_MyStiK 02-14-2006 12:28 PM

Change
NPC Code:
this.accept


in the with() statement to
NPC Code:
thiso.accept


You're trying to check a variable that does not exist, considering you just set it in the Police-DB npc.

ApothiX 02-14-2006 03:27 PM

also, you should probably be using findNPC("Police-DB")

KuJi 04-16-2006 05:38 PM

^-- was mentioned above.

Do you use findnpc like findplayer?

temp = findnpc("Police-DB");
temp.test = "blah";

or something?

*Edit* Haha, I didn't know I revived a dead thread lol. I don't look @ dates ;O *Edit*

ApothiX 04-19-2006 02:35 PM

Quote:

Originally Posted by KuJi
Do you use findnpc like findplayer?

temp = findnpc("Police-DB");
temp.test = "blah";

temp is a predefined prefix, so I don't think you should be doing something like that.

temp.blah = findNPC("Police-DB");
temp.blah.test = "WEeEeeEe";

would set this.test inside the Police-DB NPC.

xAndrewx 04-19-2006 05:02 PM

You could also do

Police-DB.this.test = "Lal";
which would also set it.

Yen 04-19-2006 05:18 PM

Quote:

Originally Posted by xAndrewx
You could also do

Police-DB.this.test = "Lal";
which would also set it.

The - in the name makes that unpossible. :(
Referencing is best.

n = findnpc("Police-DB);
if (n.admins.index(player.account) >= 0) {
this.accept = 1;
}

xAndrewx 04-20-2006 10:18 AM

Ah, I didn't that. Thanks :p
If anything, I use

with(findnpc())
{

KuJi 04-20-2006 11:29 PM

Ugh, for some reason, I can't get it to read data:
temp.test = findnpc("Blah");
player.chat = temp.test.test;


All times are GMT +2. The time now is 11:45 PM.

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