Jump to content
Sign in to follow this  
Heaney

Kick player with Script in Trigger

Recommended Posts

Wondering how I can make a script that will kick a player if they do something in a trigger's activation field?

Do I use serverCommand? If so how?

Share this post


Link to post
Share on other sites

serverCommand format ['#kick %1', name player];

Generic and will need certain conditions if used in a trigger, not sure if it would even work in a trigger.

Share this post


Link to post
Share on other sites

Yeah I'll put it in a script then, not trigger.

Share this post


Link to post
Share on other sites

serverCommand format ['#kick %1', name player];

Isn't working (from an SQF).

At all. Just won't work.

Share this post


Link to post
Share on other sites

serverCommand format ["#kick %1", name player];

If not working, then try this

serverCommand format ["#exec kick %1", name player];

I had a typo in my last post, It also may only work on a server.

Share this post


Link to post
Share on other sites

Yeah I made a solution that just gives that client endGame.

Share this post


Link to post
Share on other sites
Yeah I made a solution that just gives that client endGame.

Any chance you could explain that solution in more detail? Thanks!

Share this post


Link to post
Share on other sites
Probably this http://community.bistudio.com/wiki/forceEnd

And then just specify what you want the trigger to check. E.g

condition: (rating player < -1000)

on act: forceEnd

Edit: or this http://community.bistudio.com/wiki/endMission

Or this http://community.bistudio.com/wiki/failMission

Apologies, but I had found those in my initial search... maybe I'm misunderstanding how the triggers work then. Wouldn't a trigger set up as you describe end the mission for all players when any one player's rating fell below -1000? I don't see any of those three functions taking any parameters (a player object, for example). Is the trigger system somehow aware that the forceEnd only applies to the player that tripped the condition?

Share this post


Link to post
Share on other sites

Triggers and "player" are local. And as you can see, e.g forceEnd is a local command.

So

(rating player) < -1000

Could be true for one player, while false for another player.

http://community.bistudio.com/wiki?title=6thSense.eu:EG

The value of the variable "player" is:

Server: a null object

Clients: the object (vehicle) that represents the player on this computer

If there are 3 player slots in game,

player1 I name: p1

player2 I name: p2

player3 I name: p3

then on p3's computer:

player == p3

you can access the other players through the variables: p1 and p2

on p2's computer:

player == p2

and you can access the other players through the variables: p1 and p3

Triggers created in editor exist on all machines (a trigger is created per machine, local to it), and they run on all machines (conditions checked, onActivation/onDeActivation executed when condition is true etc)

Because the trigger is created on each machine, changing the trigger properties (statements, onActivation, etc. etc) has only local effects.

Unconfirmed: Is the effect of moving or deleting triggers global or local. One would believe local.

Triggers created in scripts are local and only exist/run on the machine where they got created.

Note that this might end the mission for a listen (not dedicated) server (since player is not a null-object on those), thus ending it for everyone. So the code could be changed to

(((rating player) < -1000) && !isServer)

Would cover all clients and exclude the server.

Edited by cuel

Share this post


Link to post
Share on other sites
Triggers and "player" are local. And as you can see, e.g forceEnd is a local command.

So

(rating player) < -1000

Could be true for one player, while false for another player.

http://community.bistudio.com/wiki?title=6thSense.eu:EG

Note that this might end the mission for a listen (not dedicated) server (since player is not a null-object on those), thus ending it for everyone. So the code could be changed to

(((rating player) < -1000) && !isServer)

Would cover all clients and exclude the server.

I had started to read up on locality, but this provides me with helpful information. Thank you!

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  

×