Moin NN,
da sich viele Menschen fragen, wie man ein Archivement System
entwickelt hier ein kleiner Anfang.
Zu Beachten: Dies ist nur ein Anfang (Schnipsel), es ist kein komplettes Tutorial.
ebenfalls ist die Ausarbeitung mit Dialog und so schlecht, ihr solltet es so nicht benutzen sondern nur als Hilfestellung nehmen, da ich wenig Zeit habe, kann ich leider kein komplettes erstellen
Schritt 1:
Wir legen eine Config namens Config_Archivements.hpp an
Code
/*
Author: Natic
*/
class cfgArchives
{
class ticket {
variable = "archiv_ticket";
titel = "Strafzettel";
side = "cop";
description = "<t size='1'>Vergebe: %2 Strafzettel <br/>Vergebene Strafzettel: %1 </t>";
class level_1 {
needed = 100;
archiv = "Streifenbulle";
};
class level_2 {
needed = 300;
archiv = "Hüter der Bürger";
};
class level_3 {
needed = 800;
archiv = "Kaufhauscop";
};
class level_4 {
needed = 2500;
archiv = "König der Hüter";
};
class level_5 {
needed = 5000;
archiv = "König der Könige";
};
};
};
Alles anzeigen
Schritt 2:
Wir gehen in die Datei: fn_ticketGive.sqf und ersetzen diese mit
Code
#include "..\..\script_macros.hpp"
/*
File: fn_ticketGive.sqf
Author: Bryan "Tonic" Boardwine
Modified by: Natic
Description:
Gives a ticket to the targeted player.
*/
private ["_val","_ticketcount"];
if (isNil "life_ticket_unit") exitWith {["Keine Person","Person für das Ticket ist nil!", true, "fast"] spawn ESG_fnc_notify;};
if (isNull life_ticket_unit) exitWith {["Keine Person","Die Person für das Ticket gibt es nicht!", true, "fast"] spawn ESG_fnc_notify;};
_val = ctrlText 2652;
_ticketcount = 0;
if (!([_val] call TON_fnc_isnumber)) exitWith {["Keine Zahl","Du hast keine echte Zahl eingegeben!", true, "fast"] spawn ESG_fnc_notify;};
if ((parseNumber _val) > 500000) exitWith {["Zu hohes Bußgeld","Strafzettel können nicht mehr als $500.000 betragen!", true, "fast"] spawn ESG_fnc_notify;};
if (playerside isEqualTo west)then {
[0,"STR_Cop_TicketGive",true,[profileName,[(parseNumber _val)] call life_fnc_numberText,life_ticket_unit getVariable ["realname",name life_ticket_unit]]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
}
else
{
[0,"STR_Med_TicketGive",true,[profileName,[(parseNumber _val)] call life_fnc_numberText,life_ticket_unit getVariable ["realname",name life_ticket_unit]]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
};
[player,(parseNumber _val)] remoteExec ["life_fnc_ticketPrompt",life_ticket_unit];
closeDialog 0;
_ticketcount = _ticketcount + 1;
private ["_lvl_1","_lvl_2","_lvl_3","_lvl_4","_lvl_5"];
_lvl_1 = getText(missionConfigFile >>"cfgArchives" >> "tickets" >> "level_1","archiv");
_lvl_2 = getText(missionConfigFile >>"cfgArchives" >> "tickets" >> "level_2","archiv");
_lvl_3 = getText(missionConfigFile >>"cfgArchives" >> "tickets" >> "level_3","archiv");
_lvl_4 = getText(missionConfigFile >>"cfgArchives" >> "tickets" >> "level_4","archiv");
_lvl_5 = getText(missionConfigFile >>"cfgArchives" >> "tickets" >> "level_5","archiv");
if (_ticketcount == 100) then {
if (getNumber(missionConfigFile >>"cfgArchives" >> "tickets" >> "level_1","needed")) then {
lbAdd [100100, "%1",_lvl_1];
};
};
if (_ticketcount == 300) then {
if (getNumber(missionConfigFile >>"cfgArchives" >> "tickets" >> "level_1","needed")) then {
lbAdd [100100, "%1",_lvl_2];
};
};
if (_ticketcount == 800) then {
if (getNumber(missionConfigFile >>"cfgArchives" >> "tickets" >> "level_1","needed")) then {
lbAdd [100100, "%1",_lvl_3];
};
};
if (_ticketcount == 2500) then {
if (getNumber(missionConfigFile >>"cfgArchives" >> "tickets" >> "level_1","needed")) then {
lbAdd [100100, "%1",_lvl_4];
};
};
if (_ticketcount == 5000) then {
if (getNumber(missionConfigFile >>"cfgArchives" >> "tickets" >> "level_1","needed")) then {
lbAdd [100100, "%1",_lvl_5];
};
};
Alles anzeigen
Schritt3: Wir erstellen ein Dialog:
Code
/*
Author: Natic
*/
class sealife_archivements {
idd = 100100;
name = "sealife_archivements";
onLoad = "";
onUnLoad = "";
movingEnable = false;
enableSimulation = false;
class controlsBackground {
class bg: Life_RscPicture
{
idc = -1;
text = "ure\misc\bg_menu.paa";
x = 0.17 * safezoneW + safezoneX;
y = 0.115 * safezoneH + safezoneY;
w = 0.665156 * safezoneW;
h = 0.693 * safezoneH;
ColorBackground[] = {0.784313,0.784313,0.784313,0};
ColorText[] = {0,0,0,1};
};
class title: Life_RscStructuredText
{
idc = 5999;
text = "<t align'right' font'PuristaBold' size'1.5'>Archivements</t>";
x = 0.412621 * safezoneW + safezoneX;
y = 0.169549 * safezoneH + safezoneY;
w = 0.154687 * safezoneW;
h = 0.033 * safezoneH;
ColorBackground[] = {0,0,0,0};
};
};
class controls {
class btn_submit: Life_RscButtonMenu
{
idc = 2400;
text = "Schließen";
onButtonClick = "";
x = 0.647855 * safezoneW + safezoneX;
y = 0.034475 * safezoneH + safezoneY;
w = 0.221719 * safezoneW;
h = 0.055 * safezoneH;
ColorBackground[] = {0.145098,0.145098,0.145098,1};
ColorText[] = {1,1,1,1};
};
class archives_list: Life_RscListbox
{
idc = 100101;
x = 0.209235 * safezoneW + safezoneX;
y = 0.232345 * safezoneH + safezoneY;
w = 0.752604 * safezoneW;
h = 0.722222 * safezoneH;
ColorBackground[] = {0,0,0,0.705882};
ColorText[] = {1,1,1,1};
colorSelectBackground[] = {0,0,0,1};
colorSelect[] = {0,0,0,1};
};
};
};
Alles anzeigen
Ich hoffe ich konnte euch ggf. Helfen
viel spaß