Jump to content
!TS JORDAN

[Tutorial] Bounty Hunting Framework [Dialog, DB, Player Interaction] - Updated!

Recommended Posts

For some reason when i buy the license it dont give it to me ive done everything as you did, it seems like its not connecting to the database or something but the bounty table is there.      

This is what happens, I buy the license and then it tells me welcome to the bounty hunter club then when i click view bounty list it tells me you must be part of the bounty hunter club to view list database

there is no errors in Rpts any suggestions

Share this post


Link to post
Share on other sites

I am not sure why but I must have done something the licences. I have gone over the tutorial several times for Altis Life 5.0 and all of the sudden I am not able to purchase the bounty hunting licence. It does not take the money, and nothing is conflicting. If one of you guys could give me a hand that would be great.

---UPDATE---
I was retarded and put the bounty hunting functions in wrong spot (put at bottom of file and now works)

Edited by Gobstys
Solved my problem

Share this post


Link to post
Share on other sites
On 18/12/2016 at 3:38 AM, !TS JORDAN said:

 

I'm having problems in the Bounty Hunt script in Altis Life, the actions in the NPC do not work and when someone buys a license they do not register in the Data Base. Someone can help me?

Edited by FPSBrazil

Share this post


Link to post
Share on other sites

@FPSBrazil I am having the same issue and looking at the code when you buy the licences it doesn't actually give the license to the player hence why it is not updating to the database. I am about to post a fix if it worked just testing it now

 

Edited by The Corner Wookie

Share this post


Link to post
Share on other sites

Ok so this is what I have right now in the NPC, the start is a copy and paste from the iron license that I changed to bountyH the name of the license, next is all the same stuff, disclaimer this wont show that acceptance message but it will fix your database issues. @Deadlesszombie would this be ok for people who don't really want that acceptance message ? it worked for me and it removes the license from the scroll wheel list as soon as you have brought it

this addAction[format ["%1 ($%2)",localize (getText(missionConfigFile >> "Licenses" >> "bountyH" >> "displayName")), [(getNumber(missionConfigFile >> "Licenses" >> "bountyH" >> "price"))] call life_fnc_numberText],life_fnc_buyLicense,"bountyH",0,false,false,"",' !license_civ_bountyH && playerSide isEqualTo civilian ']; this addAction["<t color = '#D660D6'>Bounty Add</t>",life_fnc_bountyAddMenu,"",0,false,false,"",'']; this addAction["<t color = '#E6F402'>Bounty List</t>",life_fnc_bountyMenu,"",0,false,false,"",''];

  • Like 1

Share this post


Link to post
Share on other sites

a great script. I thought the script was going to be like a wannabe cop but either way great. Thanks @!TS JORDAN.


I did have problems because of 5.0 but fixed them.

fn_onPlayerKilled.sqf
fn_removelicenses.sqf  
and the init on the NPC 

other than that everything else worked
here are the sqfs and init for 5.0

fn_onPlayerKilled.sqf

#include "..\..\script_macros.hpp"
/*
    File: fn_onPlayerKilled.sqf
    Author: Bryan "Tonic" Boardwine
    Description:
    When the player dies collect various information about that player
    and pull up the death dialog / camera functionality.
*/
params [
    ["_unit",objNull,[objNull]],
    ["_killer",objNull,[objNull]]
];
disableSerialization;

if  !((vehicle _unit) isEqualTo _unit) then {
    UnAssignVehicle _unit;
    _unit action ["getOut", vehicle _unit];
    _unit setPosATL [(getPosATL _unit select 0) + 3, (getPosATL _unit select 1) + 1, 0];
};

//Set some vars
_unit setVariable ["Revive",true,true];
_unit setVariable ["name",profileName,true]; //Set my name so they can say my name.
_unit setVariable ["restrained",false,true];
_unit setVariable ["Escorting",false,true];
_unit setVariable ["transporting",false,true];
_unit setVariable ["playerSurrender",false,true];
_unit setVariable ["steam64id",(getPlayerUID player),true]; //Set the UID.

private _BountyPeeps = [];

{
	if (license_civ_bountyH) then {_BountyPeeps pushBack _x};
} forEach playableUnits;

//close the esc dialog
if (dialog) then {
    closeDialog 0;
};

//Setup our camera view
life_deathCamera  = "CAMERA" camCreate (getPosATL _unit);
showCinemaBorder true;
life_deathCamera cameraEffect ["Internal","Back"];
createDialog "DeathScreen";
life_deathCamera camSetTarget _unit;
life_deathCamera camSetRelPos [0,3.5,4.5];
life_deathCamera camSetFOV .5;
life_deathCamera camSetFocus [50,0];
life_deathCamera camCommit 0;

(findDisplay 7300) displaySetEventHandler ["KeyDown","if ((_this select 1) isEqualTo 1) then {true}"]; //Block the ESC menu

//Create a thread for something?
_unit spawn {
    private ["_maxTime","_RespawnBtn","_Timer"];
    disableSerialization;
    _RespawnBtn = ((findDisplay 7300) displayCtrl 7302);
    _Timer = ((findDisplay 7300) displayCtrl 7301);
    if (LIFE_SETTINGS(getNumber,"respawn_timer") < 5) then {
        _maxTime = time + 5;
    } else {
        _maxTime = time + LIFE_SETTINGS(getNumber,"respawn_timer");
    };
    _RespawnBtn ctrlEnable false;
    waitUntil {_Timer ctrlSetText format [localize "STR_Medic_Respawn",[(_maxTime - time),"MM:SS"] call BIS_fnc_secondsToString];
    round(_maxTime - time) <= 0 || isNull _this};
    _RespawnBtn ctrlEnable true;
    _Timer ctrlSetText localize "STR_Medic_Respawn_2";
};

_unit spawn {
    private ["_requestBtn","_requestTime"];
    disableSerialization;
    _requestBtn = ((findDisplay 7300) displayCtrl 7303);
    _requestBtn ctrlEnable false;
    _requestTime = time + 5;
    waitUntil {round(_requestTime - time) <= 0 || isNull _this};
    _requestBtn ctrlEnable true;
};

[] spawn life_fnc_deathScreen;

//Create a thread to follow with some what precision view of the corpse.
[_unit] spawn {
    private ["_unit"];
    _unit = _this select 0;
    waitUntil {if (speed _unit isEqualTo 0) exitWith {true}; life_deathCamera camSetTarget _unit; life_deathCamera camSetRelPos [0,3.5,4.5]; life_deathCamera camCommit 0;};
};

//Make the killer wanted
if (!isNull _killer && {!(_killer isEqualTo _unit)} && {!(side _killer isEqualTo west)} && {alive _killer}) then {
    if (vehicle _killer isKindOf "LandVehicle") then {
        if (life_HC_isActive) then {
            [getPlayerUID _killer,_killer getVariable ["realname",name _killer],"187V"] remoteExecCall ["HC_fnc_wantedAdd",HC_Life];
        } else {
            [getPlayerUID _killer,_killer getVariable ["realname",name _killer],"187V"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
        };

        //Get rid of this if you don't want automatic vehicle license removal.
        if (!local _killer) then {
            [2] remoteExecCall ["life_fnc_removeLicenses",_killer];
        };
    } else {
        if (life_HC_isActive) then {
            [getPlayerUID _killer,_killer getVariable ["realname",name _killer],"187"] remoteExecCall ["HC_fnc_wantedAdd",HC_Life];
        } else {
            [getPlayerUID _killer,_killer getVariable ["realname",name _killer],"187"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
        };

        if (!local _killer) then {
            [3] remoteExecCall ["life_fnc_removeLicenses",_killer];
        };
    };
};

life_save_gear = [player] call life_fnc_fetchDeadGear;

if (LIFE_SETTINGS(getNumber,"drop_weapons_onDeath") isEqualTo 0) then {
    _unit removeWeapon (primaryWeapon _unit);
    _unit removeWeapon (handgunWeapon _unit);
    _unit removeWeapon (secondaryWeapon _unit);
};

//Killed by cop stuff...
if (side _killer isEqualTo west && !(playerSide isEqualTo west)) then {
    life_copRecieve = _killer;
    //Did I rob the federal reserve?
    if (!life_use_atm && {CASH > 0}) then {
        [format [localize "STR_Cop_RobberDead",[CASH] call life_fnc_numberText]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
        CASH = 0;
    };
};

if (side _killer isEqualTo civilian && {_killer != _unit}) then {
	if (_killer in _BountyPeeps) then {
		life_bountyHunter = _killer;
	};
};

if (!isNull _killer) then {
    life_removeBounty = true;
};

if (!isNull _killer && {!(_killer isEqualTo _unit)}) then {
    life_removeWanted = true;
};

[_unit] call life_fnc_dropItems;

life_action_inUse = false;
life_hunger = 100;
life_thirst = 100;
life_carryWeight = 0;
CASH = 0;
life_is_alive = false;

[] call life_fnc_hudUpdate; //Get our HUD updated.
[player,life_settings_enableSidechannel,playerSide] remoteExecCall ["TON_fnc_manageSC",RSERV];

[0] call SOCK_fnc_updatePartial;
[3] call SOCK_fnc_updatePartial;
if (playerSide isEqualTo civilian) then {
    [4] call SOCK_fnc_updatePartial;
};

fn_removeLicenses.sqf

#include "..\..\script_macros.hpp"
/*
    File: fn_removeLicenses.sqf
    Author: Bryan "Tonic" Boardwine

    Description:
    Used for stripping certain licenses off of civilians as punishment.
*/
private "_state";
_state = param [0,1,[0]];

switch (_state) do {
    //Death while being wanted
    case 0: {
        missionNamespace setVariable [LICENSE_VARNAME("rebel","civ"),false];
        missionNamespace setVariable [LICENSE_VARNAME("driver","civ"),false];
        missionNamespace setVariable [LICENSE_VARNAME("heroin","civ"),false];
        missionNamespace setVariable [LICENSE_VARNAME("marijuana","civ"),false];
        missionNamespace setVariable [LICENSE_VARNAME("cocaine","civ"),false];
    };

    //Jail licenses
    case 1: {
        missionNamespace setVariable [LICENSE_VARNAME("gun","civ"),false];
        missionNamespace setVariable [LICENSE_VARNAME("driver","civ"),false];
        missionNamespace setVariable [LICENSE_VARNAME("rebel","civ"),false];
    };

    //Remove motor vehicle licenses
    case 2: {
        if (missionNamespace getVariable LICENSE_VARNAME("driver","civ") || missionNamespace getVariable LICENSE_VARNAME("pilot","civ") || missionNamespace getVariable LICENSE_VARNAME("trucking","civ") || missionNamespace getVariable LICENSE_VARNAME("boat","civ")) then {
            missionNamespace setVariable [LICENSE_VARNAME("pilot","civ"),false];
            missionNamespace setVariable [LICENSE_VARNAME("driver","civ"),false];
            missionNamespace setVariable [LICENSE_VARNAME("trucking","civ"),false];
            missionNamespace setVariable [LICENSE_VARNAME("boat","civ"),false];
            hint localize "STR_Civ_LicenseRemove_1";
        };
    };

    //Killing someone while owning a gun license
    case 3: {
        if (missionNamespace getVariable LICENSE_VARNAME("gun","civ")) then {
            missionNamespace setVariable [LICENSE_VARNAME("gun","civ"),false];
            hint localize "STR_Civ_LicenseRemove_2";
        };
    };

    //Adds the bountyH license to civs
    case 100: {
  			missionNamespace setVariable [LICENSE_VARNAME("bountyH","civ"),true];
  	};
};

NPC init:

init="this addAction[format[""%1 ($%2)"",localize (getText(missionConfigFile >> ""Licenses"" >> ""bountyH"" >> ""displayName"")), [(getNumber(missionConfigFile >> ""Licenses"" >> ""bountyH"" >> ""price""))] call life_fnc_numberText],life_fnc_buyLicense,""bountyH"",0,false,false,"""",' !license_civ_bountyH && playerSide isEqualTo civilian ']; this addAction[""<t color = '#D660D6'>Bounty Add</t>"",life_fnc_bountyAddMenu,"""",0,FALSE,FALSE,"""",'']; this addAction[""<t color = '#E6F402'>Bounty List</t>"",life_fnc_bountyMenu,"""",0,FALSE,FALSE,"""",''];";

**extra**  for new people developing. 

if you would like to add a bounty list button to your y menu. Like this 

1c40abad968667a5232135342d4169b7.png.af4de77b2740291596a481a69a9f201a.png

here it is.

Alits_Life.Alits\dialog\player_inv.hpp under 

        class ButtonAdminMenu: Life_RscButtonMenu {
            idc = 2021;
            text = "$STR_PM_AdminMenu";
            onButtonClick = "closeDialog 0; createDialog ""life_admin_menu"";";
            x = 0.1 + (6.25 / 40) + (1 / 250 / (safezoneW / safezoneH));
            y = 0.805;
            w = (6.25 / 40);
            h = (1 / 25);
        };

add 

        class ButtonBountyList: Life_RscButtonMenu {
            idc = 2022;
            text = "$STR_PM_BountyList";
            onButtonClick = "[] call life_fnc_bountyMenu";
            x = 0.1 + (6.25 / 19.8) + (1 / 250 / (safezoneW / safezoneH));
            y = 0.805;
            w = (6.25 / 40);
            h = (1 / 25);
        };

Alits_Life.Alits\stringtable.xml under

       <Key ID="STR_PM_AdminMenu">
           <Original>Admin Menu</Original>
           <Czech>Nabídka admin</Czech>
           <Spanish>Menu Admin</Spanish>
           <Russian></Russian>
           <German>Admin Menü</German>
           <French>Menu Admin</French>
           <Italian>Menu Admin</Italian>
           <Portuguese>Menu Admin</Portuguese>
           <Polish>Admin Menu</Polish>
       </Key>

add 

       <Key ID="STR_PM_BountyList">
           <Original>BountyList</Original>
       </Key>

then you're done. :)

Edited by Daniel Stewart

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×