ID:178180
 
Ok so theres a statpanel called queve and there can only be two players how would i make a check if player1 spot is open then u are player 1. if its not you are player 2.. IF their both taken then it says you have to watch?

How would i do this?
ShadowSiientx wrote:
Ok so theres a statpanel called queve and there can only be two players how would i make a check if player1 spot is open then u are player 1. if its not you are player 2.. IF their both taken then it says you have to watch?

You could create a gamecontroller object, and use variables within that object to control game events like joining and quitting the game. Creating such an object is very simple. I'll provide a simple example:
var
gamecontroller/GameCon = new() // The gamecontroller is a global variable called GameCon.

gamecontroller
var
mob/player1
mob/player2
proc
PlayerJoin(mob/M)
if(player1) // Player 1's seat is taken
player2 = M
M << "You are now player 2"
return 2
else if(player2) // Both seats are taken
M << "Sorry, you have to watch."
return 0
else // Player 2's seat is taken
player1 = M
M << "You are now player 1"
return 1
mob
Login()
if(GameCon.PlayerJoin(src))
// Put here what should happen after player joined the game, switching mob for example.
else
// If both seats are taken, do something else here.

When writing the PlayerQuit proc, just set the playerX variables to null. I also used return codes to determine what position the player got. So if you save the return value you can use it maybe to place the players at different places.
Good luck!


/Andreas
ShadowSiientx wrote:
Ok so theres a statpanel called queve and there can only be two players how would i make a check if player1 spot is open then u are player 1. if its not you are player 2.. IF their both taken then it says you have to watch?

How would i do this?

Well, you should probably start by spelling it "queue".

Lummox JR
In response to Lummox JR
...