Moin,
ich wollte es eigentlich nicht posten aber ich konnte jetzt doch nicht wiederstehen. Achtung das wird so ohne weiteres nicht per "Copy & Paste" funktionieren.
Code
#include "..\..\script_macros.hpp"
params [
["_shop",ObjNull,[ObjNull]] //The object that has the action attached to it is _this. ,0, is the index of object, ObjNull is the default should there be nothing in the parameter or it's broken
,["_robber",ObjNull,[ObjNull]] //Can you guess? Alright, it's the player, or the "caller". The object is 0, the person activating the object is 1
,"_action"//Action name
];
private _kassa = 15000 + round(random 15000);
if !(side _robber isEqualTo civilian) exitwith {
["Bei Dir hackts wohl, Du kannst doch nix überfallen! Oder seit wann arbeitest Du nicht beim Staat!","RED",10] spawn life_fnc_notification_system;
};
if (life_firstrob) exitWith {["Jo man es war gerade Weltuntergang und es ist noch kein Geld in der Kasse!","RED",10] spawn life_fnc_notification_system;};
if (servertime < life_nextrob) exitWith {[format ["Es wurde gerade schon eine Tankstelle überfallen, komm in %1 Minuten wieder vorbei!", [(life_nextrob - servertime),"MM:SS"] call BIS_fnc_secondsToString],"RED",10] spawn life_fnc_notification_system;};
private _robdelay = 900; // 900 Zeit die zwischen zwei Überfällen vergehen muss.
if(_robber distance _shop > 5) exitWith {["Du musst 5m von dem Kassierer entfernt sein, um ihn auszurauben!","RED",10] spawn life_fnc_notification_system;};
if !(vehicle player isEqualTo _robber) exitWith {["Steig aus deinem Fahrzeug!","RED",10] spawn life_fnc_notification_system;};
if !(alive _robber) exitWith {};
if (currentWeapon _robber isEqualTo "") exitWith {["HaHa, willst du mich verarschen? Verzieh dich du Idiot!","RED",10] spawn life_fnc_notification_system;};
_cops = (west countSide playableUnits);
if(_cops < 2) exitWith{["Es sind nicht genügend Polizeikräfte im Dienst!","RED",10] spawn life_fnc_notification_system;};
if (_kassa isEqualTo 0) exitWith {["Es ist kein Geld in der Kasse!","RED",10] spawn life_fnc_notification_system;};
private _rip = true;
private _onWanted = false;
_shop removeAction _action;
private _chance = random(100);
if (_chance >= 33 && _chance < 66) then { [1,format["ALARM! - Tankstelle: %1 wird ausgeraubt!", _shop]] remoteExec ["life_fnc_broadcast",west]};
if(_chance >= 66) then {
["Der Kassierer hat den stillen Alarm ausgelöst!","PINK",5] spawn life_fnc_notification_system;
[1,format["ALARM! - Tankstelle: %1 wird ausgeraubt!", _shop]] remoteExec ["life_fnc_broadcast",west];
};
disableSerialization;
5 cutRsc ["life_progress","PLAIN"];
private _ui = uiNameSpace getVariable "life_progress";
private _progress = _ui displayCtrl 38201;
private _pgText = _ui displayCtrl 38202;
_pgText ctrlSetText format["Überfall im Gange, halte dich in der Nähe auf (10m) (1%1)...","%"];
_progress progressSetPosition 0.01;
private _cP = 0.01;
if(_rip) then {
life_nextrob = servertime + _robdelay;
publicVariable "life_nextrob";
for "_i" from 0 to 1 step 0 do {
sleep 1.5;
_cP = _cP + 0.01;
_progress progressSetPosition _cP;
_pgText ctrlSetText format["Überfall im Gange, halte dich in der Nähe auf (10m) (%1%2)...",round(_cP * 100),"%"];
_Pos = position player; // by ehno: get player pos
if (_chance >= 66) then {
_marker = createMarker ["Marker200", _Pos]; //by ehno: Place a Maker on the map
"Marker200" setMarkerColor "ColorRed";
"Marker200" setMarkerText "!Achtung! Überfall !Achtung!";
"Marker200" setMarkerType "mil_warning";
};
if(_cP >= 1) exitWith {};
if(_robber distance _shop > 10.5) exitWith {
deleteMarker "Marker200";
["Du musst in 10m Nähe bleiben um zu Überfallen! - Die Kasse ist nun verschlossen.","RED",10] spawn life_fnc_notification_system;
5 cutText ["","PLAIN"]; _rip = false;
};
if!(alive _robber) exitWith {deleteMarker "Marker200"; _rip = false; 5 cutText ["","PLAIN"];};
if(life_istazed) exitWith {deleteMarker "Marker200"; _rip = false; 5 cutText ["","PLAIN"];};
if(player getVariable ["Re-strained",FALSE]) exitWith { deleteMarker "Marker200"; _rip = false; 5 cutText ["","PLAIN"];};
if (currentWeapon _robber isEqualTo "") exitWith {
["Hier nen Snickers, du wirst immer zur Diva, wenn du hungrig bist!","RED",10] spawn life_fnc_notification_system;
deleteMarker "Marker200"; _rip = false; 5 cutText ["","PLAIN"];
};
};
if!(alive _robber) exitWith { _rip = false; deleteMarker "Marker200"; 5 cutText ["","PLAIN"];};
if(life_istazed) exitWith {deleteMarker "Marker200"; _rip = false; 5 cutText ["","PLAIN"];};
if(player getVariable ["restrained",FALSE]) exitWith { deleteMarker "Marker200"; _rip = false; 5 cutText ["","PLAIN"];};
if (currentWeapon _robber isEqualTo "") exitWith {deleteMarker "Marker200"; _rip = false; 5 cutText ["","PLAIN"]; };
if(_robber distance _shop > 10.5) exitWith { deleteMarker "Marker200"; 5 cutText ["","PLAIN"]; _rip = false; };
5 cutText ["","PLAIN"];
[format["Du hast $%1 gestohlen, flüchte bevor die Polizei eintrifft!",[_kassa] call life_fnc_numberText],"PINK",5] spawn life_fnc_notification_system;
deleteMarker "Marker200"; // by ehno delete maker
CASH = CASH + _kassa;
_rip = false;
_run = [] spawn {
life_use_atm = false;
uisleep (30 + random(180));
life_use_atm = true;
};
};
if !(_onWanted) then {
if !(_chance < 10) then {
_chance = random 100;
if(_chance < 40) then {
if (life_HC_isActive) then {
[getPlayerUID _robber,_robber getVariable ["realname",name _robber],"211"] remoteExecCall ["HC_fnc_wantedAdd",HC_Life];
} else {
[getPlayerUID _robber,_robber getVariable ["realname",name _robber],"211"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
};
};
};
};
_action = _shop addAction["Ausrauben",life_fnc_robShops,"",0,false,true,"",'',5];
Alles anzeigen
ist das identische script mit ein paar kleinen Änderung. Man könnte jetzt die Meldungen noch in den Stringtable schmeissen aber dazu war ich zu faul.
Gruß,
moeck