public OnGameModeInit()
static SeraHumano;
public OnGameModeInit()
{
SeranHumanos = 1;
SetTimer("YaNoLoSeran", (60*1000), false);
return 1;
}
public YaNoLoSeran()
{
SeranHumanos = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(SeranHumanos == 1)
{
//codigo para el humano
} else
{
//zombis
}
return 1;
}
public OnPlayerRequestClass(playerid, classid)
en onplayerequestclass puedes returnar 0 si el timer esta activado, es decir si quieren elegir el team de humanos returna 0, con las variables que te dio justbored
|
new GameStarted = false; // ayuda a que cuando el TIMER termina se activa y obliga al el usuario a server ZOMBIe
public OnPlayerSpawn(playerid)
{
if(!GameStarted) gTeam[playerid] = TEAM_HUMANOS;
if(gTeam[playerid] == TEAM_HUMANOS)
{
ResetPlayerWeapons(playerid);
SetPlayerTeam(playerid,0);
SetPlayerSkin(playerid,285);
new randomskin = random(3);
switch(randomskin)
{
case 0: SetPlayerSkin(playerid, 119);
case 1: SetPlayerSkin(playerid, 285);
case 2: SetPlayerSkin(playerid, 216);
}
}
if(GameStarted) gTeam[playerid] = TEAM_ZOMBIE;// aquн esta
if(gTeam[playerid] == TEAM_ZOMBIE)
{
SendClientMessage(playerid, -1, "Lo sentimos, pero ya empezу el juego");
SetPlayerTeam(playerid, 1);
GivePlayerWeapon(playerid, 9, 1);
SetPlayerSkin(playerid, 163);
}
return 1;
}
forward UpdateTime(playerid);
public UpdateTime(playerid)
{
new Str[34];
TimeS --;
if(TimeM == 0 && TimeS == 0)
{
KillTimer(Time);
}
if(TimeS == -1)
{
TimeM--;
TimeS = 59;
}
format(Str, sizeof(Str), " %02d:%02d", TimeM, TimeS);
TextDrawSetString(conteo1, Str);
if(TimeS == 0)
{
RandomPlayer(playerid);
GameStarted = true;
}
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
//============================================================================//
SetPlayerClass(playerid, classid);
switch (classid)
{
case 0: GameTextForPlayer(playerid, "~r~HUMANO", 2000, 3);
case 1: GameTextForPlayer(playerid, "~b~ZOMBIE", 2000, 3);
}
return 1;
}
//==============================================================================
SetPlayerClass(playerid, classid)
{
switch(classid)
{
case 0: { gTeam[playerid] = TEAM_HUMANOS; SetPlayerTeam(playerid, TEAM_HUMANOS); }
case 1: { gTeam[playerid] = TEAM_ZOMBIE; SetPlayerTeam(playerid, TEAM_ZOMBIE); }
}
}