=> Source : https://www.altisliferpg.com/topic/1806-sandalye-oturma-chair-sit-down-script/
Bonjour aujourd'hui je vous partage le scripts pour pouvoir s'assoir sur les chaises et bouger, j'informe que je n'est plus la source donc je remercie d'avance l'auteur du script testé sur Altis Life 5.0 fonctionne a 100%
[CODE lang="cpp" title="sitdown.sqf"]
#include "..\..\script_macros.hpp"
/*
File: sitdown.sqf
Author: Joachim and Victor for Prism Community
www.prism.ovh
Description:
Sit in a chair!
*/
private ["_chair","_unit","_randomSit","_sitStyle","_dir"];
_chair = _this select 0;
_unit = _this select 1;
_randomSit = floor(random 5);
if (_unit getVariable ["restrained",false]) exitWith {};
if (_unit getVariable ["isTazed",false]) exitWith {};
if ((player getVariable "sit") == 1) exitWith{hint "Vous êtes déjà assis !"};
if (vehicle _unit != _unit) exitWith { hint "Vous êtes déjà assis ici !" };
if (_unit distance _chair > 4) exitWith { hint "Vous êtes trop loin !" };
if (!isNull (_chair getVariable ["sitting", objNull])) exitWith { hint "Quelqu'un est déjà assis !"; };
if ("sun" in (str _chair)) exitWith { hint "Vous ne pouvez pas vous assoir sur cette objet !"; };
switch _randomSit do
{
case 0: { _sitStyle = "HubSittingChairA_idle1"};
case 1: { _sitStyle = "HubSittingChairB_idle3"};
case 2: { _sitStyle = "HubSittingChairC_idle3"};
case 3: { _sitStyle = "HubSittingChairUA_idle2"};
case 4: { _sitStyle = "HubSittingChairUB_idle2"};
case 5: { _sitStyle = "HubSittingChairUC_idle2"};
default { _sitStyle = "Crew"};
};
_dir = switch (typeOf _chair) do
{
case "Land_ChairPlastic_F": { 270 };
case "Land_CampingChair_V1_F": { 180 };
case "Land_CampingChair_V2_F": { 180 };
case "Land_ChairWood_F": { 180 };
case "Land_OfficeChair_01_F": { 180 };
case "Land_Bench_F": { 90 };
default { 90 };
};
_posATL = getPosATL _chair;
_obj = "UserTexture1m_F" createVehicle (_posATL);
_obj setPosATL (_posATL);
if ("bench" in (str _chair)) then
{
if ("bench_f" in (str _chair)) then
{
_unit setPosATL [getPosATL _chair select 0, getPosATL _chair select 1 , (getPosATL _chair select 2) - 2];
};
if ("bench_01_f" in (str _chair)) then
{
_unit setPosATL [getPosATL _chair select 0, getPosATL _chair select 1 , (getPosATL _chair select 2) - 0.85];
};
if ("bench_02_f" in (str _chair)) then
{
_unit setPosATL [getPosATL _chair select 0, getPosATL _chair select 1 , (getPosATL _chair select 2) - 0.85];
};
} else {
_unit setPosATL (_posATL);
};
_unit setDir ((direction _chair) - _dir);
_chair setVariable ["sitting", _unit, true];
[_unit,_sitStyle] remoteExecCall ["life_fnc_animSync",RCLIENT];
player setVariable ["sit", 1];
standup = _unit addAction ["<t color='#FF0000'>Se lever</t>","script\Sitting\standup.sqf"];
sleep 1;
while {(player getVariable "sit") == 1} do
{
if (!alive player) then
{
player setVariable ["sit", 0];
};
if (_unit getVariable ["restrained",false]) then
{
player setVariable ["sit", 0];
};
if(life_istazed) then
{
player setVariable ["sit", 0];
};
if (player distance (getPosATL _obj) > 2) then
{
player setVariable ["sit", 0];
[player,""] remoteExecCall ["life_fnc_animSync",RCLIENT];
player setVariable ["sit", 0];
hint "vous êtes trop loin de la chaise";
};
sleep 0.2;
};
_unit removeAction standup;
deleteVehicle _obj;
player setVariable ["sit", 0];
_chair setVariable ["sitting", nil, true];
_sitStyle = nil;
_dir = nil;[/CODE]
[CODE lang="cpp" title="standup.sqf"]#include "..\..\script_macros.hpp"
/*
File: standup.sqf
Author: John "Paratus" VanderZwet
Description:
Stand up from chair
*/
detach player;
[player,""] remoteExecCall ["life_fnc_animSync",RCLIENT];
//player removeAction standup;
_pos = getPosASL player;
_dir = getDir player;
player setPosASL [(_pos select 0) + (0.5 * sin(_dir)), (_pos select 1) + (0.5 * cos(_dir)), _pos select 2];
player setVariable ["sit", 0];[/CODE]
Une fois cela fait il reste quelle que petite ligne a ajouter dans votre mission
private["_object","_anim"];
_object = _this select 0;
_anim = _this select 1;
_object switchMove _anim;
};
[/CODE]
Voila les amis je pense ne rien avoir oublier, je vous souhaite bon courage pour vos serveur.
Amicalement
Teravince
Bricoleur Arma 3
Bonjour aujourd'hui je vous partage le scripts pour pouvoir s'assoir sur les chaises et bouger, j'informe que je n'est plus la source donc je remercie d'avance l'auteur du script testé sur Altis Life 5.0 fonctionne a 100%
- Allez dans votre mission et créer un dossier nommé
script
- Ensuite allez dans votre dossier et créer ce dossier
Sitting
. - Dans ce dossier on va créer deux fichiers qui ont pour nom :
sitdown.sqf
etstandup.sqf
[CODE lang="cpp" title="sitdown.sqf"]
#include "..\..\script_macros.hpp"
/*
File: sitdown.sqf
Author: Joachim and Victor for Prism Community
www.prism.ovh
Description:
Sit in a chair!
*/
private ["_chair","_unit","_randomSit","_sitStyle","_dir"];
_chair = _this select 0;
_unit = _this select 1;
_randomSit = floor(random 5);
if (_unit getVariable ["restrained",false]) exitWith {};
if (_unit getVariable ["isTazed",false]) exitWith {};
if ((player getVariable "sit") == 1) exitWith{hint "Vous êtes déjà assis !"};
if (vehicle _unit != _unit) exitWith { hint "Vous êtes déjà assis ici !" };
if (_unit distance _chair > 4) exitWith { hint "Vous êtes trop loin !" };
if (!isNull (_chair getVariable ["sitting", objNull])) exitWith { hint "Quelqu'un est déjà assis !"; };
if ("sun" in (str _chair)) exitWith { hint "Vous ne pouvez pas vous assoir sur cette objet !"; };
switch _randomSit do
{
case 0: { _sitStyle = "HubSittingChairA_idle1"};
case 1: { _sitStyle = "HubSittingChairB_idle3"};
case 2: { _sitStyle = "HubSittingChairC_idle3"};
case 3: { _sitStyle = "HubSittingChairUA_idle2"};
case 4: { _sitStyle = "HubSittingChairUB_idle2"};
case 5: { _sitStyle = "HubSittingChairUC_idle2"};
default { _sitStyle = "Crew"};
};
_dir = switch (typeOf _chair) do
{
case "Land_ChairPlastic_F": { 270 };
case "Land_CampingChair_V1_F": { 180 };
case "Land_CampingChair_V2_F": { 180 };
case "Land_ChairWood_F": { 180 };
case "Land_OfficeChair_01_F": { 180 };
case "Land_Bench_F": { 90 };
default { 90 };
};
_posATL = getPosATL _chair;
_obj = "UserTexture1m_F" createVehicle (_posATL);
_obj setPosATL (_posATL);
if ("bench" in (str _chair)) then
{
if ("bench_f" in (str _chair)) then
{
_unit setPosATL [getPosATL _chair select 0, getPosATL _chair select 1 , (getPosATL _chair select 2) - 2];
};
if ("bench_01_f" in (str _chair)) then
{
_unit setPosATL [getPosATL _chair select 0, getPosATL _chair select 1 , (getPosATL _chair select 2) - 0.85];
};
if ("bench_02_f" in (str _chair)) then
{
_unit setPosATL [getPosATL _chair select 0, getPosATL _chair select 1 , (getPosATL _chair select 2) - 0.85];
};
} else {
_unit setPosATL (_posATL);
};
_unit setDir ((direction _chair) - _dir);
_chair setVariable ["sitting", _unit, true];
[_unit,_sitStyle] remoteExecCall ["life_fnc_animSync",RCLIENT];
player setVariable ["sit", 1];
standup = _unit addAction ["<t color='#FF0000'>Se lever</t>","script\Sitting\standup.sqf"];
sleep 1;
while {(player getVariable "sit") == 1} do
{
if (!alive player) then
{
player setVariable ["sit", 0];
};
if (_unit getVariable ["restrained",false]) then
{
player setVariable ["sit", 0];
};
if(life_istazed) then
{
player setVariable ["sit", 0];
};
if (player distance (getPosATL _obj) > 2) then
{
player setVariable ["sit", 0];
[player,""] remoteExecCall ["life_fnc_animSync",RCLIENT];
player setVariable ["sit", 0];
hint "vous êtes trop loin de la chaise";
};
sleep 0.2;
};
_unit removeAction standup;
deleteVehicle _obj;
player setVariable ["sit", 0];
_chair setVariable ["sitting", nil, true];
_sitStyle = nil;
_dir = nil;[/CODE]
[CODE lang="cpp" title="standup.sqf"]#include "..\..\script_macros.hpp"
/*
File: standup.sqf
Author: John "Paratus" VanderZwet
Description:
Stand up from chair
*/
detach player;
[player,""] remoteExecCall ["life_fnc_animSync",RCLIENT];
//player removeAction standup;
_pos = getPosASL player;
_dir = getDir player;
player setPosASL [(_pos select 0) + (0.5 * sin(_dir)), (_pos select 1) + (0.5 * cos(_dir)), _pos select 2];
player setVariable ["sit", 0];[/CODE]
Une fois cela fait il reste quelle que petite ligne a ajouter dans votre mission
- Nous allons mettre en place le addaction pour pouvoir s'asseoir, allez dans le dossier core de votre mission et ouvrez le fichier
fn_setupActions.sqf
- Une fois le fichiers ouvert ajouter cette ligne de code dans
case civilian:
case west:
case independent:
C++:
life_actions pushBack (player addAction["<t color='#0099FF'>S'asseoir</t>",{[cursorObject,player] execVM "script\Sitting\sitdown.sqf"},true,1,true,true,"",' player distance cursorObject < 3 && {(("bench" in (str cursorObject)) || ("chair" in (str cursorObject)))} ']);
- Ensuite ouvrez le fichiers
core/init.sqf
à la racine de votre mission et ajouter ceci à la fin :
private["_object","_anim"];
_object = _this select 0;
_anim = _this select 1;
_object switchMove _anim;
};
[/CODE]
Voila les amis je pense ne rien avoir oublier, je vous souhaite bon courage pour vos serveur.
Amicalement
Teravince
Bricoleur Arma 3
Dernière édition par un modérateur: