OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: Rone on 23 Jan 2009, 17:09:54
-
hello,
i am doing a coop mission in which the players each use a bike to go to a meeting place.
I wanted to make a private message appear when a player gets on his bike, using vehiclechat:
this addeventhandler ["getin", {unit vehiclechat "blabla"}]
but nothing happens...
Is there a peculiar way to use the "vehiclechat" command?
Sorry if this question is stupid, i am a complete noob. :-[
-
Information about the event are passed into the function, {}, in the _this array.
this addeventhandler ["getin", {(_this select 0) vehiclechat "blabla"}]
-
hello spooner,
Ty for your help.
i put
this addeventhandler ["getin", {(_this select 0) vehiclechat "blabla"}]
in the init of the car but no message appear :scratch:
when i use sidechat instead of vehiclechat, it works... :dunno:
-
Sending the message immediately won't work. It seems like the game hasn't realized that you're in the car already.
The solution is to create a script that waits before it sends the message and run that script from the eventhandler:
this addEventHandler ["GETIN", { "It's a hundred and six miles to Ortego..." execVM "sendVehicleMsg.sqf" }]
waitUntil { (vehicle player) != player }; // wait until the game knows were inside
sleep 1; // it's lying: it still doesn't know! So wait some more...
(vehicle player) vehicleChat _this;
-
Ty Worldeater,
i test that.
edit: works perfectly; thanks for your help. :clap:
-
There is nothing like immediately spotting the obvious error to make you miss the real problem. Sorry!