27.02.2019, 16:38
Boa tarde, eu estou tentando criar um sistema de tipo guardar vaga, por exemplo... O servidor tiver 90 slots, apenas 80 pode logar e apenas quem for Admin pode logar de boas. Criei aqui mas nгo ta funcionando ;-;
PHP код:
new varVagasServer = 0;
// Quando o player consegue fazer login
varVagasServer ++;
// Quando o player desloga
varVagasServer --;
public OnPlayerRequestClass(playerid, classid)
{
TimerClearTela[playerid] = SetTimerEx("ClearChatLogin", 2000, true, "i", playerid);
if(varVagasServer < 1)
{
KillTimer(TimerClearTela[playerid]);
SendClientMessage(playerid, 0xA9C4E4FF, "Connecting to 144.217.0.35:7777...");
SendClientMessage(playerid, 0xA9C4E4FF, "The server is full. Retrying...");
TimerServerFull[playerid] = SetTimerEx("ServerFull", 3000, true, "i", playerid);
return 1;
}
if(gPlayerLogged[playerid] == 0 && NaoPodeLogar[playerid] == 0)
{
new File[50];
format(File, sizeof(File), "Contas/%s.ini", pName[playerid]);
if(!DOF2::FileExists(File))
{
showDialogRegister(playerid);
}
else if(DOF2::FileExists(File))
{
showDialogLogin(playerid);
}
}
return 1;
}
BPC::ServerFull(playerid)
{
if(varVagasServer < 1)
{
if(gPlayerLogged[playerid] == 0 && NaoPodeLogar[playerid] == 0)
{
new File[50];
format(File, sizeof(File), "Contas/%s.ini", pName[playerid]);
if(!DOF2::FileExists(File))
{
KillTimer(TimerServerFull[playerid]);
showDialogRegister(playerid);
}
else if(DOF2::FileExists(File))
{
KillTimer(TimerServerFull[playerid]);
showDialogLogin(playerid);
}
}
}
else
{
SendClientMessage(playerid, 0xA9C4E4FF, "Connecting to 144.217.0.35:7777...");
SendClientMessage(playerid, 0xA9C4E4FF, "The server is full. Retrying...");
}
return 1;
}