Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate

Autor Topic: Automatic Mata-Mata System  (Visto 1716 veces)

0 Miembros and 1 Guest are viewing this topic.

Offline zodiacddos Posteado: January 27, 2021, 12:40:31 AM

  • +1 puntos por ventas
  • *
  • Rank: Liga mayor
  • Posts: 189
  • Gracias recibida: 6862
  • ph
Automatic Mata-Mata System  - Knock Out System

matamata.cpp


Code: [Select]
#include "StdAfx.h"

cMataMata cMata;

void cMataMata :: ResetMEvent ()
{
InitTime = 0;
InitSeconds = 0;
TimeStage = 0;
SecondsStage = 0;
pCount = 0;
mtRunning = false;
Activated = false;
NextStage = false;
Finalize = false;
CurStage = 0;
TotalStages = 0;

for (int m = 0; m <MAXMTSTAGE; m ++)
{
sMata [m] .InCurse = false;
sMata [m] .playerCount = 0;
sMata [m] .InRound [0] = -1;
sMata [m] .InRound [1] = -1;

for (int x = 4800; x <5800; x ++)
{
psPlayer [x] .inMataEvent = 0;
psPlayer [x] .WinnerLoser = 0;
psPlayer [x] .MoveTime = 0;
psPlayer [x] .pFighting = false;
psPlayer [x] .pWaiting = false;
psPlayer [x] .pScore = 0;
psPlayer [x] .Index = -1;
psPlayer [x] .pStage = 0;
sMata [m] .sPlayer [x] .Index = 0;
}
}
}

void cMataMata :: Load ()
{
ResetMEvent ();
}

void cMataMata :: GmCmdInit (LPOBJ lpObj, char * msg)
{
int aIndex = lpObj-> m_Index;
int TempTime = atoi (msg);


if (TempTime <1)
{
MsgOutput (aIndex, "Error configuring the event!");
return;
}

InitTime = TempTime * 60;

if (pObj [aIndex] .mAutority <1)
{
MsgOutput (aIndex, "You don't have the authority to do this.");
return;
}

else if (Activated == true)
{
MsgOutput (aIndex, "Mata-Mata is already activated.");
return;
}
else if (mtRunning == true)
{
MsgOutput (aIndex, "Mata-Mata is already rolling.");
return;
}
else if (psPlayer [aIndex] .inMataEvent! = 0)
{
MsgOutput (aIndex, "You are already busy");
return;
}
else
{
psPlayer [aIndex] .inMataEvent = 2;
Activated = true;
CurStage = 1;
AllServerAnnounce ("% s started Mata-Mata", lpObj-> Name);
MsgOutputAll ("type [/ go] to participate");
}
}

void cMataMata :: PlayerCmdIWant (LPOBJ lpObj)
{
int aIndex = lpObj-> m_Index;

if (mtRunning == true)
{
MsgOutput (aIndex, "Mata-Mata is already rolling.");
return;
}
else if (Activated == false)
{
MsgOutput (aIndex, "Mata-Mata is not activated.");
return;
}
else if (psPlayer [aIndex] .inMataEvent! = 0)
{
MsgOutput (aIndex, "Are you already% s", (sMata-> sPlayer [aIndex] .inMataEvent == 1)? "at the": "busy" event );
return;
}
else if (psPlayer [aIndex].

MsgOutput (aIndex, "You are already waiting.");
return;
}
else
{

psPlayer [aIndex] .pWaiting = true;
psPlayer [aIndex] .pStage = CurStage;
psPlayer [aIndex] .inMataEvent = 1;
int id = GetPlayerCount ();
sMata [CurStage] .aIndex [id] = aIndex;

MsgOutput (aIndex, "You joined Mata-Mata% d", id);
MsgOutput (aIndex, "Be aware that it will start!");
gObjTeleport (aIndex, 6, 72, 160);
sMata [CurStage] .playerCount ++;
}
}

void cMataMata :: MataMataStart ()
{

if (Activated == true && InitTime> 0)
InitSeconds ++;

int TempRest;
TempRest = InitSeconds == (InitTime - 59)? 1: InitSeconds == (InitTime - 119)? 2: InitSeconds == (InitTime - 179)? 3: 4;
if (InitSeconds == (InitTime - 59) || InitSeconds == (InitTime - 119) || InitSeconds == (InitTime - 179) || InitSeconds == (InitTime - 239))
AllServerAnnounce ("Mata-Mata will start in% d minute (s) ", TempRest);

if (InitSeconds == InitTime && mtRunning == false && Activated == true)
{
Activated = false;
InitSeconds = 0;
InitTime = 0;
TimeStage = 0;
SecondsStage = 0;
mtRunning = true;

sMata [CurStage] .InCurse = true;
TotalStages = TotalStage ();
AllServerAnnounce ("MataMata has started!% D", GetPlayerCount ());


if (mtRunning == true)
{

if (NextStage == true)
{
if (TimeStage> 0)
SecondsStage ++;

if (SecondsStage == TimeStage)
{
if (CurStage <TotalStages)
{
if (sMata [CurStage] .InCurse == false)
{
CurStage ++;
sMata [CurStage] .InCurse = true;
TotalStages = TotalStage ();

AllServerAnnounce ("% s", (TotalStages - CurStage) == 0? "[Playoffs] Last Round": (TotalStages - CurStage) == 1? "[Playoffs] Penultimate Round": "[Playoffs ] Next Round ");






AllServerAnnounce ("Mata-mata is over!");
ResetMEvent ();
}
}

NextStage = false;
TimeStage = 0;
SecondsStage = 0;
}
}
}
}

void cMataMata :: SetPlayerToFight (LPOBJ lpObj)
{
int aIndex = lpObj-> m_Index;

if (mtRunning == true && Activated == false && sMata [CurStage] .InCurse == true)
{
if (lpObj-> Connected == 3)
{
int TempContage = CountStagePlayer (CurStage);
int pRander;

if (TempContage> 1)
{
if (sMata [CurStage] .InRound [0] == -1)
{
srand ((unsigned) time (NULL));
pRander = 1 + (rand ()% CountStagePlayer (CurStage));

if (psPlayer [aIndex] .pWaiting == true && psPlayer [aIndex] .pStage == CurStage)
{
if (sMata [CurStage] .aIndex [pRander] == aIndex && psPlayer [aIndex] .pFighting == false)
{
psPlayer [aIndex] .pWaiting = false;
psPlayer [aIndex] .pFighting = true;
gObjTeleport (aIndex, 6, 121, 115);
lpObj-> PkLevel = 6;
GCPkLevelSend (aIndex, 6);
sMata [CurStage] .InRound [0] = aIndex;

}
}
}
if (sMata [CurStage] .InRound [1] == -1)
{
srand ((unsigned) time (NULL));
pRander = 1 + (rand ()% CountStagePlayer (CurStage));
if (psPlayer [aIndex] .pWaiting == true && psPlayer [aIndex] .pStage == CurStage)
{
if (sMata [CurStage] .aIndex [pRander] == aIndex && psPlayer [aIndex] .pFighting == false)
{
psPlayer [aIndex] .pWaiting = false;
psPlayer [aIndex] .pFighting = true;
gObjTeleport (aIndex, 6, 121, 116);
lpObj-> PkLevel = 6;
GCPkLevelSend (aIndex, 6);
sMata [CurStage] .InRound [1] = aIndex;
MsgOutputAll ("% s X% s", gObj [sMata [CurStage] .InRound [0]]. Name, gObj [sMata [CurStage] .InRound [1]]. Name);
}
}
}
}
else if (TempContage == 1) // when 1 is left, throw it to the next stage
{
srand ((unsigned) time (NULL));
int TempCont = 1 + (rand ()% CountStagePlayer (CurStage));

if (psPlayer [aIndex] .pWaiting == true && psPlayer [aIndex] .pStage == CurStage && psPlayer [aIndex] .pFighting == false)
{

psPlayer [aIndex] .pStage ++;
sMata [psPlayer [aIndex] .pStage] .aIndex [CountStagePlayer (psPlayer [aIndex] .pStage)] = aIndex;
MsgOutputAll ("% s went to the next stage via WO", lpObj-> Name);
}
}
else
{

}
}
}
}

void cMataMata :: SetPlayerEstage (LPOBJ lpObj, LPOBJ lpTarget)
{
int aIndex = lpObj-> m_Index;
int tIndex = lpTarget-> m_Index;
int Contp, TempCont;

if (mtRunning == true)
{
if (sMata [CurStage] .InCurse == true)
{
if (psPlayer [aIndex] .inMataEvent> 0 && psPlayer [tIndex] .inMataEvent> 0 && psPlayer [aIndex] .pFighting && psPlayer [ tIndex] .pFighting)
{
sMata [CurStage] .sPlayer [aIndex] .pScore ++;
AllServerAnnounce ("% s% d X% d% s", lpObj-> Name, sMata [CurStage] .sPlayer [aIndex] .pScore, sMata [CurStage] .sPlayer [tIndex] .pScore, lpTarget-> Name);

if (sMata [CurStage] .sPlayer [aIndex] .pScore == 3)
{

psPlayer [aIndex] .pStage ++;
TempCont = CountStagePlayer (psPlayer [aIndex] .pStage);
psPlayer [aIndex] .WinnerLoser = 1;
psPlayer [tIndex] .WinnerLoser = 2;
psPlayer [aIndex] .pFighting = false;
psPlayer [aIndex] .pWaiting = false;
sMata [CurStage] .sPlayer [aIndex] .pScore = 0;
sMata [psPlayer [aIndex] .pStage] .aIndex [TempCont] = aIndex;


sMata [CurStage] .sPlayer [tIndex] .pScore = 0;
psPlayer [tIndex] .inMataEvent = 0;
psPlayer [tIndex] .pFighting = false;
psPlayer [tIndex] .pWaiting = false;
psPlayer [tIndex] .pStage = 0;

AllServerAnnounce ("% s Won% s in Mata-mata", lpObj-> Name, lpTarget-> Name);

if (CountStagePlayer (CurStage) == 0)
{
if (CurStage == TotalStages)
{
AllServerAnnounce ("% s Won the Mata-mata", lpObj-> Name);
TimeStage = 12;
Finalize = true;
NextStage = true;
}
else
{
TimeStage = 12;
if (GetPlayerCount ()> 1)
{
NextStage = true;
sMata [CurStage] .InCurse = false;
}
sMata [CurStage] .InRound [0] = -1;
sMata [CurStage] .InRound [1] = -1;
}
}
}
}
}
}
}

void cMataMata :: MoveOfFightArea (LPOBJ lpObj)
{
int aIndex = lpObj-> m_Index;
if (this-> Activated == true || this-> mtRunning)
{
if (psPlayer [aIndex] .WinnerLoser! = 0)
{
psPlayer [aIndex] .MoveTime ++;
if (psPlayer [aIndex] .MoveTime> = 6)
{
if (psPlayer [aIndex] .WinnerLoser == 1)
{

gObjTeleport (aIndex, 6, 72, 160);
psPlayer [aIndex] .WinnerLoser = 0;
psPlayer [aIndex] .MoveTime = 0;
psPlayer [aIndex] .pWaiting = true;
}
else
{
lpObj-> PkLevel = 3;
GCPkLevelSend (aIndex, 3);
gObjTeleport (aIndex, 6, 69, 93);
psPlayer [aIndex] .WinnerLoser = 0;
psPlayer [aIndex] .MoveTime = 0;
}

}
}
}
}

int cMataMata :: CountStagePlayer (BYTE Stage)
{
int cont = 0;
if (this-> Activated == true || this-> mtRunning)
{
for (int i = 4800; i <5800; i ++)
{
if (gObj [i] .Connected == 3)
{
if (psPlayer [i] .inMataEvent == 1 && psPlayer [i] .pStage == Stage)
{
cont ++;
}
}
}
}
return cont;
}

int cMataMata :: GetPlayerCount ()
{
int cont = 0;
if (this-> Activated == true || this-> mtRunning)
{
for (int i = 4800; i <5800; i ++)
{
if (gObj [i] .Connected == 3)
{
if (psPlayer [i] .inMataEvent == 1)
{
cont ++;
}
}
}
}
return cont;
}

int cMataMata :: GetPlayerWaiting ()
{
int cont = 0;
if (this-> Activated == true || this-> mtRunning)
{
for (int i = 4800; i <5800; i ++)
{
if (gObj [i] .Connected == 3)
{
if (psPlayer [i] .inMataEvent == 1 && psPlayer [i] .pWaiting == true)
{
cont ++;
}
}
}
}
return cont;
}

BYTE cMataMata :: TotalStage ()
{
int stage = 0;
int totalplayer = GetPlayerWaiting ();


if (totalplayer> = 2)
{
if (totalplayer% 2! = 0)
stage = (totalplayer + 1) / 2;
else
stage = totalplayer / 2;
}
else
{
stage = 1;
}

return stage;
}

matamata.h





Offline TryMenow #1 Posteado: February 17, 2021, 12:45:03 PM

  • 0 puntos por ventas
  • *
  • Rank: Dedicado
  • Posts: 35
  • Gracias recibida: 849
  • ph
need only  cpp  and H and just compaile  ? GS ?

what about command ?


Online showmax #2 Posteado: February 19, 2021, 12:20:09 PM

  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 205
  • Gracias recibida: 4574
  • vn

Offline admmunowar #3 Posteado: July 29, 2021, 10:02:05 AM

  • 0 puntos por ventas
  • *
  • Rank: Avanzado
  • Posts: 144
  • Gracias recibida: 4891
  • br
need only  cpp  and H and just compaile  ? GS ?

what about command ?

yes compile, command /go to read the post agian. thanks a lot

Copyright Pro-Yoshi Ms-Emulator © 2021

Offline Lazarocp2020 #4 Posteado: July 29, 2021, 11:47:09 AM

  • Colaborador
  • 0 puntos por ventas
  • *
  • Rank: Destacado
  • Posts: 99
  • Gracias recibida: 1886
  • br

Offline xaxx10 #5 Posteado: July 29, 2021, 08:39:35 PM

  • Colaborador
  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 238
  • Gracias recibida: 6217
  • ar

Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate


 

Related Topics

  Subject / Started by Replies Last post
2 Replies
1401 Views
Last post January 03, 2018, 02:38:15 PM
by Luucaas
2 Replies
1032 Views
Last post March 01, 2018, 06:51:29 PM
by dreams
5 Replies
1535 Views
Last post November 19, 2019, 04:14:07 PM
by legui
3 Replies
1933 Views
Last post December 29, 2018, 10:29:18 PM
by Cloud
3 Replies
658 Views
Last post December 04, 2020, 11:18:34 AM
by El Tio Mata