21/10/2023 09:08
(Esta mensagem foi modificada pela última vez a: 21/10/2023 09:09 por GuiLopeS.)
Mano acho que consegui resolver, fiz assim
Isso está certo ou vai dar problema? e outra coisa, preciso matar o timer?
Código PHP:
new Cameras;
new Cam[MAX_PLAYERS];
CMD:irmg(playerid, params[])
{
new string[100];
if(MGON == false)
{
SendClientMessage(playerid, -1, "Nenhum minigame aberto no momento!");
return 1;
}
if(PlayerNoMG[playerid] == 1)
{
SendClientMessage(playerid, -1, "Voce ja esta no minigame!");
return 1;
}
if(MGAcontecendo == true)
{
SendClientMessage(playerid, -1, "O minigame ja iniciou!");
return 1;
}
if(MGON == true && Snipers >= 12 && Cars >= 12)
{
format(string, sizeof(string), "Evento minigame esta cheio,tente na proxima rodada.");//
SendClientMessage(playerid,-1,string);
}
if(MGON == true && Balance == 0)
{
Rank ++;
Snipers += 1;
Balance = 1;
ResetPlayerWeapons(playerid);
Equipes[playerid] = 1;
PlayerNoMG[playerid] = 1;
SetPlayerVirtualWorld(playerid,50);
new rand = random(sizeof(SpawnSnipers));
SetPlayerPos(playerid, SpawnSnipers[rand][0], SpawnSnipers[rand][1], SpawnSnipers[rand][2]);
TogglePlayerControllable(playerid, false);
SetPlayerHealth(playerid, Float:15.0);
GivePlayerWeapon(playerid, 34, 99999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SNIPERRIFLE, 999);
Camera1(playerid); //aqui chama a callback
format(string, sizeof(string), "%s juntou-se a equipe snipers!", GetPlayerNameEx(playerid));
SendClientMessageToAll(-1, string);
}
else if(MGON == true && Balance == 1)
{
Rank ++;
Cars += 1;
Balance = 0;
Equipes[playerid] = 2;
ResetPlayerWeapons(playerid);
PlayerNoMG[playerid] = 1;
PlayerNoInfernus[playerid] = 0;
SetPlayerVirtualWorld(playerid,50);
SetVehicleVirtualWorld(SInfernus[playerid],50);
PutPlayerInVehicle(playerid, SInfernus[playerid], 0);
TogglePlayerControllable(playerid, false);
SetPlayerHealth(playerid, Float:15.0);
Camera1(playerid); //aqui chama a callback
format(string, sizeof(string), "%s juntou-se a equipe carros!", GetPlayerNameEx(playerid));
SendClientMessageToAll(-1, string);
}
return 1;
}
forward Camera1(playerid);
public Camera1(playerid)
{
if(Cameras == 0)
{
InterpolateCameraPos(playerid, 1637.531738, -2512.643066, 38.203601, 1596.504028, -2587.914062, 79.733818, 3000);
InterpolateCameraLookAt(playerid, 1637.570068, -2508.001708, 36.344413, 1600.545288, -2587.908203, 76.789672, 3000);
Cam[playerid] = SetTimerEx("Camera2", 3000, false, "i", playerid);
}
}
forward Camera2(playerid);
public Camera2(playerid)
{
if(Cameras == 0)
{
InterpolateCameraPos(playerid, 1596.504028, -2587.914062, 79.733818, 1634.439697, -2651.810546, 41.962860, 3000);
InterpolateCameraLookAt(playerid, 1600.545288, -2587.908203, 76.789672, 1634.262695, -2656.480224, 40.184379, 3000);
Cam[playerid] = SetTimerEx("Camera3", 3000, false, "i", playerid);
}
}
forward Camera3(playerid);
public Camera3(playerid)
{
if(Cameras == 0)
{
InterpolateCameraPos(playerid, 1634.439697, -2651.810546, 41.962860, 1596.504028, -2587.914062, 79.733818, 3000);
InterpolateCameraLookAt(playerid, 1634.262695, -2656.480224, 40.184379, 1600.545288, -2587.908203, 76.789672, 3000);
Cam[playerid] = SetTimerEx("Camera4", 3000, false, "i", playerid);
}
}
forward Camera4(playerid);
public Camera4(playerid)
{
if(Cameras == 0)
{
InterpolateCameraPos(playerid, 1596.504028, -2587.914062, 79.733818, 1637.531738, -2512.643066, 38.203601, 3000);
InterpolateCameraLookAt(playerid, 1600.545288, -2587.908203, 76.789672, 1637.570068, -2508.001708, 36.344413, 3000);
Cam[playerid] = SetTimerEx("Camera1", 3000, false, "i", playerid);
}
}
forward ContDownGO(playerid);
public ContDownGO(playerid)
{
Count = 0;
PlayerPlaySound(playerid, 1057,0,0,0);
GameTextForAll("~g~GO!!!",1000,6);
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if (PlayerNoMG[i] == 1)
{
PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
TogglePlayerControllable(i, true);
SetCameraBehindPlayer(i); //aqui faz o jogador voltar a camera atras dele
}
}
}
SendClientMessageToAll(0x33AA33AA, "O minigame iniciou!");
MGAcontecendo = true;
Cameras = 1;
return 1;
}
Isso está certo ou vai dar problema? e outra coisa, preciso matar o timer?