ok heres my problem.. can anyone help me with what to do.. someone says something in one room.. and now a person who is not in that room is not supposed to see it which they dont at that time but if they go into the room at a later time it will be there for that person.. or say person a says or actions something in room1 and person b is in room1 person b sees it but when person b leaves it leaves their chat screen.. untill they come back into the room provided they havent cleared their chat.. so what i need is for the say and action command to be posted but not be seen when someone wasnt in the room at the time it was said by them if they walk in at a later time.. but it needs to stay in the logs... any ideas? oh and one more problem im having it also deals with the action command or "me text" when a player moves from one room to another it displays to that player you exited south and you entered from the north.. it needs to display to that player only you exited south but still needs to tell everyone else that they exited south and entered from the north... those are the problems im having and its been giving me migranes trying to figure them out 🙁 I cut alot of the stuff i know wasnt pertinant out of the script
<?
$userid=$_COOKIE['login'];
include("db.php");
$query = mysql_query("SELECT * FROM `character` WHERE sessid='$userid' LIMIT 0, 1");
while ($row = @mysql_fetch_array($query))
{
$user=$row["User"];
$password=$row["Password"];
$location=$row["Location"];
$loggedin=$row["Loggedin"];
$admintype=$row["admintype"];
$rest=$row["rest"];
$alive=$row["alive"];
$invisible=$row["invisible"];
$togglepet=$row["togglepet"];
$petn=$row["petname"];
$lvldis=$row["lvldis"];
}
$refresh='y';
$chating = 'n';
$time=time();
$nulltime="UPDATE `character` SET idletime='$time' WHERE sessid='$userid'";
mysql_query($nulltime);
mysql_close();
$explodeit= explode("_" , $location);
$i = 0;
foreach($explodeit as $loop) {
if ($i == 0){
$d = $loop;}
if ($i == 1){
$ns = $loop;}
if ($i == 2){
$ew = $loop;}
if ($i == 3){
$ud = $loop;}
$i++;
}
$arr = explode(' ', $command);
$command1=$arr[0];
$chat=$arr[1];
$three=$arr[2];
$four=$arr[3];
$five=$arr[4];
$command1 = strtolower(trim($command1));
if (($alive=='y') && ($rest == '-1') && ($location != '5_1_1_0')){
include("db.php");
for($i='0'; $i != '2'; $i++){
if ($command1=="n"){
if($i == '0'){
$sqlquery2 = "INSERT INTO `chat` ( poster, say, tell, shout, reciever, shoutfrom, action, description, time, date) VALUES('$user', 'n', 'n', 'n', 'all', '$location', 'y', 'me exited North.', '$time', '$date')";
}else{
$sqlquery2 = "INSERT INTO `chat` ( poster, say, tell, shout, reciever, shoutfrom, action, description, time, date) VALUES('$user', 'n', 'n', 'n', 'all', '$location', 'y', 'me appeared from the South.', '$time', '$date')";
}
$ns++;
}
if ($command1 == "s"){
if($i == '0'){
$sqlquery2 = "INSERT INTO `chat` ( poster, say, tell, shout, reciever, shoutfrom, action, description, time, date) VALUES('$user', 'n', 'n', 'n', 'all', '$location', 'y', 'me exited South.', '$time', '$date')";
}else{
$sqlquery2 = "INSERT INTO `chat` ( poster, say, tell, shout, reciever, shoutfrom, action, description, time, date) VALUES('$user', 'n', 'n', 'n', 'all', '$location', 'y', 'me appeared from the North.', '$time', '$date')";
}
$ns--;
}
if ($command1 == "e"){
if($i == '0'){
$sqlquery2 = "INSERT INTO `chat` ( poster, say, tell, shout, reciever, shoutfrom, action, description, time, date) VALUES('$user', 'n', 'n', 'n', 'all', '$location', 'y', 'me exited East.', '$time', '$date')";
}else{
$sqlquery2 = "INSERT INTO `chat` ( poster, say, tell, shout, reciever, shoutfrom, action, description, time, date) VALUES('$user', 'n', 'n', 'n', 'all', '$location', 'y', 'me appeared from the West.', '$time', '$date')";
}
$ew++;
}
if ($command1 == "w"){
if($i == '0'){
$sqlquery2 = "INSERT INTO `chat` ( poster, say, tell, shout, reciever, shoutfrom, action, description, time, date) VALUES('$user', 'n', 'n', 'n', 'all', '$location', 'y', 'me exited West.', '$time', '$date')";
}else{
$sqlquery2 = "INSERT INTO `chat` ( poster, say, tell, shout, reciever, shoutfrom, action, description, time, date) VALUES('$user', 'n', 'n', 'n', 'all', '$location', 'y', 'me appeared from the East.', '$time', '$date')";
}
$ew--;
}
if ($command1 == "u"){
if($i == '0'){
$sqlquery2 = "INSERT INTO `chat` ( poster, say, tell, shout, reciever, shoutfrom, action, description, time, date) VALUES('$user', 'n', 'n', 'n', 'all', '$location', 'y', 'me exited Up.', '$time', '$date')";
}else{
$sqlquery2 = "INSERT INTO `chat` ( poster, say, tell, shout, reciever, shoutfrom, action, description, time, date) VALUES('$user', 'n', 'n', 'n', 'all', '$location', 'y', 'me appeared from Down.', '$time', '$date')";
}
$ud++;
}
if ($command1 == "d"){
if($i == '0'){
$sqlquery2 = "INSERT INTO `chat` ( poster, say, tell, shout, reciever, shoutfrom, action, description, time, date) VALUES('$user', 'n', 'n', 'n', 'all', '$location', 'y', 'me exited Down.', '$time', '$date')";
}else{
$sqlquery2 = "INSERT INTO `chat` ( poster, say, tell, shout, reciever, shoutfrom, action, description, time, date) VALUES('$user', 'n', 'n', 'n', 'all', '$location', 'y', 'me appeared from Up.', '$time', '$date')";
}
$ud--;
}
$time="$hour:$min";
$date="$month/$day/$year";
mysql_query($sqlquery2);
if ($i == '0'){
$location="$d"._."$ns"._."$ew"._."$ud";
$query2="UPDATE `character` SET Location='$location' WHERE sessid='$userid'";
mysql_query($query2);
}
}
mysql_close();
if (($command1 == "mine") || ($command1 == "fish") || ($command1 == "chop") || ($command1 == "gather")){
Header ('Location: http://www.kahlangame.com/mine_fish.php?command='.$command1);
Break;
}
if (($command1 == 'say') || ($command1 == 'shout') || ($command1 == 'ooc') || ($command1 == 'me') || ($command1 == 'tell')){
$chating = 'y';
include("chat.php");
}
if (($command1== "rest") && ($rest == "-1")){
Header ('Location: http://www.kahlangame.com/rest.php');
Break;
}
}
if ($admintype != "n"){
if (($command1== "warp") && ($location != "5_1_1_0")){
include("db.php");
$warp="UPDATE `character` SET Location='$three' WHERE sessid='$userid' ";
mysql_query($warp);
mysql_close();
}
}
?>