Forum Games Please help

Discussion relating to game development with Flash

Please help

Postby 12345hassan » October 20th, 2017, 1:58 pm

Hello guys I'm making a modded server of a game and when i join room cant see my self and cant chat
Please help me its C# Problem
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using PlayerIO.GameLibrary;
using System.Drawing;

namespace marketplace
{
public class Player : BasePlayer
{
public string Name;
public bool canChat = true;
public bool onlobby = true;

internal void visible()
{
throw new NotImplementedException();
}
}

[RoomType("marketplace")]
public class GameCode : Game<Player>
{
// This method is called when an instance of your the game is created
public override void GameStarted()
{
// anything you write to the Console will show up in the
// output window of the development server
Console.WriteLine("Game is started: " + RoomId);

// This is how you setup a timer
AddTimer(delegate
{
// code here will code every 100th millisecond (ten times a second)
}, 100);

// Debug Example:
// Sometimes, it can be very usefull to have a graphical representation
// of the state of your game.
// An easy way to accomplish this is to setup a timer to update the
// debug view every 250th second (4 times a second).
AddTimer(delegate
{
// This will cause the GenerateDebugImage() method to be called
// so you can draw a grapical version of the game state.
RefreshDebugView();
}, 250);
}

// This method is called when the last player leaves the room, and it's closed down.
public override void GameClosed()
{
Console.WriteLine("RoomId: " + RoomId);
}

// This method is called whenever a player joins the game
public override void UserJoined(Player player)
{

player.Send("privmsg", player.Id, "joinSuccess", ",");
Broadcast("UserJoined", player.ConnectUserId, PlayerCount, player.Id);
player.onlobby = true;
player.canChat = true;
}

// This method is called when a player leaves the game
public override void UserLeft(Player player)
{
Broadcast("UserLeft", player.Id);
}

// This method is called when a player sends a message into the server code
public override void GotMessage(Player player, Message message)
{
switch (message.Type)
{
// This is how you would set a players name when they send in their name in a
// "MyNameIs" message
case "MyNameIs":
player.Name = message.GetString(0);
break;
}
}

Point debugPoint;

// This method get's called whenever you trigger it by calling the RefreshDebugView() method.
public override System.Drawing.Image GenerateDebugImage()
{
// we'll just draw 400 by 400 pixels image with the current time, but you can
// use this to visualize just about anything.
var image = new Bitmap(400, 400);
using (var g = Graphics.FromImage(image))
{
// fill the background
g.FillRectangle(Brushes.Blue, 0, 0, image.Width, image.Height);

// draw the current time
g.DrawString(DateTime.Now.ToString(), new Font("Verdana", 20F), Brushes.Orange, 10, 10);

// draw a dot based on the DebugPoint variable
g.FillRectangle(Brushes.Red, debugPoint.X, debugPoint.Y, 5, 5);
}
return image;
}

// During development, it's very usefull to be able to cause certain events
// to occur in your serverside code. If you create a public method with no
// arguments and add a [DebugAction] attribute like we've down below, a button
// will be added to the development server.
// Whenever you click the button, your code will run.
[DebugAction("Play", DebugAction.Icon.Play)]
public void PlayNow()
{
Console.WriteLine("The play button was clicked!");
}

// If you use the [DebugAction] attribute on a method with
// two int arguments, the action will be triggered via the
// debug view when you click the debug view on a running game.
[DebugAction("Set Debug Point", DebugAction.Icon.Green)]
public void SetDebugPoint(int x, int y)
{
debugPoint = new Point(x, y);
}
}
}


Please Help
12345hassan
 
Posts: 44
Joined: August 5th, 2016, 11:40 am

Re: Please help

Postby Henrik » October 24th, 2017, 9:49 pm

Run your multiplayer code in the development server, set some breakpoints, connect a client, and see what happens.
Henrik
.IO
 
Posts: 1822
Joined: January 4th, 2010, 1:53 pm

Re: Please help

Postby 12345hassan » October 25th, 2017, 2:49 pm

Well i have fixed it but there is other prob when i connect to game players can see them self only not others
12345hassan
 
Posts: 44
Joined: August 5th, 2016, 11:40 am


Return to Games



cron