English Trigger_if

3 replies
Goto Page
To the start Previous 1 Next To the start
27.12.15 11:57:55 am
Up
notmafiapro
User
Offline Off
Hello,
I'm shit with scripts, but knowing how to use this trigger is kinda useful, so I've got a question.
How can i check for money of a person thats on given tile?
Thanks in advance.
27.12.15 12:19:07 pm
Up
Talented Doge
User
Offline Off
27.12.15 12:49:22 pm
Up
Dousea
User
Offline Off
Just use script. You can do lots of stuff. You can use cs2d entity trigger_if entity if you need to evaluate a really simple expression, doesn't consist any other variable and other references. If you want to use script, use cs2d lua hook movetile hook. The hook will be triggered when players move between tiles. Here is an example for you.
Code:
1
2
3
4
5
6
7
8
9
10
11
addhook("movetile", "movetilehook")

function movetilehook(id, x, y)
     -- Checks if a player is in tile 1, 1
     if (x == 1 and y == 1) then
          -- Checks if a player has money more than $1000
          if (player(id, "money") > 1000) then
               -- Do your script
          end
     end
end
I'm awesome ... and I really like cookies.
27.12.15 01:35:23 pm
Up
notmafiapro
User
Offline Off
@user Dousea: Thank you for your help.
To the start Previous 1 Next To the start