Einzelnen Beitrag anzeigen
Alt 22.08.2014, 15:49   #1 (permalink)
killshot
50 Beiträge100 Beiträge
 
Registriert seit: 03.07.2012
Beiträge: 118
Standard Objekt nur sichtbar wenn Spieler existiert

Moin, moin.

Ich habe für eine MP-Mission als Startlocation ein kleines Biwak (hauptsächlich aus den interaktiven Schlafsäcken/Rallypoints) erstellt und möchte jetzt gerne, dass der jeweilige Schlafsack (rp1 bis rp12) nur dann sichtbar (hideObjectGlobal) ist, wenn der dazugehörige Spieler (s1 bis s12) auch tatsächlich auf dem Server ist. Also wenn beispielweise alle Slots bis auf s11 und s12 belegt sind, sollen eben auch nur rp1 bis rp10 sichtbar sein.

Ich hatte es jetzt in meiner init.sqf folgendermaßen probiert.

PHP-Code:
if (!isNull s1then {if (s1 == playerthen {rp1 hideObjectGlobal false;} else {rp1 hideObjectGlobal true;};};
if (!
isNull s2then {if (s2 == playerthen {rp2 hideObjectGlobal false;} else {rp2 hideObjectGlobal true;};};
if (!
isNull s3then {if (s3 == playerthen {rp3 hideObjectGlobal false;} else {rp3 hideObjectGlobal true;};};
if (!
isNull s4then {if (s4 == playerthen {rp4 hideObjectGlobal false;} else {rp4 hideObjectGlobal true;};};
if (!
isNull s5then {if (s5 == playerthen {rp5 hideObjectGlobal false;} else {rp5 hideObjectGlobal true;};};
if (!
isNull s6then {if (s6 == playerthen {rp6 hideObjectGlobal false;} else {rp6 hideObjectGlobal true;};};
if (!
isNull s7then {if (s7 == playerthen {rp7 hideObjectGlobal false;} else {rp7 hideObjectGlobal true;};};
if (!
isNull s8then {if (s8 == playerthen {rp8 hideObjectGlobal false;} else {rp8 hideObjectGlobal true;};};
if (!
isNull s9then {if (s9 == playerthen {rp9 hideObjectGlobal false;} else {rp9 hideObjectGlobal true;};};
if (!
isNull s10then {if (s10 == playerthen {rp10 hideObjectGlobal false;} else {rp10 hideObjectGlobal true;};};
if (!
isNull s11then {if (s11 == playerthen {rp11 hideObjectGlobal false;} else {rp11 hideObjectGlobal true;};};
if (!
isNull s12then {if (s12 == playerthen {rp12 hideObjectGlobal false;} else {rp12 hideObjectGlobal true;};}; 
Im Editor funktionierts, auf einem DediServer leider nicht.

Ein Kollege hatte dann noch folgenden Lösungsvorschlag, der bis jetzt leider auch nicht hingehauen hat:

PHP-Code:
_arr_players = [ [s1,rp1],[s2,rp2],[s3,rp3],[s4,rp4],[s5,rp5],[s6,rp6],[s7,rp7],[s8,rp8],[s9,rp9],[s10,rp10],[s11,rp11],[s12,rp12] ];

for [{ 
_i }, { _i count(_arr_players) }, { _i _i +}] do
{
    
player groupchat format["Loop with index #%1",_i];
   if ( !
isNil( (_arr_players select _iselect 0 ) && (player == ((_arr_players select _iselect 0)) ) then  
   

    
player groupchat format["Player %1 is equal",(_arr_players select _iselect 0];
    (
_arr_players select _iselect 1 hideObjectGlobal false;
   } else { 
player groupchat format["Player %1 is not equal",(_arr_players select _iselect 0]; (_arr_players select _iselect 1 hideObjectGlobal true; };
}; 
Kann da vielleicht jemand eine helfende Hand reichen?

Danke und Grüße


Edit: Hatte eine falsche Überschrift sorry

Geändert von killshot (22.08.2014 um 15:51 Uhr).
killshot ist offline