fix for name function error (untested)

17:00:15 WARNING: Function 'name' - PLAYER is dead
This commit is contained in:
icomrade
2014-03-25 22:01:07 -04:00
parent 7812bcc7b0
commit 935ed7931d
6 changed files with 22 additions and 18 deletions

View File

@@ -1,8 +1,9 @@
private "_name";
//Let Zeds know //Let Zeds know
[player,4,true,(getPosATL player)] spawn player_alertZombies; [player,4,true,(getPosATL player)] spawn player_alertZombies;
//display gui (temp hint) //display gui (temp hint)
_name = if (alive player) then {name player;} else {"Dead Player";};
hintSilent parseText format [" hintSilent parseText format ["
<t size='1.20' font='Bitstream' color='#5882FA'>%1</t><br/><br/> <t size='1.20' font='Bitstream' color='#5882FA'>%1</t><br/><br/>
<t size='1.20' font='Bitstream' color='#5882FA'>Survived %7 Days</t><br/><br/> <t size='1.20' font='Bitstream' color='#5882FA'>Survived %7 Days</t><br/><br/>
@@ -11,7 +12,7 @@ hintSilent parseText format ["
<t size='1.15' font='Bitstream' align='left'>Murders: </t><t size='1.15' font='Bitstream' align='right'>%4</t><br/> <t size='1.15' font='Bitstream' align='left'>Murders: </t><t size='1.15' font='Bitstream' align='right'>%4</t><br/>
<t size='1.15' font='Bitstream' align='left'>Bandits Killed: </t><t size='1.15' font='Bitstream' align='right'>%5</t><br/><br/> <t size='1.15' font='Bitstream' align='left'>Bandits Killed: </t><t size='1.15' font='Bitstream' align='right'>%5</t><br/><br/>
<t size='1.15' font='Bitstream' align='left'>Humanity: </t><t size='1.15' font='Bitstream' align='right'>%6</t><br/><br/>", <t size='1.15' font='Bitstream' align='left'>Humanity: </t><t size='1.15' font='Bitstream' align='right'>%6</t><br/><br/>",
(name player), (_name),
(player getVariable['zombieKills', 0]), (player getVariable['zombieKills', 0]),
(player getVariable['headShots', 0]), (player getVariable['headShots', 0]),
(player getVariable['humanKills', 0]), (player getVariable['humanKills', 0]),

View File

@@ -1,4 +1,4 @@
private ["_display","_ctrlBlood","_ctrlBleed","_bloodVal","_ctrlFood","_ctrlThirst","_thirstVal","_foodVal","_ctrlTemp","_tempVal","_combatVal","_array","_ctrlEar","_ctrlEye","_ctrlCombat","_ctrlFracture","_visualText","_visual","_audibleText","_audible","_blood","_thirstLvl","_foodLvl","_tempImg","_thirst","_food","_temp","_bloodLvl","_tempLvl","_color","_string","_humanity","_size","_friendlies","_charID","_rcharID","_rfriendlies","_rfriendlyTo","_distance","_targetControl","_humanityTarget"]; private ["_display","_ctrlBlood","_ctrlBleed","_bloodVal","_humanityName","_ctrlFood","_ctrlThirst","_thirstVal","_foodVal","_ctrlTemp","_tempVal","_combatVal","_array","_ctrlEar","_ctrlEye","_ctrlCombat","_ctrlFracture","_visualText","_visual","_audibleText","_audible","_blood","_thirstLvl","_foodLvl","_tempImg","_thirst","_food","_temp","_bloodLvl","_tempLvl","_color","_string","_humanity","_size","_friendlies","_charID","_rcharID","_rfriendlies","_rfriendlyTo","_distance","_targetControl","_humanityTarget"];
disableSerialization; disableSerialization;
_foodVal = 1 - (dayz_hunger / SleepFood); _foodVal = 1 - (dayz_hunger / SleepFood);
@@ -173,7 +173,8 @@ if (!isNull _humanityTarget and isPlayer _humanityTarget and alive _humanityTarg
// <br /><t %2 align='center' size='0.7'>Humanity: %3</t> // <br /><t %2 align='center' size='0.7'>Humanity: %3</t>
_color = "color='#339933'"; _color = "color='#339933'";
_string = format["<t %2 align='center' size='%3'>%1</t>",(name _humanityTarget),_color,_size]; _humanityName = if (alive _humanityTarget) then {name _humanityTarget; } else { "Dead Player";};
_string = format["<t %2 align='center' size='%3'>%1</t>",_humanityName,_color,_size];
} else { } else {
@@ -189,7 +190,8 @@ if (!isNull _humanityTarget and isPlayer _humanityTarget and alive _humanityTarg
}; };
}; };
if((_humanityTarget getVariable ["DZE_display_name", false]) or (DZE_ForceNameTagsInTrader && isInTraderCity)) then { if((_humanityTarget getVariable ["DZE_display_name", false]) or (DZE_ForceNameTagsInTrader && isInTraderCity)) then {
_string = format["<t %2 align='center' size='%3'>%1</t>",(name _humanityTarget),_color,_size]; _humanityName = if (alive _humanityTarget) then {name _humanityTarget; } else { "Dead Player";};
_string = format["<t %2 align='center' size='%3'>%1</t>",_humanityName,_color,_size];
}; };
}; };
}; };

View File

@@ -4,7 +4,7 @@ _attacker = _this select 1;
_damage = _this select 2; _damage = _this select 2;
if (!isPlayer _victim || !isPlayer _attacker) exitWith {}; if (!isPlayer _victim || !isPlayer _attacker) exitWith {};
if ((name _victim) == (name _attacker)) exitWith {}; if ((owner _victim) == (owner _attacker)) exitWith {};
_weapon = weaponState _attacker; _weapon = weaponState _attacker;
if (_weapon select 0 == "Throw") then if (_weapon select 0 == "Throw") then

View File

@@ -1,5 +1,5 @@
/* Maintain Area - written by Skaronator */ /* Maintain Area - written by Skaronator */
private ["_player","_ObjArray","_uniqueID","_objects","_key"]; private ["_player","_name","_ObjArray","_uniqueID","_objects","_key"];
_player = _this select 0; _player = _this select 0;
_option = _this select 1; _option = _this select 1;
/* /*
@@ -27,8 +27,8 @@ if (_option == 1) then {
}; };
}; };
} forEach _objects; } forEach _objects;
_name = if (alive _player) then { name _player; } else { "Dead Player"; };
diag_log format ["MAINTAIN AREA BY %1 - %2 Objects at %3", name _player, count _objects, position _player]; diag_log format ["MAINTAIN AREA BY %1 - %2 Objects at %3", _name, count _objects, position _player];
}; };
if (_option == 2) then { if (_option == 2) then {
if (damage _targetObj >= DZE_DamageBeforeMaint) then { if (damage _targetObj >= DZE_DamageBeforeMaint) then {

View File

@@ -1,4 +1,4 @@
private ["_empty","_playerwasNearby","_character","_magazines","_force","_characterID","_charPos","_isInVehicle","_timeSince","_humanity","_debug","_distance","_isNewMed","_isNewPos","_isNewGear","_playerPos","_playerGear","_playerBackp","_medical","_distanceFoot","_lastPos","_backpack","_kills","_killsB","_killsH","_headShots","_lastTime","_timeGross","_timeLeft","_currentWpn","_currentAnim","_config","_onLadder","_isTerminal","_currentModel","_modelChk","_muzzles","_temp","_currentState","_array","_key","_pos","_forceGear","_friendlies"]; private ["_empty","_name","_playerwasNearby","_character","_magazines","_force","_characterID","_charPos","_isInVehicle","_timeSince","_humanity","_debug","_distance","_isNewMed","_isNewPos","_isNewGear","_playerPos","_playerGear","_playerBackp","_medical","_distanceFoot","_lastPos","_backpack","_kills","_killsB","_killsH","_headShots","_lastTime","_timeGross","_timeLeft","_currentWpn","_currentAnim","_config","_onLadder","_isTerminal","_currentModel","_modelChk","_muzzles","_temp","_currentState","_array","_key","_pos","_forceGear","_friendlies"];
_character = _this select 0; _character = _this select 0;
_magazines = _this select 1; _magazines = _this select 1;
@@ -23,24 +23,24 @@ _timeSince = 0;
_humanity = 0; _humanity = 0;
//diag_log ("DW_DEBUG: (isnil _characterID): " + str(isnil "_characterID")); //diag_log ("DW_DEBUG: (isnil _characterID): " + str(isnil "_characterID"));
_name = if (alive _character) then { name _character; } else { "Dead Player"; };
if (_character isKindOf "Animal") exitWith { if (_character isKindOf "Animal") exitWith {
diag_log ("ERROR: Cannot Sync Character " + (name _character) + " is an Animal class"); diag_log ("ERROR: Cannot Sync Character " + (_name) + " is an Animal class");
}; };
if (isnil "_characterID") exitWith { if (isnil "_characterID") exitWith {
diag_log ("ERROR: Cannot Sync Character " + (name _character) + " has nil characterID"); diag_log ("ERROR: Cannot Sync Character " + (_name) + " has nil characterID");
}; };
if (_characterID == "0") exitWith { if (_characterID == "0") exitWith {
diag_log ("ERROR: Cannot Sync Character " + (name _character) + " as no characterID"); diag_log ("ERROR: Cannot Sync Character " + (_name) + " as no characterID");
}; };
private["_debug","_distance"]; private["_debug","_distance"];
_debug = getMarkerpos "respawn_west"; _debug = getMarkerpos "respawn_west";
_distance = _debug distance _charPos; _distance = _debug distance _charPos;
if (_distance < 2000) exitWith { if (_distance < 2000) exitWith {
diag_log format["ERROR: server_playerSync: Cannot Sync Player %1 [%2]. Position in debug! %3",name _character,_characterID,_charPos]; diag_log format["ERROR: server_playerSync: Cannot Sync Player %1 [%2]. Position in debug! %3",_name,_characterID,_charPos];
}; };
//Check for server initiated updates //Check for server initiated updates

View File

@@ -1,4 +1,4 @@
private ["_character","_traderid","_buyorsell","_data","_result","_key","_outcome","_clientID"]; private ["_character","_name","_traderid","_buyorsell","_data","_result","_key","_outcome","_clientID"];
_player = _this select 0; _player = _this select 0;
_traderID = _this select 1; _traderID = _this select 1;
@@ -9,11 +9,12 @@ _currency = _this select 5;
_qty = _this select 6; _qty = _this select 6;
_clientID = owner _player; _clientID = owner _player;
_price = format ["%2x %1",_currency,_qty]; _price = format ["%2x %1",_currency,_qty];
_name = if (alive _character) then { name _character; } else { "Dead Player"; };
if (_buyorsell == 0) then { //Buy if (_buyorsell == 0) then { //Buy
diag_log format["EPOCH SERVERTRADE: Player: %1 (%2) bought a %3 in/at %4 for %5", (name _player), (getPlayerUID _player), _classname, _traderCity, _price]; diag_log format["EPOCH SERVERTRADE: Player: %1 (%2) bought a %3 in/at %4 for %5", _name, (getPlayerUID _player), _classname, _traderCity, _price];
} else { //SELL } else { //SELL
diag_log format["EPOCH SERVERTRADE: Player: %1 (%2) sold a %3 in/at %4 for %5",(name _player), (getPlayerUID _player), _classname, _traderCity, _price]; diag_log format["EPOCH SERVERTRADE: Player: %1 (%2) sold a %3 in/at %4 for %5",_name, (getPlayerUID _player), _classname, _traderCity, _price];
}; };
if (DZE_ConfigTrader) then { if (DZE_ConfigTrader) then {