News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

[regions]¿player = null or player = 9 ?.

Started by Yona-TYT, October 28, 2016, 11:21:23 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT

error:



How to know if the player is null ?, I use player_x(pl).is_active()?


DrSuperGood

Surely you could test the value?

local po = player_x(pl)
if (po) {
    // stuff that needs po to exist
}
[CODE]

Dwachs

@DrSuperGood: No. This is a design flaw of the scripting api (by myself). It would need some minor changes.

@Yona: could you please always copy the relevant scripting code into your bug reports? Are you sure, you got the order of the parameters right?

Parsley, sage, rosemary, and maggikraut.

Yona-TYT




if ((pl-2)<num && pl!=0 && pl!=1 && pl!=14)


{


if (playersave[pl-2].plsave==null && !tile_x(coord_label1[pl-2].x, coord_label1[pl-2].y, coord_label1[pl-2].z).find_object(mo_label))


{


local c_label = {x=coord_label1[pl-2].x, y=coord_label1[pl-2].y}


label_x.create(c_label, player_x(pl), translate("Entre player number (1-12)"))


player_x(pl).book_cash(10000)


}
      }