rendered paste body#define CHECKPOINT_Epsilon_roof 0
#define CHECKPOINT_Epsilon_exit 1
new gPlayerCheckpointStatus[MAX_PLAYERS];
new iSpawnSet[MAX_PLAYER_NAME];
new gTeam[MAX_PLAYERS];
new FBI[MAX_PLAYERS];
new Epsilon[MAX_PLAYERS];
new timer[MAX_PLAYERS];
main()
{
print("\n----------------------------------");
print(" Epsilon mode");
print("----------------------------------\n");
}
new Float:gFBIPlayerSpawns[8][3] = {
{1548.2354,-1621.2896,13.5469},
{1552.6829,-1633.9832,13.5471},
{1579.8448,-1634.4973,13.5624},
{1575.6954,-1620.0453,13.5469},
{1584.0736,-1640.0416,13.1980},
{1586.1625,-1684.8322,6.2252},
{1576.5155,-1697.2535,6.2188},
{1579.9263,-1718.0020,6.2188}
};
new Float:gRandomPlayerSpawns[10][3] = {
{230.6167,1033.9188,1084.0160},
{240.2970,1030.3428,1084.0078},
{243.4144,1027.5930,1084.0078},
{240.7879,1025.0343,1084.0078},
{239.6635,1047.9120,1084.0000},
{229.2859,1048.3597,1084.0116},
{253.8993,1034.9791,1084.7371},
{239.0930,1027.4656,1088.3044},
{237.9771,1033.9716,1088.3125},
{230.8094,1031.7358,1088.3125}
};
public IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if (x > minx && x < maxx && y > miny && y < maxy) return 1;
return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
switch (gPlayerCheckpointStatus[playerid])
{
case CHECKPOINT_Epsilon_roof: {
GameTextForPlayer(playerid, "~r~Last 1 minute!!", 5000, 3);
DisablePlayerCheckpoint(playerid);
}
case CHECKPOINT_Epsilon_exit: {
SetPlayerPos(playerid, 1124.7273,-2037.0930,69.8833);
SetPlayerInterior(playerid,0);
GameTextForPlayer(playerid, "~b~Dont let the FBI reach ~n~the roof!", 5000, 3);
}
}
return 1;
}
public Epsilon_exit()
{
for (new i = 0; i < MAX_PLAYERS; i++) // i = playerid
{
if (IsPlayerConnected(i))
{
if (IsPlayerInArea(i,224.1284,254.9495,1021.5915,1050.9854))
{
if(Epsilon[i] == 0) {
gPlayerCheckpointStatus[i] = CHECKPOINT_Epsilon_exit;
SetPlayerCheckpoint(i,225.8974,1024.4899,1084.0078,3);
}
else
{
DisablePlayerCheckpoint(i);
}
}
}
}
return 1;
}
public Epsilon_roof(playerid)
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if (IsPlayerInArea(i,958.1008,1767.4678,-2446.5652,-1490.9896))
{
if(FBI[playerid] == 0) {
gPlayerCheckpointStatus[i] = CHECKPOINT_Epsilon_roof;
SetPlayerCheckpoint(i,1110.9550,-2036.8781,74.4297,3);
}
else
{
DisablePlayerCheckpoint(i);
}
}
}
}
return 1;
}
public SetPlayerRandomSpawn(playerid)
{
if (iSpawnSet[playerid] == 1)
{
new rand = random(sizeof(gFBIPlayerSpawns));
SetPlayerPos(playerid, gFBIPlayerSpawns[rand][0], gFBIPlayerSpawns[rand][1], gFBIPlayerSpawns[rand][2]);
SetPlayerFacingAngle(playerid, 270.0);
SetPlayerInterior(playerid,0);
FBI[playerid] = 0;
Epsilon[playerid] = 1;
SendClientMessage(playerid, COLOR_RED, "You are the FBI, Raid the Epsilon cult's HQ and breach their Roof!");
}
else if (iSpawnSet[playerid] == 0)
{
new rand = random(sizeof(gRandomPlayerSpawns));
SetPlayerInterior(playerid,7);
FBI[playerid] = 1;
Epsilon[playerid] = 0;
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are A member of The Epsilon cult! Protect your base from the FBI, dont let them reach the Roof!");
SetPlayerPos(playerid, gRandomPlayerSpawns[rand][0], gRandomPlayerSpawns[rand][1], gRandomPlayerSpawns[rand][2]);
}
return 1;
}
public OnGameModeInit()
{
print("GameModeInit()");
SetTimer("Epsilon_roof", 500,1);
SetTimer("Epsilon_exit", 500,1);
SetTimer("FBIarea", 500, 1);
SetTimer("epsilonwin", 600000, 1);
SetGameModeText("Epsilon Base");
AddPlayerClass(26, 0, 0, 0, 0, 30, 500, 24, 50, 27, 50);
AddPlayerClass(280, 0, 0, 0, 0, 31, 500, 29, 250, 25, 50);
AddPlayerClass(281, 0, 0, 0, 0, 31, 500, 29, 250, 25, 50);
AddPlayerClass(282, 0, 0, 0, 0, 31, 500, 29, 250, 25, 50);
AddPlayerClass(283, 0, 0, 0, 0, 31, 500, 29, 250, 25, 50);
AddPlayerClass(284, 0, 0, 0, 0, 31, 500, 29, 250, 25, 50);
AddPlayerClass(285, 0, 0, 0, 0, 31, 500, 29, 250, 25, 50);
AddPlayerClass(286, 0, 0, 0, 0, 31, 500, 29, 250, 25, 50);
AddPlayerClass(288, 0, 0, 0, 0, 31, 500, 29, 250, 25, 50);
//Cars
AddStaticVehicle(599,1601.0603,-1687.8479,6.0820,270.3826,0,1); // FBI car
AddStaticVehicle(599,1603.3297,-1617.4534,13.6891,89.6575,0,1); // FBI car
AddStaticVehicle(596,1603.8232,-1624.9268,13.2296,88.7522,0,1); // FBI car
AddStaticVehicle(528,1601.6302,-1696.3120,5.9342,269.2025,0,0); // FBI car
AddStaticVehicle(427,1545.0741,-1627.9938,13.5143,88.2601,0,1); // FBI car
AddStaticVehicle(596,1591.6588,-1710.7622,5.6111,179.7354,0,1); // FBI car
AddStaticVehicle(523,1608.4923,-1624.7872,13.2901,0.1041,0,0); // FBI car
AddStaticVehicle(490,1578.2438,-1711.5015,6.0180,358.6937,0,0); // FBI car
AddStaticVehicle(490,1564.0541,-1711.7720,6.0196,358.7939,0,0); // FBI car
AddStaticVehicle(596,1544.0647,-1684.6614,5.6118,89.8380,0,1); // FBI
AddStaticVehicle(416,1568.0726,-1694.7412,6.0399,178.0464,1,3); // FBI car
AddStaticVehicle(490,1603.6786,-1612.3132,13.6325,88.2403,0,0); // FBI car
AddStaticVehicle(601,1545.7424,-1607.4641,13.1416,89.7383,1,1); // FBI car
AddStaticVehicle(601,1546.5480,-1613.1924,13.1416,90.1744,1,1); // FBI car
AddStaticVehicle(582,1294.3265,-2037.4415,58.2412,107.4483,114,118); // ped car
AddStaticVehicle(575,1243.2711,-2039.5317,59.5764,16.3428,66,96); // epsilon car
AddStaticVehicle(575,1243.6029,-2034.0355,59.5670,163.3846,51,96); // epsilon car
AddStaticVehicle(555,1277.2831,-2012.0912,58.6153,269.6451,36,1); // epsilon car
AddStaticVehicle(555,1277.2953,-2008.8119,58.6088,270.1413,13,1); // epsilon car
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
printf("OnPlayerRequestClass(%d, %d)", playerid, classid);
SetPlayerPos(playerid, 1206.0442,-2037.1831,69.0078);
SetPlayerFacingAngle(playerid, 265.7500);
SetPlayerInterior(playerid, 0);
SetPlayerCameraPos(playerid, 1210.1479,-2037.0507,69.0078);
SetPlayerCameraLookAt(playerid, 1206.0442,-2037.1831,69.0078);
switch (classid) {
case 0:
{
iSpawnSet[playerid] = 0;
GameTextForPlayer(playerid, "~b~Epsilon", 1000, 6);
gTeam[playerid] = TEAM_Epsilon;
}
case 1, 2, 3, 4, 5, 6, 7, 8, 9:
{
iSpawnSet[playerid] = 1;
gTeam[playerid] = TEAM_FBI;
GameTextForPlayer(playerid, "~r~FBI", 1000, 6);
}
}
return 1;
}
public SetPlayerToTeamColor(playerid)
{
if (gTeam[playerid] == TEAM_Epsilon)
{
SetPlayerColor(playerid, TEAM_Epsilon_COLOR);
}
else if (gTeam[playerid] == TEAM_FBI)
{
SetPlayerColor(playerid, TEAM_FBI_COLOR);
}
}
public FBIarea()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if (IsPlayerInArea(i,1110.0425,1121.9803,-2068.5691,-2004.9115))
{
if(FBI[i] == 0)
{
if(timer[i] == 0)
{
SetTimer("FBIwin", 60000, 1);
SendClientMessage(i,0x33CCFFAA, "Testing");
}
else
{
timer[i] = 1;
KillTimer(5);
}
}
}
}
}
return 1;
}
public FBIwin()
{
GameTextForAll( "~r~FBI Wins the round!!!!!", 1000, 6);
GameModeExit();
}
public epsilonwin()
{
GameTextForAll( "~b~Epsilon Wins the Round!!!", 1000, 6);
GameModeExit();
}
public OnGameModeExit()
{
print("GameModeExit()");
return 1;
}
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Welcome To the Epsilon Clan server.");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Type /help to get more info about this game mode.");
printf("OnPlayerConnect(%d)", playerid);
return 1;
}
public OnPlayerDisconnect(playerid)
{
printf("OnPlayerDisconnect(%d)", playerid);
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerRandomSpawn(playerid);
SetPlayerToTeamColor(playerid);
if(FBI[playerid] == 0) {
}
if(Epsilon[playerid] == 0) {
}
printf("OnPlayerSpawn(%d)", playerid);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
if(killerid != INVALID_PLAYER_ID) {
SendDeathMessage(killerid,playerid,reason);
printf("OnPlayerDeath(%d, %d, %d)", playerid, killerid, reason);
return 1;
}
return 1;
}
public OnVehicleSpawn(vehicleid)
{
printf("OnVehicleSpawn(%d)", vehicleid);
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
printf("OnVehicleDeath(%d, %d)", vehicleid, killerid);
return 1;
}
public OnPlayerText(playerid)
{
printf("OnPlayerText(%d)", playerid);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[]) {
new cmd[256], idx; cmd = strtok(cmdtext, idx);
if (strcmp(cmdtext, "/help", true)==0)
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "This mode is A (Attack and defend) based mode.");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "The Epsilon Must protect their base while the FBI try to over run them.");
return 1;
}
if(strcmp(cmdtext, "/left", true, 3)== 0 && IsPlayerAdmin(playerid) == 1){
new str[256], pname[256]; GetPlayerName(playerid, pname, 256);
format(str, 256, "%s has left the server. (%s)", pname, cmdtext[6]);
SendClientMessageToAll(0xAFAFAFAA, str);
return 1;
}
if(strcmp(cmd, "/gametext", true) == 0 && IsPlayerAdmin(playerid) == 1){
new dir[256];
new string[256];
new tmp[256];
dir = strtok(cmdtext, idx);
strmid(tmp, cmdtext, 10, strlen(cmdtext));
if(!strlen(dir)) {
SendClientMessage(playerid, 0x33CCFFAA, "USAGE: /gametext [Message]");
}
format(string, sizeof(string), "%s",tmp);
GameTextForAll(string, 6000, 3);
return 1;
}
return 0;
}
public OnPlayerInfoChange(playerid)
{
printf("OnPlayerInfoChange(%d)");
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
printf("OnPlayerEnterVehicle(%d, %d, %d)", playerid, vehicleid, ispassenger);
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
printf("OnPlayerExitVehicle(%d, %d)", playerid, vehicleid);
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
printf("OnPlayerStateChange(%d, %d, %d)", playerid, newstate, oldstate);
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
printf("OnPlayerLeaveCheckpoint(%d)", playerid);
return 1;
}
public strtok(const string[], &index) {
new length = strlen(string);
while ((index < length) && (string[index] <= ' ')) index++;
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) {
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}