Problème avec le Chargement d'un Spawn avec SYNC DATA


#1

Bonjour,

j’ai voulu mettre un systeme pour que dès qu’il y a un reboot ou autre que l’on puisse respawn à l’endroit ou l’on étais mais quand l’on fait charger dans le Menu Spawn on spawn dans la petite île… Je suis en 3.1.3 lien du tutoriel: http://www.altisliferpg.com/topic/2753-tutorial-save-position-in-real-time/?hl=phone#entry17232

Voici ce que j’ai fait:

ETAPE 1: j’ai créer un dossier statSave dans mon MPMISSION (pas dans core et etc dans le MPMISSION seulement)

Screen:

http://hpics.li/185623d

ETAPE 2: j’ai ajoutés mes fichiers voici leurs codes:

Fichier loadAccount.sqf

//Chargement de la session active

[“positionPlayer”] call fn_LoadStat;
[“directionPlayer”] call fn_LoadStat;
[“inventoryPlayer”] call fn_LoadStat;
[“gogglesPlayer”] call fn_LoadStat;
[“vestPlayer”] call fn_LoadStat;
[“outfit”] call fn_LoadStat;
[“hat”] call fn_LoadStat;
[“backpackPlayer”] call fn_LoadStat;
[“weaponsPlayer”] call fn_LoadStat;
[“magazinesPlayer”] call fn_LoadStat;
[“itemsPlayer”] call fn_LoadStat;

//===========================================================================

//FIN
statsLoaded = 1;
player globalChat format [“Votre position est chargée %1.”,name player];

Fichier saveFuncs.sqf

fn_SaveStat =

{
_varName = _this select 0;
_varValue = _this select 1;
profileNameSpace setVariable [_varName + serverID,_varValue];
};

fn_LoadStat =
{
_varName = _this select 0;
_varValue = profileNameSpace getVariable (_varName + serverID);
if(isNil “_varValue”) exitWith {};
[_varName,_varValue] call fn_SetStat;
};

//===========================================================================
//VARIABLES
specialVarLoads =
[
“weaponsPlayer”,
“magazinesPlayer”,
“gogglesPlayer”,
“vestPlayer”,
“outfit”,
“hat”,
“backpackPlayer”,
“positionPlayer”,
“directionPlayer”
];

//FONCTIONS
fn_SetStat =
{
_varName = _this select 0;
_varValue = _this select 1;
if(isNil ‘_varValue’) exitWith {};
if(_varName in specialVarLoads) then
{
if(_varName == ‘positionPlayer’) then {player setPosATL _varValue};
if(_varName == ‘directionPlayer’) then {player setDir _varValue};
if(_varName == ‘gogglesPlayer’) then {removeGoggles player; player addGoggles _varValue;};
if(_varName == ‘vestPlayer’) then {removeVest player; player addVest _varValue;};
if(_varName == ‘outfit’) then {removeUniform player; player addUniform _varValue;};
if(_varName == ‘hat’) then {removeHeadGear player; player addHeadGear _varValue;};
if(_varName == ‘weaponsPlayer’) then {if(count _varValue > 0) then {removeAllWeapons player; {player addWeapon _x} forEach _varValue;};};
if(_varName == ‘magazinesPlayer’) then {if(count _varValue > 0) then {{player removeMagazine _x} forEach (magazines player); {player addMagazine _x} forEach _varValue; reload player};};
if(_varName == ‘backpackPlayer’) then {player addBackpack _varValue;};
}
else
{
call compile format ["%1 = %2",_varName,_varValue];
};
};

//FIN

Fichier: saveLoop.sqf

//Sauvegarde stats

waitUntil {!isNil “statsLoaded”};
while {true} do
{
sleep 1;

[“positionPlayer”, getPosATL player] call fn_SaveStat;
[“directionPlayer”, direction player] call fn_SaveStat;
[“gogglesPlayer”, goggles player] call fn_SaveStat;
[“vestPlayer”, vest player] call fn_SaveStat;
[“outfit”, uniform player] call fn_SaveStat;
[“hat”, headGear player] call fn_SaveStat;
[“weaponsPlayer”, weapons player] call fn_SaveStat;
[“magazinesPlayer”, magazines player] call fn_SaveStat;
[“itemsPlayer”, items player] call fn_SaveStat;
[“backpackPlayer”, backpack player] call fn_SaveStat;
};

ETAPE 3: J’ai modifier mon Init.sqf qui se trouve dans le MPMISSION

Fichier Init.sqf

enableSaving [false, false];

X_Server = false;
X_Client = false;
X_JIP = false;
StartProgress = false;

if(!isDedicated) then { X_Client = true;};
/*
if(isNull player) then
{
if(!X_JIP && !isServer) then
{
[] spawn (compile PreprocessFileLineNumbers “core\jip.sqf”);
};
X_JIP = true;
};
*/
enableSaving[false,false];

life_versionInfo = “Altis Life RPG v3.1.2”;
/*
if(X_Client) then
{
[] execVM “core\init.sqf”;
};
*/
[] execVM “briefing.sqf”; //Load Briefing
[] execVM “KRON_Strings.sqf”;

if(isDedicated && isNil(“life_market_prices”)) then
{
[] call life_fnc_marketconfiguration;
diag_log “Market prices generated!”;

“life_market_prices” addPublicVariableEventHandler
{
diag_log format[“Market prices updated! %1”, _this select 1];
};

//Start server fsm
[] execFSM “core\fsm\server.fsm”;
diag_log “Server FSM executed”;
};

if(!StartProgress) then
{
[8,true,true,12] execFSM “core\fsm\timeModule.fsm”;
//[8,true,false] execFSM “core\fsm\core_time.fsm”;
};
StartProgress = true;
onPlayerDisconnected { [_id, _name, _uid] call compile preProcessFileLineNumbers “core\functions\fn_onPlayerDisconnect.sqf” };
waitUntil {time > 0};

execVM “statSave\saveFuncs.sqf”;
waitUntil {!isNil “saveFuncsLoaded”};

if(isServer) then
{
_serverHasID = profileNameSpace getVariable [“ss_ServerID”,nil];
if(isNil “_serverHasID”) then
{
_serverID = str(round((random(100000)) + random 10000));
profileNameSpace setVariable [“SS_ServerID”,_serverID];
};
serverID = profileNameSpace getVariable “ss_ServerID”;
publicVariable “serverID”;
};

waitUntil {!isNil “serverID”};

if(!isDedicated) then
{
execVM “statSave\loadAccount.sqf”;
execVM “statSave\saveLoop.sqf”;
};
//Fin de code

ETAPE 4: j’ai modifier mon fichier SpawnSelection.hpp dans dialog

Fichier SpawnSelection.hpp

class life_spawn_selection

{
idd = 38500;
movingEnabled = false;
enableSimulation = true;

class controlsBackground
{
class life_RscTitleBackground : Life_RscText
{
colorBackground[] = {"(profilenamespace getvariable [‘GUI_BCG_RGB_R’,0.3843])", “(profilenamespace getvariable [‘GUI_BCG_RGB_G’,0.7019])”, “(profilenamespace getvariable [‘GUI_BCG_RGB_B’,0.8862])”, “(profilenamespace getvariable [‘GUI_BCG_RGB_A’,0.7])”};
idc = -1;
x = 0.1; y = 0.2;
w = 0.8; h = (1 / 25);
};

class MainBackground : Life_RscText
{
colorBackground[] = {0,0,0,0.7};
idc = -1;
x = 0.1; y = 0.2 + (11 / 250);
w = 0.8; h = 0.6 - (22 / 250);
};

class Title : Life_RscTitle
{
colorBackground[] = {0,0,0,0};
idc = -1;
text = “$STR_Spawn_Title”;
x = 0.1; y = 0.2;
w = 0.8; h = (1 / 25);
};

class SpawnPointTitle : Title
{
idc = 38501;
style = 1;
text = “”;
};

class MapView : Life_RscMapControl
{
idc = 38502;
x = 0.328; y = 0.26;
w = 0.56;
h = 0.56 - (22 / 250);
maxSatelliteAlpha = 0.75;//0.75;
alphaFadeStartScale = 1.15;//0.15;
alphaFadeEndScale = 1.29;//0.29;
};
};

class controls
{
class SpawnPointList: Life_RscListNBox
{
idc = 38510;
text = “”;
sizeEx = 0.041;
coloumns[] = {0,0,0.9};
drawSideArrows = false;
idcLeft = -1;
idcRight = -1;
rowHeight = 0.050;
x = 0.105; y = 0.26;
w = (8.8 / 40);
h = (10 / 25);
onLBSelChanged = “_this call life_fnc_spawnPointSelected;”;
};

class cancelspawnButton : Life_RscButtonMenu
{
idc = -1;
colorBackground[] = {"(profilenamespace getvariable [‘GUI_BCG_RGB_R’,0.3843])", “(profilenamespace getvariable [‘GUI_BCG_RGB_G’,0.7019])”, “(profilenamespace getvariable [‘GUI_BCG_RGB_B’,0.8862])”, 0.5};
text = “CHARGER”;
onButtonClick = “closeDialog 0;”;
x = 0.11;
y = 0.69 - (15 / 250);
w = (8 / 40);
h = (1 / 25);
};

class spawnButton : Life_RscButtonMenu
{
idc = -1;
colorBackground[] = {"(profilenamespace getvariable [‘GUI_BCG_RGB_R’,0.3843])", “(profilenamespace getvariable [‘GUI_BCG_RGB_G’,0.7019])”, “(profilenamespace getvariable [‘GUI_BCG_RGB_B’,0.8862])”, 0.5};
text = “$STR_Spawn_Spawn”;
onButtonClick = “[] call life_fnc_spawnConfirm”;
x = 0.11; y = 0.69;
w = (8 / 40);
h = (1 / 25);
};
};
};

Voilà.

Merci pour l’aide en avance.


#2

Comme il le dit dans son petit tutoriel, les fichiers que tu crées dans StatSave/ ont peut-être besoin d’être répertorié dans le functions.h

ce qui donnerait : class loadAccount {}; etc… à toi de voir ou placer ces class dans le Functions.h :wink:

( IL N’A PAS TESTE SON TUTORIEL DONC SI IL NE MARCHE PAS C’EST NORMAL. )

EDIT: tous les avis, et messages suivant sont totalement négatif sur ce script… ils disent même qu’il manque juste le tutoriel pour sauvegarder les positions dans la base de donnée, donc à mon avis retire ce script foireux


#3

HoGamer +1