-
[Somente membros podem ver os links. ]
[Somente membros podem ver os links. ]
Hola, me podras ayudar con este error?
Solucionado:
.h
namespace Scape
{
struct pSorteio1
{
int Received[20];
};
class pSorteio
{
public:
static void pSorteio::Randoms();
static bool ReadyNewsSettingss();
static void ThreadNewss(void * lpParam);
};
extern pSorteio1 Sorteio;
}
---------------------------------------------------
.cpp
namespace Scape
{
pSorteio1 Sorteio;
void pSorteio::Randoms()
{
int Sec = 0;
DWORD Received;
for (int i = 4800; i < 5600; i++)
{
if (lpObj[i].Connected >= 3)
{
Sorteio.Received[Sec++] = i; // Gera a lista de players online
}
}
if (Sec > 0)
{
int Index = rand() % Sec; // Faz o sorteio
int Target = Sorteio.Received[Index];
MsgSystem::OutMSG_All("[%s] Fue ganador del sorteo, el proximo seras tu?", lpObj[Target].Name, Target); // Envia a msg para o jogo.
// Envia uma msg avisando o player
MsgSystem::Leftblue(Target, "Ganaste 1 Creatios y una caja Jundum");
ItemSerialCreateSend(Target, lpObj[Target].MapNumber, lpObj[Target].X, lpObj[Target].Y, ITEMGET(14, 22), 0, 0, 0, 0, 0, -1, 0);//creations
ItemSerialCreateSend(Target, lpObj[Target].MapNumber, lpObj[Target].X +1, lpObj[Target].Y, ITEMGET(14, 11), 12, 0, 0, 0, 0, -1, 0);//box kundum +5
Functions::Firework(Target);
LogSystem::MsgLogsgm(Target, "Fue ganador del sorteo, el proximo seras tu?");
}
}
bool pSorteio::ReadyNewsSettingss()
{
_beginthread(&pSorteio::ThreadNewss, 0, 0);
return true;
}
void pSorteio::ThreadNewss(void * lpParam)
{
FILE *fp;
fp = fopen(Dir_News, "r");
if (!fp)
{
MessageBox(NULL, "News.ini not found", "Error", MB_OK);
::ExitProcess(0);
}
fclose(fp);
Sleep(4*60000);//cambias
while (true)
{
pSorteio::Randoms();
Sleep(60*60000);//cambniar
}
_endthread();
}
Last edited by caron22; 10/06/2016 at 03:10 PM.
-
Permissões de Postagem
- Você não pode iniciar novos tópicos
- You may not post Resposta(s)
- Você não pode enviar anexos
- Você não pode editar suas mensagens
-
Regras do Fórum