Psycke Posted June 18, 2007 Report Share Posted June 18, 2007 Redz kur ir mans skriptiņš function rulesdropdown($rules) { if ( !is_array($rules) ) return ""; $response = "<select class='si_rules'>" . "<option selected>cvar: value</option>" . "<option>---------------------</option>"; foreach ( $rules as $rule ) $response .= "<option>".substr($rule["rule"],0,20).": ".$rule["value"]."</option>"; return $response . "</select>"; } Viss kopā strādā ar socketiem, un visi šie arrayi tiek izlikti no servera. Kā, la ies dabonu vienu speciālu arrayu ārā? Nu jā šajā gadījumā katrs arrays saucas 'rule'. Tātād... Kā, lai es dabonu vienu 'rule' ārā no arraya? Paldies jau iepriekš. Link to comment Share on other sites More sharing options...
Val Posted June 18, 2007 Report Share Posted June 18, 2007 Saprotamāk vari? Link to comment Share on other sites More sharing options...
Psycke Posted June 18, 2007 Author Report Share Posted June 18, 2007 Kā tieši? Nu tas ir mans skripts tur iekš code tagiem, kurš izvelk informāciju no servera. Visu saliek vienā arrayā un to var aplūkot caur dropdown boxu. Man ir nepieciešams izvilkt dažas rindas ārā no arraya jeb no tā dropdown boxa, lai tās varētu kaut kā dabūt tukšā vietā kā ar echo. Nu es nemāku skaidrāk izskaidrot. Link to comment Share on other sites More sharing options...
andrisp Posted June 18, 2007 Report Share Posted June 18, 2007 Nezinu kāds tev tas $rules masīvs ir, bet vai $rules[0], $rules[1] u.t.t. neder ? Link to comment Share on other sites More sharing options...
Psycke Posted June 18, 2007 Author Report Share Posted June 18, 2007 (edited) Neder gan. Nū... Izņemot info ārā no tā arraya, es dabonu šo te: Array ( [host] => 213.21.217.178:27015 [status] => up [time] => 1182189986 [info] => Array ( [name] => Trick-Jumps.lv Kreedz server [game] => Counter-Strike [version] => 47 [password] => 0 [anticheat] => 0 [os] => l [map] => kz_absolute [bots] => 0 [players] => 9 [slots] => 12 ) [players] => Array ( [0] => Array ( [userid] => 1 [name] => On3 and only | Reinhoolds [kills] => 0 [time] => 00:37:46 ) [1] => Array ( [userid] => 2 [name] => turbiina*/;) [kills] => 0 [time] => 00:10:15 ) [2] => Array ( [userid] => 3 [name] => Potti | Mini_Pro [kills] => 0 [time] => 00:00:51 ) [3] => Array ( [userid] => 4 [name] => pycckue [kills] => 0 [time] => 00:00:49 ) [4] => Array ( [userid] => 5 [name] => MyJIbTuK [kills] => 0 [time] => 00:00:30 ) [5] => Array ( [userid] => 6 [name] => siikais [kills] => 0 [time] => 00:00:48 ) [6] => Array ( [userid] => 7 [name] => Zizu [kills] => 0 [time] => 00:01:08 ) [7] => Array ( [userid] => 8 [name] => 3BEPyGA [kills] => 0 [time] => 00:13:36 ) [8] => Array ( [userid] => 9 [name] => CONTRA|[.:S-pils:.] Acc` [kills] => 0 [time] => 00:01:01 ) ) [rules] => Array ( [0] => Array ( [rule] => _tutor_bomb_viewable_check_interval [value] => 0.5 ) [1] => Array ( [rule] => _tutor_debug_level [value] => 0 ) [2] => Array ( [rule] => _tutor_examine_time [value] => 0.5 ) [3] => Array ( [rule] => _tutor_hint_interval_time [value] => 10.0 ) [4] => Array ( [rule] => _tutor_look_angle [value] => 10 ) [5] => Array ( [rule] => _tutor_look_distance [value] => 200 ) [6] => Array ( [rule] => _tutor_message_character_display_time_coefficient [value] => 0.07 ) [7] => Array ( [rule] => _tutor_message_minimum_display_time [value] => 1 ) un vēl dažas rindas ir klāt. funkcija rules: function rules(&$handle,&$result) { $challenge = pack("NN", 0xFFFFFFFF, 0xFFFFFFFF); $response = communicate($handle,A2S_RULES.$challenge); $control_byte = getchar($response); if($control_byte == S2C_CHALLENGE) { $challenge = $response; $response = communicate($handle,A2S_RULES.$challenge); $control_byte = getchar($response); } if($control_byte != S2A_RULES) return FALSE; $result = array(); $count = getint16($response); for($i = 0; $i < $count; $i++) { $key = getstring($response); $value = getstring($response); $result[] = array("rule"=>$key,"value"=>$value); } ksort($result); return TRUE; } Edited June 18, 2007 by Psycke Link to comment Share on other sites More sharing options...
bubu Posted June 18, 2007 Report Share Posted June 18, 2007 $rules['rules'][0], $rules['rules'][1], $rules['rules'][2], ... ? Izdrukāt to $rules <pre> tagos un visu redzēsi, kas un kā jāraksta. Link to comment Share on other sites More sharing options...
Psycke Posted June 18, 2007 Author Report Share Posted June 18, 2007 $rules['rules'][0], $rules['rules'][1], $rules['rules'][2], ... ? Nestrādāja. Izdrukāju pre tagos un vienalga neko nesaprotu o_0 Link to comment Share on other sites More sharing options...
bubu Posted June 18, 2007 Report Share Posted June 18, 2007 Manuprāt tu man tagad te pasaciņas stāsti! No tavis paša garā teksta saīsinātā veidā: Array ( [host] => ... [status] => ... [time] => ... [info] => Array ( ... ) [players] => Array ( ... ) [rules] => Array ( [0] => Array ( [rule] => ... [value] => ... ) [1] => Array ( [rule] => ... [value] => ... ) [2] => Array ( [rule] => ... [value] => ... ) ... ) ) Tātad visai acīmredazmi, ka ar $rules['rules'][0], $rules['rules'][1], ... visu var darbūt ārā. Link to comment Share on other sites More sharing options...
Psycke Posted June 18, 2007 Author Report Share Posted June 18, 2007 (edited) Bet nedabū ārā. Viņš parāda tukšu vietu. Edited June 18, 2007 by Psycke Link to comment Share on other sites More sharing options...
cucumber Posted June 18, 2007 Report Share Posted June 18, 2007 ka vinsh var radit tukshi vietu, ja pats ieprieksh masivu izvadi, takai to neformatejot :) Link to comment Share on other sites More sharing options...
Psycke Posted June 18, 2007 Author Report Share Posted June 18, 2007 Nav ne jausmas, bet neko ārā neizvada. Link to comment Share on other sites More sharing options...
bubu Posted June 18, 2007 Report Share Posted June 18, 2007 Manuprāt tu nesaproti, ko pats dari, un ko mēs tev sakam. Link to comment Share on other sites More sharing options...
Psycke Posted June 18, 2007 Author Report Share Posted June 18, 2007 Ko pats daru es saprotu, bet ir iespējamība, ka nesaprotu, ko jūs man sakat. Link to comment Share on other sites More sharing options...
Val Posted June 18, 2007 Report Share Posted June 18, 2007 Manuprāt, mēs nezinām/nesaprotam ko Tu dari... Link to comment Share on other sites More sharing options...
Psycke Posted June 18, 2007 Author Report Share Posted June 18, 2007 Nu es pamēģināšu uzmest tos visus failus uz paste.php.lv tad kaut ko vairāk varbūt varēsit pateikt. Link to comment Share on other sites More sharing options...
Recommended Posts