Jump to content

chargedlight1

Member
  • Content Count

    22
  • Joined

  • Last visited

  • Days Won

    1

chargedlight1 last won the day on January 13 2017

chargedlight1 had the most liked content!

About chargedlight1

  • Rank
    Fresh Spawn
  • Birthday 08/26/1996

Contact Methods

Profile Information

  • Gender
    Male
  • Location
    Netherlands
  • Interests
    beer, programming, gaming.

Recent Profile Visitors

599 profile views
  1. Dear reader, I have a question for anyone who is intereseted in helping me with an idea. The big idea is to build a "black market" where players can trade their stuff with eatother. i have been thinking of several methods that could be a solution because there are alot of problems in the idea. The first problem i encounterd is that: How do i update the players inventory ? i have come up with these 2 solutions: While restarting insert a cached array after that. restart the server. API method to the server? Which i dont know how to setup if anyone can provive me a link would be great. The second problem: What if the server doesn't have coin based economy? A: Does the player has to have the gold bars inside their safe? ... will continue to write but can't right now. you get the big picture. Can someone help me a little bit here? if it is even possible? - Chargedlight1
  2. I've noticed dayz epoch arma 2 mod uses hives to connect to mysql databases I want to create a custom table in the MySQL database, will i be able to use the custom table if i create a new hive.. or is there another way? or is it even possible to create a custom hive?
  3. If you dont want to use: http://opendayz.net/threads/release-essv2-enhanced-spawn-selection-v2.21547/ As you want a random spawn location for player who join your server just like me. One thing to notice is that i didn't test this without anti-hack. ( I've used infistar on server side with a reason. PM me if you want to know that reason and why i did it in this specific way. ) Without Antihack on server side* NOT TESTED, NEED RESPONSE IF WORKS OR SOLUTION! : First add this in init: execVM "Custom\loadout.sqf"; Above: dayz_paraSpawn = false; // Halo spawn DZE_BackpackAntiTheft = false; // Prevent stealing from backpacks in trader zones in Custom\loadout.sqf: //change loadout on spawn, // added by: Stijnkluiters github: https://github.com/stijnkluiters // default array = [ //"ItemBandage", //"ItemBandage", //"17Rnd_9x19_glock17", //"17Rnd_9x19_glock17", //"ItemMorphine", private ["_isHero","_humanity","_isBandit"]; _humanity = player getVariable["humanity",0]; // This is where my own server failed because of my anti-hack _isBandit = _humanity < -5000; _isHero = _humanity > 5000; if (_isHero) then { //hero diag_log format["LOADOUT: Hero"]; DefaultMagazines = ["ItemMap","HandRoadFlare","ItemBandage","ItemPainkiller","8Rnd_9x18_Makarov","8Rnd_9x18_Makarov"]; DefaultWeapons = ["Makarov_DZ","ItemFlashlight"]; DefaultBackpack = "DZ_Patrol_Pack_EP1"; DefaultBackpackItems = []; // Can include both weapons and magazines i.e. ["PDW_DZ","30Rnd_9x19_UZI"]; }; if (_isBandit) then { //bndit diag_log format["LOADOUT: Bandit"]; DefaultMagazines = ["ItemMap","HandRoadFlare","ItemBandage","ItemPainkiller","8Rnd_9x18_Makarov","8Rnd_9x18_Makarov"]; DefaultWeapons = ["Makarov_DZ","ItemFlashlight"]; DefaultBackpack = "DZ_Patrol_Pack_EP1"; DefaultBackpackItems = []; // Can include both weapons and magazines i.e. ["PDW_DZ","30Rnd_9x19_UZI"]; }; With Antihack on server side* TESTED, WORKS! : Go to /z/addons/dayz_server/compile/server_playerLogin.sqf And add: "_primcharvar", "_humanity" // Line 1 in code. to private[]; after doing so. Add this: //Do Connection Attempt // humanity _doLoop = 0; while {_doLoop < 5} do { _key = format["CHILD:102:%1:",_charID]; _primcharvar = _key call server_hiveReadWrite; if (count _primcharvar > 0) then { if ((_primcharvar select 0) != "ERROR") then { _doLoop = 9; }; }; _doLoop = _doLoop + 1; }; _humanity = _primcharvar select 5; after: //Process request _newPlayer = _primary select 1; _isNew = count _primary < 10; //_result select 1; _charID = _primary select 2; // NEW CODE HERE! find: PVCDZ_plr_Login add this under that. /* Humanity */ Humanity = _humanity; (owner _playerObj) publicVariableClient "Humanity"; Go to: Init.sqf Add: execVM "Custom\loadout.sqf"; above: dayz_paraSpawn = false; // Halo spawn DZE_BackpackAntiTheft = false; // Prevent stealing from backpacks in trader zones in Custom\loadout.sqf //change loadout on spawn, // added by: Stijnkluiters github: https://github.com/stijnkluiters // default array = [ //"ItemBandage", //"ItemBandage", //"17Rnd_9x19_glock17", //"17Rnd_9x19_glock17", //"ItemMorphine", private ["_isHero","_humanity","_isBandit"]; waitUntil {uiSleep 1; !isNil ("PVCDZ_plr_Login")}; waitUntil {uiSleep 1; !isNil ("Humanity")}; _humanity = Humanity; diag_log format["CHARGEDLIGHT1: humanity: %1",_humanity]; _isBandit = _humanity < -5000; _isHero = _humanity > 5000; if (_isHero) then { //hero diag_log format["LOADOUT: Hero"]; DefaultMagazines = ["ItemMap","HandRoadFlare","ItemBandage","ItemPainkiller","8Rnd_9x18_Makarov","8Rnd_9x18_Makarov"]; DefaultWeapons = ["Makarov_DZ","ItemFlashlight"]; DefaultBackpack = "DZ_Patrol_Pack_EP1"; DefaultBackpackItems = []; // Can include both weapons and magazines i.e. ["PDW_DZ","30Rnd_9x19_UZI"]; }; if (_isBandit) then { //bandit diag_log format["LOADOUT: Bandit"]; DefaultMagazines = ["ItemMap","HandRoadFlare","ItemBandage","ItemPainkiller","8Rnd_9x18_Makarov","8Rnd_9x18_Makarov"]; DefaultWeapons = ["Makarov_DZ","ItemFlashlight"]; DefaultBackpack = "DZ_Patrol_Pack_EP1"; DefaultBackpackItems = []; // Can include both weapons and magazines i.e. ["PDW_DZ","30Rnd_9x19_UZI"]; };
  4. First of all i fixed this problem. I've installed infistar on the server side. the reason i did this is because orther people can see the code which is an security issue. I thaught.. Ill do it right. since infistar tells you to install things client side. Now, Infistar blocks the player object/variable! Which means normal variable wont work Now i still used the fix from gathering data from the database. Since the Default... Weapons/Backpack/Magazines are defined CLIENTSIDE. and the code i was using was: SERVERSIDE. i made the humanity variable from the server side. PUBLIC. which means it can be called on the clientside & serverside. /* Humanity */ Humanity = _humanity; (owner _playerObj) publicVariableClient "Humanity"; and in the init: // Uncomment the lines below to change the default loadout execVM "Custom\loadout.sqf"; // Don't remove this line dayz_paraSpawn = false; // Halo spawn And in the loadout: //change loadout on spawn, // default array = [ //"ItemBandage", //"ItemBandage", //"17Rnd_9x19_glock17", //"17Rnd_9x19_glock17", //"ItemMorphine", private ["_isHero","_humanity","_isBandit"]; waitUntil {uiSleep 1; !isNil ("PVCDZ_plr_Login")}; waitUntil {uiSleep 1; !isNil ("Humanity")}; _humanity = Humanity; _isBandit = _humanity < -5000; _isHero = _humanity > 5000; if (_isHero) then { //hero diag_log format["LOADOUT: Hero"]; DefaultMagazines = ["ItemMap","HandRoadFlare","ItemBandage","ItemPainkiller","8Rnd_9x18_Makarov","8Rnd_9x18_Makarov"]; DefaultWeapons = ["Makarov_DZ","ItemFlashlight"]; DefaultBackpack = "DZ_Patrol_Pack_EP1"; DefaultBackpackItems = []; // Can include both weapons and magazines i.e. ["PDW_DZ","30Rnd_9x19_UZI"]; }; if (_isBandit) then { //bndit diag_log format["LOADOUT: Bandit"]; DefaultMagazines = ["ItemMap","HandRoadFlare","ItemBandage","ItemPainkiller","8Rnd_9x18_Makarov","8Rnd_9x18_Makarov"]; DefaultWeapons = ["Makarov_DZ","ItemFlashlight"]; DefaultBackpack = "DZ_Patrol_Pack_EP1"; DefaultBackpackItems = []; // Can include both weapons and magazines i.e. ["PDW_DZ","30Rnd_9x19_UZI"]; } I hope i cleared some things up. TESTED AND WORKING! - Chargedlight.
  5. WARNING does not work yet! Variables are not getting executed. Trying to think of a solution. Weird thing is that it SHOULD work... default_magazines are defined RIGHT THERE in that Specific file..
  6. For those who tried to help me and are qurious how i fixed this problem: In the z/dayz_server/compile/server_playerLogin.sqf i pasted this piece of code underneath the _charID which is important. I created another connection attempt in hive 102.. no idea what it exactly does ( I assume just a simple querry like :(SELECT * FROM Character_DATA where CharachterID = _charID (example: 15) ). but here you go. The variable humanity comes out of the database! //Process request _newPlayer = _primary select 1; _isNew = count _primary < 10; //_result select 1; _charID = _primary select 2; //Do Connection Attempt // humanity _doLoop = 0; while {_doLoop < 5} do { _key = format["CHILD:102:%1:",_charID]; _primcharvar = _key call server_hiveReadWrite; if (count _primcharvar > 0) then { if ((_primcharvar select 0) != "ERROR") then { _doLoop = 9; }; }; _doLoop = _doLoop + 1; }; _humanity = _primcharvar select 5; diag_log format["_humanity var: %1",_humanity]; # DONT FORGET TO ADD: __humanity & _primcharvar to the PRIVATE on top of this file. if i add the if statements from @juandayz i did like so: /* PROCESS */ _hiveVer = 0; if (!_isNew) then { //RETURNING CHARACTER _inventory = _primary select 4; _backpack = _primary select 5; _survival = _primary select 6; _CharacterCoins = _primary select 7; _model = _primary select 8; _group = _primary select 9; _playerCoins = _primary select 10; _BankCoins = _primary select 11; _hiveVer = _primary select 12; if !(_model in AllPlayers) then {_model = "Survivor2_DZ";}; } else { _isInfected = if (DZE_PlayerZed) then {_primary select 3} else {0}; _model = _primary select 4; _group = _primary select 5; _playerCoins = _primary select 6; _BankCoins = _primary select 7; _hiveVer = _primary select 8; if (isNil "_model") then { _model = "Survivor2_DZ"; } else { if (_model == "") then {_model = "Survivor2_DZ";}; }; //Record initial inventory only if not player zombie if (_isInfected != 1) then { _config = configFile >> "CfgSurvival" >> "Inventory" >> "Default"; _mags = getArray (_config >> "magazines"); _wpns = getArray (_config >> "weapons"); _bcpk = getText (_config >> "backpack"); _isBandit = _humanity < -5000; _isHero = _humanity > 5000; if (_humanity > 5000) then { DefaultMagazines = ["ItemMap","HandRoadFlare","ItemBandage","ItemPainkiller","8Rnd_9x18_Makarov","8Rnd_9x18_Makarov"]; DefaultWeapons = ["Makarov_DZ","ItemFlashlight"]; DefaultBackpack = "DZ_Patrol_Pack_EP1"; DefaultBackpackItems = []; // Can include both weapons and magazines i.e. ["PDW_DZ","30Rnd_9x19_UZI"]; }; if (_humanity < -5000) then { DefaultMagazines = ["ItemMap","HandRoadFlare","ItemBandage","ItemPainkiller","8Rnd_9x18_Makarov","8Rnd_9x18_Makarov"]; DefaultWeapons = ["Makarov_DZ","ItemFlashlight"]; DefaultBackpack = "DZ_Patrol_Pack_EP1"; DefaultBackpackItems = []; // Can include both weapons and magazines i.e. ["PDW_DZ","30Rnd_9x19_UZI"]; }else{ DefaultMagazines = ["ItemMap","HandRoadFlare","ItemBandage","ItemPainkiller","8Rnd_9x18_Makarov","8Rnd_9x18_Makarov"]; DefaultWeapons = ["Makarov_DZ","ItemFlashlight"]; DefaultBackpack = "DZ_Patrol_Pack_EP1"; DefaultBackpackItems = []; // Can include both weapons and magazines i.e. ["PDW_DZ","30Rnd_9x19_UZI"]; }; if (!isNil "DefaultMagazines") then {_mags = DefaultMagazines;}; if (!isNil "DefaultWeapons") then {_wpns = DefaultWeapons;}; if (!isNil "DefaultBackpack") then {_bcpk = DefaultBackpack;}; //Wait for HIVE to be free _key = format["CHILD:203:%1:%2:%3:",_charID,[_wpns,_mags],[_bcpk,[],[]]]; _key call server_hiveWrite; }; }; You should be glad that you dont life right next to me. All the birds flew out of the trees of my succes scream. - Chargedlight1
  7. Doesnt infistar block the player variabele
  8. Back to the old error again @juandayz 16:08:37 Error in expression <getVariable ["humanity",0]; _isBandit = _humanity < -5000; _isHero = _humanity >> 16:08:37 Error position: <_humanity < -5000; _isHero = _humanity >> 16:08:37 Error Undefined variable in expression: _humanity maybe i can like check if a player is a freshspawn. then remove all his old contents. then replace it with new ones. Missions are getting spawned with: Add_magazine "Type of ammo for gun." Right? Because i think that these variables are getting adjusted toolate, Everything has loaded in. Loadouts are getting configured in the server. not on the client side. Removing all of their content and replacing it with the decired contents solved this problem. Not the fact that my code cant find my humanity.. which is very odd in my opinion. I see other posts where that is getting used aswell.
  9. Isn't it: private ["_isHero","_humanity","_isBandit"}; -> private ["_isHero","_humanity","_isBandit"]; Didn't notice since my server gave an error
  10. Still doesnt work.. the rules.sqf ist getting executed at all it seems like. Or atleast it doesn't log into the RPT. Here is my code i dont really understand why it doesn't load. I moved the previous from the init.sqf to a seperate file. Here is my init.sqf: Isnt it also the case that in the rules.sqf the loaded variables already have been used by then? Since in the init.sqf the server loads the rules.sqf as almost the last file. - Chargedlight1
  11. @coresync No i did not.. After i added those like this: The error is still the same. 15:12:14 Error in expression <getVariable ["humanity",0]; _isBandit = _humanity < -5000; _isHero = _humanity >> 15:12:14 Error position: <_humanity < -5000; _isHero = _humanity >> 15:12:14 Error Undefined variable in expression: _humanity 15:12:14 File mpmissions\DayZ_Epoch_11.Chernarus\init.sqf, line 51 Now i also need to know what this: "_private" does. Is it simmular to this: http://stackoverflow.com/questions/4361553/what-is-the-difference-between-public-private-and-protected ?
  12. Same error: 15:02:41 Error in expression <getVariable ["humanity",0]; _isBandit = _humanity < -5000; _isHero = _humanity >> 15:02:41 Error position: <_humanity < -5000; _isHero = _humanity >> 15:02:41 Error Undefined variable in expression: _humanity This was the reason i went deeper into the code to write the solution there. Same problem there. ( Deeper file was: z\dayz_server\compile\server_playerLogin.sqf ) However i did found out that in the file z\dayz_server\compile\server_playerSetup.sqf That the variable is getting set over there. _playerObj setVariable ["humanity",_humanity,true]; But then the variables ( DefaultMagazines = ["ItemMap","HandRoadFlare","ItemBandage","ItemPainkiller","8Rnd_9x18_Makarov","8Rnd_9x18_Makarov"]; DefaultWeapons = ["Makarov_DZ","ItemFlashlight"]; DefaultBackpack = "DZ_Patrol_Pack_EP1"; DefaultBackpackItems = []; // Can include both weapons and magazines i.e. ["PDW_DZ","30Rnd_9x19_UZI"]; are already have been used to create the model. So these aren't getting used anymore from that point.
  13. Currently this is my code... The PlayerHumanity variable is undifined ;( this is the error
×
×
  • Create New...