• [Tutoriel] Ajouter une paye selon le compte en banque (cf Arma2 Island Life)


    Salut à vous !

    Je vous fait ce petit tutoriel pour ajouter un nouveau payement sur votre serveur, j’ai eux l’idée grace Arma 2 Island Life ! :)

    Ce système de payement est plutôt simple, sur Arma 2 Island Life, toute les 1heures par exemple vous aviez le droit à un payement bonus de 5% de votre compte en banque.

    Je l’ai refait sur Altis Life, toute les 2 heures (définisable) vous aurez le droit à 2% de votre compte en banque en plus de la paye de base

    C’est simple à installé, juste un fichier à remplacer et un petit truc à ajouter au stringtable.xml et au configuration.sqf alors on y va !

    Fichier à remplacer :

    \Altis_Life.Altis\core\fsm\client.fsm (téléchargeable et code) lien : http://www.mediafire.com/download/17yqoihp6w6hd0e/client.fsm

    /*%FSM<COMPILE "scriptedFSM.cfg, Life Client FSM">*/  
    /*%FSM<HEAD>*/  
    /*  
    item0[] = {"Main_Init",0,250,18.711040,-205.790665,108.711090,-155.790649,0.000000,"Main Init"};  
    item1[] = {"true",8,218,18.156960,-89.336899,108.156998,-39.336849,0.000000,"true"};  
    item2[] = {"Split",2,250,17.248318,4.513809,107.248383,54.513809,0.000000,"Split"};  
    item3[] = {"",7,210,-167.285812,295.445374,-159.285797,303.445374,0.000000,""};  
    item4[] = {"",7,210,-161.246521,33.052059,-153.246521,41.052063,0.000000,""};  
    item5[] = {"Time_to_pay_",4,218,-38.539185,92.835747,51.460873,142.835785,0.000000,"Time to pay?"};  
    item6[] = {"Pay_me_",2,250,-36.888039,178.612518,53.111916,228.612396,0.000000,"Pay me!"};  
    item7[] = {"true",8,218,-39.517349,277.205292,50.482491,327.205322,0.000000,"true"};  
    item8[] = {"Pay_me__1",2,250,86.801315,176.118652,176.801285,226.118652,0.000000,"Pay me!"};  
    item9[] = {"Time_to_pay__",4,218,88.693298,94.166710,178.693115,144.166763,0.000000,"Time to pay ?"};  
    item10[] = {"Split_1",2,250,314.949219,-123.295013,404.949249,-73.294960,0.000000,"Split"};  
    item11[] = {"",7,210,313.046356,303.019989,321.046417,311.020111,0.000000,""};  
    item12[] = {"",7,210,315.451294,31.540565,323.451294,39.540569,0.000000,""};  
    item13[] = {"true",8,218,86.455643,277.511017,176.455414,327.511047,0.000000,"true"};  
    link0[] = {0,1};  
    link1[] = {1,2};  
    link2[] = {2,5};  
    link3[] = {2,9};  
    link4[] = {3,4};  
    link5[] = {4,2};  
    link6[] = {5,6};  
    link7[] = {6,7};  
    link8[] = {7,3};  
    link9[] = {8,13};  
    link10[] = {9,8};  
    link11[] = {11,12};  
    link12[] = {12,2};  
    link13[] = {13,11};  
    globals[] = {0.000000,0,0,0,0,640,480,1,38,6316128,1,-293.712708,763.004150,407.944977,-255.342819,1163,730,1};  
    window[] = {2,-1,-1,-32000,-32000,844,26,1466,26,3,1181};  
    *//*%FSM</HEAD>*/  
    class FSM  
    {  
            fsmName = "Life Client FSM";  
            class States  
            {  
                    /*%FSM<STATE "Main_Init">*/  
                    class Main_Init  
                    {  
                            name = "Main_Init";  
                            itemno = 0;  
                            init = /*%FSM<STATEINIT""">*/"private[""_lastcheck"",""_food"",""_water"",""_lastsync"",""_lastcheck2""];" \n  
                             "_lastcheck = time;" \n  
                             "_food = time;" \n  
                             "_water = time;" \n  
                             "_lastsync = time;" \n  
                             "_lastcheck2 = time;"/*%FSM</STATEINIT""">*/;  
                            precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;  
                            class Links  
                            {  
                                    /*%FSM<LINK "true">*/  
                                    class true  
                                    {  
                                            itemno = 1;  
                                            priority = 0.000000;  
                                            to="Split";  
                                            precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;  
                                            condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;  
                                            action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;  
                                    };  
                                    /*%FSM</LINK>*/  
                            };  
                    };  
                    /*%FSM</STATE>*/  
                    /*%FSM<STATE "Split">*/  
                    class Split  
                    {  
                            name = "Split";  
                            itemno = 2;  
                            init = /*%FSM<STATEINIT""">*/"systemChat format[localize ""STR_FSM_Paycheck"",(call life_paycheck_period)];"/*%FSM</STATEINIT""">*/;  
                            precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;  
                            class Links  
                            {  
                                    /*%FSM<LINK "Time_to_pay__">*/  
                                    class Time_to_pay__  
                                    {  
                                            itemno = 9;  
                                            priority = 0.000000;  
                                            to="Pay_me__1";  
                                            precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;  
                                            condition=/*%FSM<CONDITION""">*/"(time - _lastcheck2) > ((call life_paycheck_periodbonus) * 60)"/*%FSM</CONDITION""">*/;  
                                            action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;  
                                    };  
                                    /*%FSM</LINK>*/  
                                    /*%FSM<LINK "Time_to_pay_">*/  
                                    class Time_to_pay_  
                                    {  
                                            itemno = 5;  
                                            priority = 0.000000;  
                                            to="Pay_me_";  
                                            precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;  
                                            condition=/*%FSM<CONDITION""">*/"(time - _lastcheck) > ((call life_paycheck_period) * 60)"/*%FSM</CONDITION""">*/;  
                                            action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;  
                                    };  
                                    /*%FSM</LINK>*/  
                            };  
                    };  
                    /*%FSM</STATE>*/  
                    /*%FSM<STATE "Pay_me_">*/  
                    class Pay_me_  
                    {  
                            name = "Pay_me_";  
                            itemno = 6;  
                            init = /*%FSM<STATEINIT""">*/"if(!alive player) then" \n  
                             "{" \n  
                             "    systemChat localize ""STR_FSM_MissedPay"";" \n  
                             "}" \n  
                             "    else" \n  
                             "{" \n  
                             "    if(player distance (getMarkerPos ""fed_reserve"") < 120 && playerSide == west) then" \n  
                             "    {" \n  
                             "        systemChat format[localize ""STR_FSM_ReceivedPay"",[(call life_paycheck) + 1500] call life_fnc_numberText];" \n  
                             "        life_atmcash = life_atmcash + (call life_paycheck) + 1500;" \n  
                             "    }" \n  
                             "        else" \n  
                             "    {" \n  
                             "        life_atmcash = life_atmcash + (call life_paycheck);" \n  
                             "        systemChat format[localize ""STR_FSM_ReceivedPay"",[(call life_paycheck)] call life_fnc_numberText];" \n  
                             "    };" \n  
                             "};" \n  
                             "" \n  
                             "_lastcheck = time;"/*%FSM</STATEINIT""">*/;  
                            precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;  
                            class Links  
                            {  
                                    /*%FSM<LINK "true">*/  
                                    class true  
                                    {  
                                            itemno = 7;  
                                            priority = 0.000000;  
                                            to="Split";  
                                            precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;  
                                            condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;  
                                            action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;  
                                    };  
                                    /*%FSM</LINK>*/  
                            };  
                    };  
                    /*%FSM</STATE>*/  
                    /*%FSM<STATE "Pay_me__1">*/  
                    class Pay_me__1  
                    {  
                            name = "Pay_me__1";  
                            itemno = 8;  
                            init = /*%FSM<STATEINIT""">*/"if(player distance (getMarkerPos ""fed_reserve"") < 120 && playerSide == west) then" \n  
                             "{" \n  
                             "    life_atmcash = life_atmcash + ((life_atmcash)/100 *2);" \n  
                             "    systemChat format[localize ""STR_FSM_ReceivedPay2""];" \n  
                             "}" \n  
                             "else" \n  
                             "{" \n  
                             "    life_atmcash = life_atmcash + ((life_atmcash)/100 *2);" \n  
                             "    systemChat format[localize ""STR_FSM_ReceivedPay2""];" \n  
                             "};" \n  
                             "" \n  
                             "_lastcheck2 = time"/*%FSM</STATEINIT""">*/;  
                            precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;  
                            class Links  
                            {  
                                    /*%FSM<LINK "true">*/  
                                    class true  
                                    {  
                                            itemno = 13;  
                                            priority = 0.000000;  
                                            to="Split";  
                                            precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;  
                                            condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;  
                                            action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;  
                                    };  
                                    /*%FSM</LINK>*/  
                            };  
                    };  
                    /*%FSM</STATE>*/  
                    /*%FSM<STATE "Split_1">*/  
                    class Split_1  
                    {  
                            name = "Split_1";  
                            itemno = 10;  
                            init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;  
                            precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;  
                            class Links  
                            {  
                            };  
                    };  
                    /*%FSM</STATE>*/  
            };  
            initState="Main_Init";  
            finalStates[] =  
            {  
            };  
    };  
    /*%FSM</COMPILE>*/```
    
    \Altis_Life.Altis\core\configuration.sqf :  
    
    Ajouter :  
    
    

    CONST(life_paycheck_periodbonus,120); //120 = 2h```

    Après :

    __CONST__(life_paycheck_period,5); //Five minutes```
    
    \Altis_Life.Altis\Stringtable.xml :  
    
    Ajouter :  
    
    

    <Key ID=“STR_FSM_ReceivedPay2”>
                <Original>You have received a paycheck of $%1</Original>
                <English>You have received a paycheck of $%1</English>
                <German>Du hast deinen Gehaltscheck in Höhe von $%1 erhalten</German>
                <French>Votre investissement vous à rapporter 2 pourcent du total de votre Compte en Banque</French>
                <Italian>Hai ricevuto uno stipendio di €%1</Italian>
                <Portuguese>Você recebeu seu pagamento de R$%1</Portuguese>
            </Key>```

    Après :

            <Key ID="STR_FSM_ReceivedPay">  
                <Original>You have received a paycheck of $%1</Original>  
                <English>You have received a paycheck of $%1</English>  
                <German>Du hast deinen Gehaltscheck in Höhe von $%1 erhalten</German>  
                <French>Vous avez reçu un salaire de $%1</French>  
                <Italian>Hai ricevuto uno stipendio di €%1</Italian>  
                <Portuguese>Você recebeu seu pagamento de R$%1</Portuguese>  
            </Key>```
    
    En espérant que cela vous plaisent, pense à mettre un j'aime si c'est le cas ;)
  • Hum ! Vraiment pas mal !

    Merci !

  • Salut bon tuto :)

  • ah ouais ca c’est tip top :lol: merci

  • les _CONST …. on doit les mettre a la fin  ?

  • @zeleph42 Relis bien

Messages 7Vues 1301