[Solved] How to check if a player is attached? // strcharinfo(0)

LipESprY

New member
Messages
9
Points
0
Hello, community!

I'm developing a NPC and I've a problem: Player not attached (see below)

Code:
[Error]: script_rid2sd: fatal error ! player not attached!
[Debug]: Function: strcharinfo (1 parameter):
[Debug]: Data: number value=0
[Debug]: Source (NPC): LSI_TestScript (invisible/not on a map)
I need a function/syntax to check if a player is attached.

First, I tried this, bot not worked: 

Code:
set .@invoker, strcharinfo(0) ? strcharinfo(0) : "Unknown";
I need to use "getitem" and "announce" when the mob is killed, but if this mob is killed by a mercenary or by @killmonster command, it haven't a player attached and show error on map-server's console.

Anyone have a awesome idea for solve this problem?

Tnks!

 
Last edited by a moderator:
Code:
if (playerattached()) {
  getitem(MY_ITEM, 1);
}
 
Last edited by a moderator:
I would rather advise you to use doc/script_commands.txt and the doc folder in general since it is always up-to-date. The wiki is infrequently updated

 
Last edited by a moderator:
Back
Top