Olá, aqui é um código de stream, que irá transmitir ao vivo a partir do seu site.
Créditos vai também para TGYoshi para o código, foi feito apenas algumas edições.
Obrigado a Raggaer, pelo o php! Créditos para a sua ajuda.
Em globalevents/globalevents.xml adicionar esta linha:
<globalevent name="Stream" interval="1" event="script" value="stream.lua"/>
Em globalevents/scripts, crie um novo arquivo .lua com o nome de stream, adicione isto -
function onThink(cid, interval) local cyko = { streampath = io.open('/var/www/cache/stream.json',"w"), streampos = getSpectators({x=1000,y=1000,z=7}, 18, 15, false), --Middle pos of the temple and radius. ghost = false, --You want allow players which using ghost? true of false. } local stream = "{" local generateplayerspos = getThingPos(cid) local generateoutfits = getCreatureOutfit(cid) if cyko.streampos then for i = 1, #cyko.streampos do local cid = cyko.streampos[i] if isPlayer(cid) and isPlayerGhost(cid) == cyko.ghost then stream = stream .. '"'..getCreatureName(cid)..'":['.. generateplayerspos.x ..','.. generateplayerspos.y ..','.. generateplayerspos.z ..','.. generateoutfits.lookType ..','.. generateoutfits.lookAddons ..','.. generateoutfits.lookHead ..','.. generateoutfits.lookBody ..','.. generateoutfits.lookLegs ..','.. generateoutfits.lookFeet ..',0,'.. (getCreatureLookDirection(cid)) ..',' .. generateoutfits.lookTypeEx .. ','.. getCreatureSkullType(cid) ..'],'; end end end stream = stream .. '}' cyko.streampath:write(stream) cyko.streampath:close() return true end
Agora no seu website você pode usar isto -
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Pokemon Portal - Stream</title> <style type="text/css"> .alpha_wrapper { padding-top: 8px; float: left; position: relative; color: #fff; width: 96px; text-align: center; } .name { white-space: nowrap; color: rgb(0, 255, 0); font-size:10px; width: 50%; margin: 0px auto; padding-bottom: 2px; font-family: Verdana; text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black; } .skull { background: transparent url(images/redskull.gif) no-repeat; position: absolute; top: 31px; left: 57px; width: 11px; height: 11px; width: 50%; margin: 0px auto; } </style> </head> <body style="background-image:url('');background-color:#525453;background-repeat:repeat-x;"> <div style="color:white;float:center;text-align:center;margin: 0 auto;text-shadow:0 0 5px #fff;font-family:Georgia,serif;font-weight:strong;font-size:35px;">Pokemon Portal Livestream</div> <div id="onlinecount" style="color:white;clear:both;font-family:Arial, sans-serif;float:center;text-align:center;margin:0 auto">Viewers: 0 - <a href="#" style="color: white;" onclick="window.close();">Close</a></div> <div style="box-shadow:0 0 20px #000;clear:both;font-family:Arial, sans-serif;color:white;width:737px;height:605px;border:2px solid black;margin:5px auto;background-image:url('images/stream.png');text-align:center;overflow:hidden;position:relative;" id="put"></div> <script type="text/javascript"> <!-- function disableSelection(target){ if (typeof target.onselectstart!="undefined") target.onselectstart=function(){return false} else if (typeof target.style.MozUserSelect!="undefined") target.style.MozUserSelect="none" else target.onmousedown=function(){return false} target.style.cursor = "default" } disableSelection(document.body); var uid = Math.floor(Math.random()*(10000000-1))+10000000; function handler(data, hid) { if (hid == 1) { try { var obj = eval("(" + data + ")"); } catch(err) {} var s = ''; for (x in obj) { var k = obj[x]; s += '<div style="z-index:'+(k[1]-20)+';position:absolute;top:'+((k[1]-992)*32-15)+'px;left:'+((k[0]-992)*32-7)+'px;width:64px;height:64px;background:transparent url('; if(k[3] == 0) s += 'images/items/'+k[11]+'.gif'; else s += 'outfitter.php?id='+k[3]+'&addons='+k[4]+'&head='+k[5]+'&body='+k[6]+'&legs='+k[7]+'&feet='+k[8]+'&mount='+k[9]+'&dir='+k[10]; s += ') no-repeat right bottom;">\ <div class="alpha_wrapper">\ <div class="name" style="margin: 5px 19px">'+x.replace(/( )/g,' ')+'<\/div>\ <div style="margin-left: 34px; margin-top: -7px; width: 25px; height: 2px; background-color: rgb(0, 191, 0); border: 1px solid black;"><\/div>'; if(k[12] >= 3) s += '<div class="skull" style="background-image:url(img/'+(k[12] == 3 ? 'white' : (k[12] == 4 ? 'red' : 'black')) + 'skull.gif);"> <\/div>'; s += '<\/div><\/div>'; } document.getElementById('put').innerHTML = s; setTimeout("update", 250); } else { /*setTimeout(update, 3000, 2); document.getElementById('onlinecount').innerHTML = 'Viewers: '+data+' - <a href="http://pportal.net/">Back to Pokemon Portal Website</a>';*/ } } function update(hid) { var xhr; try { xhr=new XMLHttpRequest(); } catch (e) { try { xhr=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xhr=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } if (hid == 1) { xhr.open("GET","/cache/stream.json?"+Math.random(), true); } else { //xhr.open("GET","lv_update.php?id="+uid, true); } xhr.onreadystatechange=function() { if(xhr.readyState==4) { handler(xhr.responseText, hid); setTimeout(update,500,1); } } xhr.send(null); } //setTimeout(update,100,1); handler({"2": ["",1003,1003,6,132,2,115,0,132,114,0,3,0,1], }, 1); update(1); //setTimeout(update,100,2); </script> </body> </html>
Para as outfits você pode usar este -
Outfiter 8.60 - Mostrando Roupas No WebSite
Créditos - Cyko