Avatar billede tortur Nybegynder
24. november 2003 - 15:04 Der er 4 kommentarer

Y og X felter 3d chat!

Yo Yo!
Er igang med en 3d chat. Og nu skal jeg have lavet en rykke funktion med y og x felter i databasen v tabel users har jeg en der hedder yfelt xfelt men jeg har ikke helt forstået principet i at og få en baggrund ind så der altså ligger 2 billeder oven på hinanden, samt y og x felterne ! V dog godt at det er noget med en aray ligsom denne
$Y01 = Y01 eller sådan noget jeg vil kunne også godt tænke mig en funktion så figurene ikke står over i hinanden

/Chrstian...
Avatar billede amix Nybegynder
24. november 2003 - 16:27 #1
Dette er enlig ikke php du skal hen og have :)

Du skal placere dine billeder i <div>
Således
<div style="top: 5px; left: 15px; position: absolute;"><img src="bg.gif" alt="Person1" /></div>
<div style="top: 30px; left: 55px; position: absolute;"><img src="billede1.gif" alt="Person1" /></div>

Håber det hjalp :)
Avatar billede tortur Nybegynder
24. november 2003 - 19:40 #2
Jamen i databasen står der jo hvorfor et felt personen står pÅ?
Altså hvor er php kodningen i det????
Andre skal jo kunne se hvor man står!
Avatar billede bastianbi Nybegynder
01. april 2004 - 11:07 #3
<?

include("../inc/sql.php");

$rand = rand(1,1800);
if($rand<10) {
$array2[0][x] = "180";
$array2[0][y] = "140";
$array2[1][x] = "240";
$array2[1][y] = "140";
$array2[2][x] = "300";
$array2[2][y] = "140";
$array2[3][x] = "360";
$array2[3][y] = "140";
$array2[4][x] = "360";
$array2[4][y] = "210";
$array2[6][x] = "300";
$array2[6][y] = "210";
$array2[5][x] = "240";
$array2[5][y] = "210";
$array2[7][x] = "240";
$array2[7][y] = "280";
$array2[8][x] = "300";
$array2[8][y] = "280";
$array2[9][x] = "290";
$array2[9][y] = "280";
$array2[10][x] = "360";
$array2[10][y] = "280";
$x2=$array2[$rand][x];
$y2=$array2[$rand][y];
mysql_query("UPDATE ting SET tingname='And',figur='and.gif',rum='2',x='$x2',y='$y2',owner='0' WHERE(tingname='Trope Plante' && owner='100' && rum='0') LIMIT 1");
// mysql_query("INSERT INTO ting (tingname,figur,rum,x,y) VALUES('And','and.gif','2','$x','$y')") or die("ERROR".mysql_error());
}

if ($action=="changeroom") {
$time = time();
$select_chatten = mysql_query("SELECT id FROM users WHERE(username='Chatten')");

$row_chatten = mysql_fetch_array($select_chatten);

$rum = addslashes($rum);

$select_info = mysql_query("SELECT rum,username,x,y,figur,status FROM users WHERE(id='$id')");

$row_info = mysql_fetch_array($select_info);

if ($rum == $row_info[rum]) {

print "
<Script>


ved ikke helt om det er det her, jeg har selv en 3d chat, men kan sgu ikke lige huske om det er der her du skal bruge..
Avatar billede bastianbi Nybegynder
01. april 2004 - 11:11 #4
<?



include("../inc/sql.php");



$rand = rand(1,1800);

if($rand<10) {

$array2[0][x] = "180";

$array2[0][y] = "200";

$array2[1][x] = "180";

$array2[1][y] = "220";

$array2[2][y] = "260";

$array2[2][x] = "280";

$array2[3][y] = "275";

$array2[3][x] = "285";

$array2[4][y] = "280";

$array2[4][x] = "290";

$array2[5][y] = "295";

$array2[5][x] = "300";

$array2[6][y] = "325";

$array2[6][x] = "350";

$array2[7][y] = "340";

$array2[7][x] = "370";

$array2[8][y] = "475";

$array2[8][x] = "485";

$array2[9][x] = "595";

$array2[9][x] = "605";

$array2[10][x] = "615";

$array2[10][x] = "610";

$x2=$array2[$rand][x];

$y2=$array2[$rand][y];

mysql_query("UPDATE ting SET tingname='And',figur='and.gif',rum='2',x='$x2',y='$y2',owner='0' WHERE(tingname='Trope Plante' && owner='100' && rum='0') LIMIT 1");

// mysql_query("INSERT INTO ting (tingname,figur,rum,x,y) VALUES('And','and.gif','2','$x','$y')") or die("ERROR".mysql_error());

}



if ($action=="changeroom") {

$time = time();

$select_chatten = mysql_query("SELECT id FROM users WHERE(username='Chatten')");



$row_chatten = mysql_fetch_array($select_chatten);



$rum = addslashes($rum);



$select_info = mysql_query("SELECT rum,username,x,y,figur,status FROM users WHERE(id='$id')");



$row_info = mysql_fetch_array($select_info);



if ($rum == $row_info[rum]) {



print "

<Script>



parent.info.location = 'info.php?action=changeroom'



alert('Du er der allerede');

parent.chat.document.getElementById('loading').style.visibility = 'hidden';

</Script>



";



exit;



}



$select_roominfo = mysql_query("SELECT roommax,roomname,botmes,id,roomlukind,rum FROM users WHERE(room='$rum')");



$row_roominfo = mysql_fetch_array($select_roominfo);







$select_visitors = mysql_query("SELECT id FROM users WHERE(rum='$rum')");



if ($row_roominfo[roommax] <= mysql_num_rows($select_visitors)) {



print "



<Script>

alert('Rummet er fyldt ($row_roominfo[roommax]/".mysql_num_rows($select_visitors).")');

parent.info.location = 'info.php?action=changeroom'

parent.chat.document.getElementById('loading').style.visibility = 'hidden';



</Script>



";



exit;



}





if ($rum>99 && $row_roominfo[roomlukind]=="ja" && !$li && $row_roominfo[id]!=$id  && $row_info[status]==0) {



mysql_query("INSERT INTO chat (rum,text,script,time,f,t) VALUES('$row_roominfo[rum]','$row_info[username] beder om at komme ind.','win = window.open(\"lukind.php?uid=$id&frame=true\",\"$id\",\"width=300,height=100\");','$time','$row_chatten[id]','$row_roominfo[id]')");



print mysql_error();



exit;

}





include("startfrom.php");



mysql_query("UPDATE users SET rum='$rum' WHERE(id='$id')");

if($id!=$row_roominfo[id]) {

mysql_query("UPDATE users SET roomvisits=roomvisits+1 WHERE(room='$rum')");

}



mysql_query("INSERT INTO chat (rum,text,time,f,t) VALUES('$row_info[rum]','$row_info[username] er gået til [$rum] $row_roominfo[roomname].','$time','$row_chatten[id]','0')");



mysql_query("INSERT INTO chat (rum,text,time,f,t) VALUES('$rum','$row_info[username] er kommet til [$rum] $row_roominfo[roomname].','$time','$row_chatten[id]','0')");







print "



<Script>\n";



if ($smidud) {



print "alert(\"Du blev smidt ud af rummet\")";



}



print "



parent.chat.location='chat.php';



parent.beskeder.location='beskeder.php';



parent.besked.location='besked.php';



parent.bot.location='bot.php';



</Script>



";

exit;



}



$loader="° ";

?>



<html>







<head>

<script language="JavaScript1.2">



if (window.Event)



  document.captureEvents(Event.MOUSEUP);







function nocontextmenu()



{



event.cancelBubble = true



event.returnValue = false;







return false;



}







function norightclick(e)



{



if (window.Event)



{



  if (e.which == 2 || e.which == 3)



  return false;



}



else



  if (event.button == 2 || event.button == 3)



  {



  event.cancelBubble = true



  event.returnValue = false;



  return false;



  }







}







document.oncontextmenu = nocontextmenu;



document.onmousedown = norightclick;



mydiv = parent.chat.document.getElementById('loading2').style;



mydiv.visibility = "visible";





</script>



<script>

var timer = 0;

function reloadMe(){

    if( timer == 10 ){

    document.location.replace("bot.php");

    } else {

      timer++;

        setTimeout("reloadMe()",1000);

    }

}

</script>





<link rel="stylesheet" HREF="http://www.nss.frac.dk/style.css" type="text/css">

<meta name="generator" content="Namo WebEditor v5.0(Trial)">

</head>



<body onload="reloadMe();" bgcolor="#666666" color="#000000">





<font size="2" face="verdana" color="#000000"><?=$loader?>

<?

flush();

$select_check = mysql_query("SELECT onlinechat FROM users WHERE(id='$id')");

$row_check = mysql_fetch_array($select_check);

if (!$id || $row_check[onlinechat]=="0") {

print "

<Script>



window.top.close();



</Script>

";

}

print $loader;

mysql_query("DELETE FROM chat WHERE(text LIKE '%<Script>%')");



if ($action=="chatvindue") {



print "



<Script>



parent.beskeder.location='beskeder.php';



</Script>



";



}



print $loader;



$result_info = mysql_query("SELECT rum,status,startfrom,username,figur,x,y,usernamecolor FROM users WHERE(id='$id')");



$row_info = mysql_fetch_array($result_info);







if ($move=="ok") {



mysql_query("LOCK TABLES users WRITE,ting READ,chat READ");



$result_movecheck = mysql_query("SELECT id,username FROM users WHERE(rum='$row_info[rum]' && x='$x' && y='$y')");



if ($row_info[status]=="0") {



$result_movecheck2 = mysql_query("SELECT x FROM felter WHERE(x='$x' && y='$y' && rum='$row_info[rum]')");



} else {



$result_movecheck2 = mysql_query("SELECT x FROM felter WHERE(rum='a')");



}



if (@mysql_num_rows($result_movecheck) == 0 && @mysql_num_rows($result_movecheck2) == 0) {



flush();



mysql_query("UPDATE users SET x='$x',y='$y' WHERE(id='$id')");



}



mysql_query("UNLOCK TABLES users,ting");



}



print ("



<Script>



parent.chat.document.getElementById('usernamediv').innerHTML = '<a href=\"info.php?action=showuser&uid=$id\" target=\"info\"><nobr><font color=$row_info[usernamecolor]>$row_info[username]'



parent.chat.document.images['userfigure'].src='../gfx/figurer/$row_info[figur]'\n

</Script>



");







$result_info2 = mysql_query("SELECT x,y,room FROM users WHERE(id='$id')");



$row_info2 = mysql_fetch_array($result_info2);







print "



<Script>



mydiv = parent.chat.document.getElementById('userdiv').style;



mydiv.left = $row_info2[x]-0;



mydiv.top = $row_info2[y]-0;







mydiv = parent.chat.document.getElementById('usernamediv').style;



mydiv.left = $row_info2[x]-0;



mydiv.top = $row_info2[y]+60;



</Script>$loader



";











print "<Script>



var i='0';

var y=-70;



var x='0';



while (i < 35) {

if (i%7==0) {



y=y+70;



x=0;



}

parent.chat.document.images['felt-'+x+'-'+y].src='../gfx/spacer.gif'\n



parent.chat.document.images['ting-'+x+'-'+y].src='../gfx/spacer.gif'\n



parent.chat.document.images['pickup-'+x+'-'+y].src='../gfx/spacer.gif'\n







parent.chat.document.getElementById('username-'+x+'-'+y).innerHTML = ''



parent.chat.document.getElementById('bobbel-'+x+'-'+y).innerHTML = ''



i++;



x=x+60;

}

document.write('$loader');

";





$chattere=0;

$select = mysql_query("SELECT x,y,username,figur,usernamecolor,id FROM users WHERE(rum='$row_info[rum]')");



while($row = mysql_fetch_array($select))



{

$chattere++;



if ($row[id] != $id) {



print "



parent.chat.document.images['felt-$row[x]-$row[y]'].src='../gfx/figurer/$row[figur]'



parent.chat.document.getElementById('username-$row[x]-$row[y]').innerHTML = '<a href=\"info.php?action=showuser&uid=$row[id]\" target=\"info\"><nobr><font color=$row[usernamecolor]>$row[username]'



";



flush;



}



$time=time();



$select_chat = mysql_query("SELECT text FROM chat WHERE($time-time < 15 && f='$row[id]') ORDER BY id DESC LIMIT 1");



$row_chat = mysql_fetch_array($select_chat);





if ($id==$row[id]) {

print "

parent.besked.document.getElementById('x').innerHTML = '$row[x]'

parent.besked.document.getElementById('y').innerHTML = '$row[y]'

";

}





print "



parent.chat.document.getElementById('bobbel-$row[x]-$row[y]').innerHTML = '$row_chat[text]'



";



flush;



}







$select = mysql_query("SELECT x,y,figur,id FROM ting WHERE(rum='$row_info[rum]')");



while($row = mysql_fetch_array($select))



{



if ($row[x] == $row_info2[x] && $row[y] == $row_info2[y]) {



if ($row_info[rum] == $row_info2[room] || $row_info[rum] < 100) {



print "



parent.chat.document.images['pickup-$row[x]-$row[y]'].src='../gfx/info.gif'







parent.chat.document.all['pickup2-$row[x]-$row[y]'].href='info.php?action=showthing&tid=$row[id]'



";



}



}



print "



parent.chat.document.images['ting-$row[x]-$row[y]'].src='../gfx/ting/$row[figur]'



\n



";



}





$select_online_users = mysql_query("SELECT id FROM users WHERE(rum!='0')");



$select_roominfo = mysql_query("SELECT roommax,roomname,roombgpic FROM users WHERE(room='$row_info[rum]')");



$row_roominfo = mysql_fetch_array($select_roominfo);



print "

parent.chat.document.backgroundImage='../gfx/rum/$row_roominfo[roombgpic]'

parent.chat.document.getElementById('info').innerHTML = '<font color=\"#FFFFFF\">Chattere i $row_roominfo[roomname]:<b>$chattere</b>/<b>$row_roominfo[roommax]</b><br>Online Ialt: <b>".mysql_num_rows($select_online_users)."</b> '



</Script>$loader";







$time=time();



mysql_query("UPDATE users SET answer='$time' WHERE(id='$id')");







$select_info = mysql_query("SELECT botmes FROM users WHERE(id='$id')");



$row_info = mysql_fetch_array($select_info);







if ($row_info[botmes] != "") {



print "<font color=\"red\">$row_info[botmes]</font>";



mysql_query("UPDATE users SET botmes='' WHERE(id='$id')");



}



?>





<script>



mydiv = parent.chat.document.getElementById('loading').style;



mydiv.visibility = "hidden";



mydiv = parent.chat.document.getElementById('loading2').style;



mydiv.visibility = "hidden";

</Script>



</font></body>



</html>



her er hele filen :D håber du kan få det til at virker ;-)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester