Jump to content

Recommended Posts

How to add the prize if a player kills 10 AIs and the player gets one respawn ticket.

I already have this kind of floor plan

 

initServer.sqf:

addMissionEventHandler ["EntityKilled", {

params ["_killed", "_killer", "_instigator"];

if ((_killed isKindOf "Man") and (!isPlayer _killed)) then {

[_killer, 100] call HALs_money_fnc_addFunds;    

removeAllWeapons _killed;

removeAllItems _killed;

removeAllAssignedItems _killed;

deleteVehicle (nearestObject [_killed, "WeaponHolderSimulated"]);

};

}];

Share this post


Link to post
Share on other sites
_killer setVariable ["numKilled",  (_killer getVariable ["numKilled",0]) + 1 ];

if( (_killer getVariable ["numKilled",0]) >= 10 ) then
{
 // Reward code here

_killer setVariable ["numKilled", 0]; // Reset
};

code not tested

 

  • Like 2

Share this post


Link to post
Share on other sites

@gc8
Thank you. It works really well.

 

initServer.sqf:

addMissionEventHandler ["EntityKilled", 

{

    params ["_killed", "_killer", "_instigator"];

 

    _killer setVariable ["numKilled",  (_killer getVariable ["numKilled",0]) + 1 ];

 

    if( (_killer getVariable ["numKilled",0]) >= 10 ) then

    {

        [_killer, 200] call HALs_money_fnc_addFunds;

        [_killer, +1] call BIS_fnc_respawnTickets;

        _killer setVariable ["numKilled", 0]; // Reset

    };

 

    if ((_killed isKindOf "Man") and (!isPlayer _killed)) then 

    {

        [_killer, 50] call HALs_money_fnc_addFunds; 

        removeAllWeapons _killed;

        removeAllItems _killed;

        removeAllAssignedItems _killed;

        deleteVehicle (nearestObject [_killed, "WeaponHolderSimulated"]);

    };

}];

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×