Putnpc on player's connection

There could be an option in the serverconfig to add certain npcs to the level the player is in once he connects.

An example of a use it could have:

if(created){
for(this.i=0;this.i<weaponscount;this.i++){
callweapon this.i,playerconnects;
}
}

So it doesn’t interfere with other player’s npcws i’d do

if(playerconnects&&this.init==0){
this.init=1;
timeout = 0.05;
}

Because I don’t think using playerenters is convenient.

It could also be used to welcome the player, warp players after an update, inform them of new changes etc…

That’s hackish but from what I’ve seen of the code it seems doable.

You can’t do

if (playerenters && this.init == 0){
  this.init = 1;

}

Why? You confused me a tad bit.

Doesn’t playerenter work on npcws only when a player enters a new level and not when he connects?

A player connecting is seen as a player entering a level. You should’ve done some tests prior to this thread.

I had… maybe my memory is playing me tricks.
Delete this thread then :slight_smile:

Resolved. kinda.

Just use created instead of playerenters in the wNPC. created only breaks in level NPCs because of a problem with level leaders.

It’s not broken if it’s functioning as intended.

Yeno, if (created) does exactly what it’s labelled, it’s only called on the serverside creation which is triggered by a single clientside instantiation, I’m pretty sure I remember testing this.