How to make trader for you server

Results 1 to 4 of 4
  1. #1
    Member MikeJones is offline
    MemberRank
    May 2016 Join Date
    59Posts

    How to make trader for you server

    Open up your characters_data.pbo add this code
    u can change the item here to

    class TraderCars1: SurvivorPartsMaleDean
    {
    class UserActions
    {
    class OpenShop: DefaultAction
    {
    displayNameDefault="Trade";
    displayName="Trade";
    radius=3;
    showWindow=1;
    condition="alive this";
    statement="(owner _person) spawnForClient { shitiwannabuy = []; createdialog 'H8ER_dialog'; lbAdd [1500, 'SUV_TK_EP1']; lbAdd [1500, 'HMMWV']; lbAdd [1500, 'Ural_CDF']; lbAdd [1500, 'hilux1_civil_1_open']; buttonSetAction [1600,'lbAdd [1501, lbtext [1500, (lbCurSel 1500)]]; shitiwannabuy = shitiwannabuy + [lbtext [1500, (lbCurSel 1500)]]; ']; buttonSetAction [2400,'for ''_i'' from 0 to count shitiwannabuy do { trader_buy = [player,shitiwannabuy select 1 * _i];publicVariableServer ''trader_buy''; };']; buttonSetAction [1601,'shitiwannabuy = shitiwannabuy - [lbtext [1501, (lbCurSel 1501)]]; lbDelete [1501,(lbCurSel 1501)];'];};";
    };
    };
    };


    Open up your Ui.pbo add this code

    class H8ER_dialog
    {
    idd=8629;
    movingenable="false";
    class controls
    {
    class text_282: RscBackgroundGUI
    {
    idc=1800;
    backgroundType=0;
    x="0.0101242 * safezoneW + safezoneX";
    y="0.0378374 * safezoneH + safezoneY";
    w="0.340335 * safezoneW";
    h="0.583205 * safezoneH";
    colorText[]={0,0,0,0.80000001};
    colorBackground[]={0,0,0,0.80000001};
    colorActive[]={0,0,0,0.80000001};
    };
    class text_6: RscFrame
    {
    idc=1800;
    x="0.0101242 * safezoneW + safezoneX";
    y="0.0378374 * safezoneH + safezoneY";
    w="0.340335 * safezoneW";
    h="0.583205 * safezoneH";
    colorText[]={1,0.2,0.2,1};
    colorBackground[]={1,0.2,0.2,1};
    colorActive[]={1,0.2,0.2,1};
    };
    class text_1: RscListBox
    {
    idc=1500;
    x="0.0163117 * safezoneW + safezoneX";
    y="0.0972587 * safezoneH + safezoneY";
    w="0.144385 * safezoneW";
    h="0.374131 * safezoneH";
    };
    class text_3: RscButton
    {
    idc=2400;
    text="BUY";
    x="0.164822 * safezoneW + safezoneX";
    y="0.257915 * safezoneH + safezoneY";
    w="0.025783 * safezoneW";
    h="0.0220077 * safezoneH";
    };
    class text_2: RscListBox
    {
    idc=1501;
    x="0.200918 * safezoneW + safezoneX";
    y="0.0994582 * safezoneH + safezoneY";
    w="0.144385 * safezoneW";
    h="0.374131 * safezoneH";
    };
    class text_7: RscButton
    {
    idc=1600;
    text=">";
    x="0.169978 * safezoneW + safezoneX";
    y="0.147876 * safezoneH + safezoneY";
    w="0.0154698 * safezoneW";
    h="0.0330116 * safezoneH";
    };
    class text_8: RscButton
    {
    idc=1601;
    text="<";
    x="0.169978 * safezoneW + safezoneX";
    y="0.202896 * safezoneH + safezoneY";
    w="0.0154698 * safezoneW";
    h="0.0330116 * safezoneH";
    };
    class text_5: RscText
    {
    idc=1000;
    text="Trader";
    x="0.013218 * safezoneW + safezoneX";
    y="0.0312354 * safezoneH + safezoneY";
    w="0.0515659 * safezoneW";
    h="0.0550193 * safezoneH";
    colorText[]={0.2,0.5,0,1};
    };
    };
    };







    go to your server side server\scripts\initEvents.sqf like this root 420GAMING
    and add this

    "trader_buy" addPublicVariableEventHandler
    {
    private["_agent"];
    _array = _this select 1;
    _agent = _array select 0;
    _name = _array select 1;
    _itemsdeleted = 0;
    _price = 99;



    if (_name == "M_svd_10Rnd") then
    {
    _price = 2;
    };
    //you can add more item by copying ^^that code
    //you dont need to use Tool_GoldBar10oz pick a item and change it
    {
    if (typeof _x == "Tool_GoldBar10oz") then
    {
    _itemsdeleted = _itemsdeleted + 1;
    if (_itemsdeleted == _price) then
    {

    [_price,_agent] call removemygold;


    _pos = getpos _agent;
    if (([4060.3438,10818.672,0] distance getpos _agent) <= 10) then
    {
    _pos = [4085,10812,0];
    _dir = 29;
    };



    if (([2308.12, 9635.57, 0] distance getpos _agent) <= 10) then
    { //if you buy i item here ^^
    //it will be spawned in this location within ten meters here
    _pos = [2317,9593,0];
    _dir = 55;
    };


    _veh = _name createvehicle _pos;
    _veh setpos _pos;
    _veh setdir _dir;
    };
    };



    } forEach itemsInInventory _agent;

    _didihaveit = false;

    if (_itemsdeleted == _price) then
    {
    _didihaveit = true;
    };

    if (_didihaveit) then
    {
    [_agent,"You bought a " + _name + "","ColorFriendly"] call fnc_playerMessage;
    }else
    {
    [_agent,"You need " + str _price + " GoldBar10oz to buy a " + _name,"ColorFriendly"] call fnc_playerMessage;
    };

    };


  2. #2
    Newbie KADET21 is offline
    MemberRank
    Sep 2016 Join Date
    3Posts

    Re: How to make trader for you server

    All I do on the instructions, but no one specified coordinates. Maybe something I do not? Izvenyayus for bad English.

  3. #3
    Registered kuaktus is offline
    MemberRank
    Feb 2016 Join Date
    23Posts

    Re: How to make trader for you server

    not worked

  4. #4
    Registered lonewulf is offline
    MemberRank
    Dec 2017 Join Date
    14Posts

    Re: How to make trader for you server

    i assume this is the part where you add cords im not sure

    _pos = getpos _agent;
    if (([4060.3438,10818.672,0] distance getpos _agent) <= 10) then
    {
    _pos = [4085,10812,0];
    _dir = 29;
    };



Advertisement