Skip to content

Instantly share code, notes, and snippets.

@AgentRev
Last active January 21, 2020 05:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AgentRev/1e328573fda045614ea21bfd827f5f0b to your computer and use it in GitHub Desktop.
Save AgentRev/1e328573fda045614ea21bfd827f5f0b to your computer and use it in GitHub Desktop.
Improved High Value Target script
// @file Version: 2.0
// @file Name: HvT.sqf
// @file Author: Cael817, CRE4MPIE, LouD, AgentRev
#define HVT_AMOUNT 50000 // how much a player needs to be carrying to become a HvT
#define HINT_DELAY 60 // number of seconds between each HvT reminder hint
#define MARKER_REFRESH 30 // number of seconds between each HvT marker refresh
if (isServer) then
{
addMissionEventHandler ["PlayerDisconnected", { deleteMarker ("HvT_" + (_this select 1)) }];
};
if (!hasInterface) exitWith {};
waitUntil {sleep 0.1; alive player && !(player getVariable ["playerSpawning", true])};
_lastHint = -HINT_DELAY;
_lastMarker = -MARKER_REFRESH;
_markerTarget = objNull;
_hasMarker = false;
while {true} do
{
_isHvT = (player getVariable ["cmoney",0] >= HVT_AMOUNT && alive player && !(player getVariable ["playerSpawning", true]));
if (_isHvT && diag_tickTime - _lastHint >= HINT_DELAY) then
{
hint parseText ([
"<t color='#FF0000' size='1.5' align='center'>High Value VIP</t>",
//profileName,
"<t color='#FFFFFF' shadow='1' shadowColor='#000000' align='center'>Someone has spotted you carrying a large sum of money and has marked your location on the map!</t>"
] joinString "<br/>");
_lastHint = diag_tickTime;
//playSound "Topic_Done";
};
if (diag_tickTime - _lastMarker >= MARKER_REFRESH || (!alive _markerTarget && _hasMarker)) then
{
_markerName = "HvT_" + getPlayerUID player;
if (_hasMarker) then
{
deleteMarker _markerName;
_hasMarker = false;
};
if (_isHvT) then
{
createMarker [_markerName, getPosWorld player];
_markerName setMarkerColor "ColorRed";
_markerName setMarkerText format [" VIP: %1 ($%2k)", profileName, (floor ((player getVariable ["cmoney",0]) / 1000)) call fn_numToStr];
_markerName setMarkerSize [0.75, 0.75];
_markerName setMarkerShape "ICON";
_markerName setMarkerType "mil_warning";
_lastMarker = diag_tickTime;
_markerTarget = player;
_hasMarker = true;
playSound "Topic_Done";
};
};
sleep 0.5;
};
@lvlagic
Copy link

lvlagic commented Apr 15, 2016

Would there be any chance of you streamlining the High Value Drugsrunner script (that i think LouD did) in the same way that you did for the HvT script please?? It was pretty much a clone of the HvT script but using drugs instead of money. I have had several goes at it but i cant get it to fly as i am a retarded n00b. It currently contains your favourite line of code he he: for "_i" from 0 to 1 step 0 do

//  @file Version: 1.0
//  @file Name: HvD.sqf
//  @file Author: Based on HvT.sqf by Cael817, CRE4MPIE. Rewrite by LouD.
//  @file Info:

if (isDedicated) exitWith {};
waitUntil {!isNull player};
waitUntil {!isNil "playerSpawning" && {!playerSpawning}};

for "_i" from 0 to 1 step 0 do 
{
    _lsdInv = "lsd" call mf_inventory_get; _lsd = _lsdInv select 1;
    _marInv = "marijuana" call mf_inventory_get; _mar = _marInv select 1;
    _cocInv = "cocaine" call mf_inventory_get; _coc = _cocInv select 1;
    _herInv = "heroin" call mf_inventory_get; _her = _herInv select 1;

    "lsd" call mf_inventory_get;

    if (isNil "createDrugsMarker" && _lsd > 3 || isNil "createDrugsMarker" && _mar > 3 || isNil "createDrugsMarker" && _coc > 2 || isNil "createDrugsMarker" && _her > 2) then
        {
            _title  = "<t color='#ff0000' size='1.2' align='center'>Drug Dealer! </t><br />";
            _name = format ["- %1 -<br />",name player];     
            _text = "<t color='#FFFFFF' shadow='1' shadowColor='#000000' align='center'>You're A Known Drug Dealer. <br />The Feds Are On To You Dude!</t><br />";     
            hint parsetext (_title +  _name +  _text); 
            playsound "Topic_Done";

            createDrugsMarker = 
            {
                _markerName = format ["%1_drugsMarker",name player];     
                _drugMarker = createMarker [_markerName, getPos (vehicle player)];
                _drugMarker setMarkerShape "ICON";
                _drugMarker setMarkerText (format ["Drug Dealer: %1", name player]);
                _drugMarker setMarkerColor "ColorRed";
                _drugMarker setMarkerType "mil_dot";
                sleep 45;
                deleteMarker _markerName;
                createDrugsMarker = nil;
            };
        [] spawn createDrugsMarker; 
        };
}; //will run infinitely

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment