PDA

View Full Version : getnpc help


talkingnoodle
02-13-2006, 11:56 PM
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

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
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:
this.accept = (player.account in ("Police-DB").admins);

would work too.

ZeLpH_MyStiK
02-14-2006, 12:28 PM
Change
this.accept
in the with() statement to
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, 06: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, 03:35 PM
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, 06:02 PM
You could also do

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

Yen
04-19-2006, 06:18 PM
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, 11:18 AM
Ah, I didn't that. Thanks :p
If anything, I use

with(findnpc())
{

KuJi
04-21-2006, 12:29 AM
Ugh, for some reason, I can't get it to read data:
temp.test = findnpc("Blah");
player.chat = temp.test.test;