The International Simutrans Forum

 

Author Topic: [Road sign] Player is authorized?  (Read 1821 times)

0 Members and 1 Guest are viewing this topic.

Offline Yona-TYT ve

  • Devotee
  • *
  • Posts: 1091
    • Simutrans-BLOG
  • Languages: ES
[Road sign] Player is authorized?
« on: February 04, 2018, 03:32:52 PM »



is it possible to know if the player is authorized to use the toll?







Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4454
  • Languages: EN, DE, AT
Parsley, sage, rosemary, and maggikraut.

Offline Yona-TYT ve

  • Devotee
  • *
  • Posts: 1091
    • Simutrans-BLOG
  • Languages: ES
Re: [Road sign] Player is authorized?
« Reply #2 on: February 06, 2018, 04:00:01 PM »
Thanks !!, I will work with this soon ;)... I hope it works in multiplayer mode  ;D .

Offline Yona-TYT ve

  • Devotee
  • *
  • Posts: 1091
    • Simutrans-BLOG
  • Languages: ES
Re: [Road sign] Player is authorized?
« Reply #3 on: February 16, 2018, 10:39:53 PM »
Here is a script that allows you to share the regions with several players using the toll signs.

script -> region-lite-v2.0.zip

savegame -> http://files.simutrans.com/index.php/s/qBIJrhPsoVzkjpg

Code: [Select]
function region_shared(pl, tool_id, pos, result)
{
  for (j=0;j<12;j++) {
    if (j == (pl-2))
      continue
    local tile = square_x(coord_label1[j].x+1, coord_label1[j].y).get_ground_tile()
   
    local sign = tile.find_object(mo_roadsign)
    if(sign){
   
    if (sign.can_pass(player_x(pl))){
        if (pos.x+1 >= pl_reg[j].x1 && pos.x <= pl_reg[j].x2+1 && pos.y+1 >= pl_reg[j].y2 && pos.y<= pl_reg[j].y1+1 ) {
          return null
        }
    }
    }
  }
  return result
}

« Last Edit: February 16, 2018, 10:52:02 PM by Yona-TYT »