pawn Код:
PUB:Gamemodes()
{
new
Float:x, Float:y, Float:z, rnd,
string[78]
;
if(gDerbyPlayers > 0)
{
if(gDerbyCooldown > 0) gDerbyCooldown--;
else if(gDerbyCooldown == 0) gDerbyCooldown = -1;
foreach(Player, i)
{
if(SpawnMode[ i ] == SPAWNMODE_DERBY)
{
if(gDerbyCooldown == 3) GameTextForPlayer(i, "~r~3", 1000, 3), PlayerPlaySound(i, 1056, 0, 0, 0);
else if(gDerbyCooldown == 2) GameTextForPlayer(i, "~r~~h~2", 1000, 3), PlayerPlaySound(i, 1056, 0, 0, 0);
else if(gDerbyCooldown == 1) GameTextForPlayer(i, "~y~1", 1000, 3), PlayerPlaySound(i, 1056, 0, 0, 0);
else if(gDerbyCooldown == 0)
{
GameTextForPlayer(i, "~g~GO", 2000, 3);
TogglePlayerControllable(i, true);
SetCameraBehindPlayer(i);
PlayerPlaySound(i, 1057, 0, 0, 0);
}
else if(gDerbyCooldown < 0)
{
if(PlayerInfo[ i ][ InDerbyArea ] == 1)
{
RepairVehicle(GetPlayerVehicleID( i ));
GetPlayerPos(i, x, y, z);
if(z <= 12)
{
PlayerInfo[ i ][ InDerbyArea ] = 0, gDerbyPlayers--;
format(string, sizeof(string), ">> DERBY: %s(%d) lost (fell, players: %d/15)", PlayerInfo[ i ][ PlayerName ], i, gDerbyPlayers);
SendClientMessageToAll(COLOR_ORANGE, string);
rnd = random(sizeof(DerbySpectatorSpawnPoints));
SetPlayerPosEx(i, 0, DerbySpectatorSpawnPoints[rnd][0], DerbySpectatorSpawnPoints[rnd][1], DerbySpectatorSpawnPoints[rnd][2]);
SetPlayerFacingAngle(i, DerbySpectatorSpawnPoints[rnd][3]);
if(gDerbyPlayers == 1)
{
foreach(Player, winnerid)
{
if(SpawnMode[ winnerid ] != SPAWNMODE_DERBY) continue;
else if(PlayerInfo[ winnerid ][ InDerbyArea ] == 0) continue;
format(string, sizeof(string), ">> DERBY: %s(%d) is the winner!", PlayerInfo[ winnerid ][ PlayerName ], winnerid);
SendClientMessageToAll(COLOR_ORANGE, string);
ResetDerby();
break;
}
}
else if(gDerbyPlayers <= 0) ResetDerby();
}
}
}
}
}
}
if(gZombiePlayers > 0)
{
if(gZSCooldown > 0) gZSCooldown -= 5;
else if(gZSCooldown == 0)
{
new
ZombifyCounter = random(2)
;
foreach(Player, i)
{
if(SpawnMode[ i ] != SPAWNMODE_ZOMBIE) continue;
else if(GetPlayerTeam( i ) == TEAM_ZOMBIES) continue;
if(ZombifyCounter >= 1)
{
ZombifyCounter--;
continue;
}
else if(ZombifyCounter <= 0)
{
SetPlayerTeam(i, TEAM_ZOMBIES), SetPlayerColor(i, COLOR_NOTES2);
SetPlayerHealth(i, 500), SetPlayerArmour(i, 250);
ResetPlayerWeapons(i), GivePlayerWeapon(i, WEAPON_CHAINSAW, 9999);
GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~r~ZOMBIFIED", 3000, 3);
gZSCooldown = -1;
break;
}
}
}
gZSTimer -= 5;
format(string, sizeof(string), "%d~n~~n~~n~~n~~n~~n~~n~~w~%s", gZSTimer, MapName());
TextDrawSetString(Textdraw[4], string);
foreach(Player, i)
{
if(SpawnMode[ i ] != SPAWNMODE_ZOMBIE) continue;
if(gZSTimer >= 5)
{
TextDrawShowForPlayer(i, Textdraw[4]);
continue;
}
else
{
GameTextForPlayer(i, "~n~~n~~n~~n~~n~~n~~n~~r~TIMES UP", 3000, 3);
GivePlayerCash(i, randomEx(500, 5000));
SetPlayerTeam(i, TEAM_HUMANS);
switch(gZombieMap)
{
case MAP_LS_SEWER:
{
gZombieMap = MAP_LV_DESERT;
rnd = random(sizeof(HumanSpawnPoints2));
SetPlayerPosEx(i, 0, HumanSpawnPoints2[rnd][0], HumanSpawnPoints2[rnd][1], HumanSpawnPoints2[rnd][2]);
SetPlayerFacingAngle(i, HumanSpawnPoints2[rnd][3]);
}
case MAP_LV_DESERT:
{
gZombieMap = MAP_LS_SEWER;
rnd = random(sizeof(HumanSpawnPoints1));
SetPlayerPosEx(i, 0, HumanSpawnPoints1[rnd][0], HumanSpawnPoints1[rnd][1], HumanSpawnPoints1[rnd][2]);
SetPlayerFacingAngle(i, HumanSpawnPoints1[rnd][3]);
}
}
}
}
if(gZSTimer <= 0)
{
gZSTimer = 180;
gZSCooldown = 10;
}
}
return 1;
}
But as you can see, It's kinda messy.
Any ways to fix/optimize it? (I already have TWO 1-sec timers controlling things, I don't think is splitting it would be a good idea xD)