Jump to content
Sign in to follow this  
Vegatry

Script for checking if several players in the car and is in trigger area?

Recommended Posts

Script for checking if several players in the car and is in trigger area?

I tries to do with via..

Trigger

activation:Independent,present

condition: p1 or p2 or p3 or p4 or p5 distance s1 <=40; p1 in car1 && p2 in car1 && p3 in car1 && p4 in car1 && p5 in car1;

on Act: s1 sidechat "Sorry sir, no vechicals allow inside.";

However the trigger was fired as soon as all crew board the "car1".

Share this post


Link to post
Share on other sites

You have a ; instead of && in the middle of the condition. A ; ends a statement and is not used in boolean conditions. This should work:

(((p1 distance s1) <= 40) && (p1 in car1 && p2 in car1 && p3 in car1 && p4 in car1 && p5 in car1))

They must all be in the car, so you only need to check the distance to one of the objects.

Share this post


Link to post
Share on other sites
You have a ; instead of && in the middle of the condition. A ; ends a statement and is not used in boolean conditions. This should work:

(((p1 distance s1) <= 40) && (p1 in car1 && p2 in car1 && p3 in car1 && p4 in car1 && p5 in car1))

They must all be in the car, so you only need to check the distance to one of the objects.

works great, I tries this before but missing those brackets. ;)

Share this post


Link to post
Share on other sites

That would also do the trick:

{(_x distance s1 <= 40) and (_x in car1)} count [p1,p2,p3,p4,p5] >= 5

For each of the 5 players it checks distance and if they're in the car and returns for how many of them this is true. (hence the ">= 5").

I just like pointing it out because most people don't realize how very useful the "count" command can be. ;)

(and it looks much cleaner than using alot of && operators)

Or this (only checks the distance of the car, not for the people inside):

(car1 distance s1 <= 40) and ({_x in car1} count [p1,p2,p3,p4,p5] >= 5)

Edited by Tajin

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×