#include #define COLOR_YELLOW 0xFFFF00AA #define ROUND_TIME 600000 // 10 minutes #define MAX_SCORE 800 //max score new LeadingPlayer = -1; new loopfunctimer, endroundtimer; main() { print("\n===================================="); print("| |"); print("| Level Lord! |"); print("| ------------- |"); print("| |"); print("| By Alex \"Y_Less\" Cole - (c) 2006 |"); print("| |"); print("====================================\n"); loopfunctimer = SetTimer("LoopFunc", 2000, true); endroundtimer = SetTimer("endround", ROUND_TIME, false); } public OnGameModeInit() { SetGameModeText("Level Lord!"); AddPlayerClass(144, 2377.3127, 1953.8379, 6.0156, 217.2261, 5, 1, 24, 100, 0, 0); AddPlayerClass(222, 2376.5540, 1899.3405, 6.0156, 269.4488, 2, 1, 24, 100, 0, 0); AddPlayerClass(214, 2373.4443, 1825.4421, 6.0156, 322.5071, 6, 1, 24, 100, 0, 0); AddPlayerClass(260, 2410.8357, 1839.2723, 6.0156, 5.9563, 3, 1, 24, 100, 0, 0); AddStaticPickup(1242, 2, 2377.6072, 1886.8319, 11.6563); // Armour AddStaticPickup(1242, 2, 2402.5603, 1826.4650, 11.6563); // Armour AddStaticPickup(349, 2, 2451.3704, 1921.6823, 10.8647); // Shotgun AddStaticPickup(352, 2, 2459.0981, 1923.2078, 10.8647); // Micro Uzi AddStaticPickup(349, 2, 2459.9519, 1905.4021, 10.8647); // Shotgun AddStaticPickup(352, 2, 2450.9202, 1904.0183, 10.8647); // Micro Uzi AddStaticPickup(355, 2, 2455.2363, 1911.8583, 10.8647); // AK-47 AddStaticPickup(361, 2, 2477.8452, 1921.6162, 13.4845); // Flame Thrower SetWorldTime(12); ShowNameTags(1); return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerPos(playerid, 2458.4585, 1738.9915, 21.2344); SetPlayerFacingAngle(playerid, 185.5126); SetPlayerCameraPos(playerid, 2459.0149, 1733.2311, 21.2344); SetPlayerCameraLookAt(playerid, 2458.4585, 1738.9915, 21.2344); return 1; } public OnPlayerConnect(playerid) { SetPlayerScore(playerid, 0); return 1; } public OnPlayerSpawn(playerid) { GameTextForPlayer(playerid, "~y~Get as ~r~high ~y~as you can~n~ to increase your ~b~score", 5000, 3); SetPlayerWorldBounds(playerid, 2497.9, 2371.2, 1963.6, 1782.8); return 1; } public OnPlayerDeath(playerid, killerid, reason) { SendDeathMessage(killerid, playerid, reason); new score = GetPlayerScore(playerid); score /= 2; SetPlayerScore(playerid, score); if (killerid != INVALID_PLAYER_ID && score > 0) { SetPlayerScore(killerid, GetPlayerScore(killerid) + score); } return 1; } public OnPlayerCommandText(playerid, text[]) { if (strcmp(text, "/help", true) == 0) { SendClientMessage(playerid, COLOR_YELLOW, " "); SendClientMessage(playerid, COLOR_YELLOW, "Level Lord, by Alex \"Y_Less\" Cole"); SendClientMessage(playerid, COLOR_YELLOW, " "); SendClientMessage(playerid, COLOR_YELLOW, "- Get as high as you can in the time provided."); SendClientMessage(playerid, COLOR_YELLOW, "- The higher you get the more points you get."); SendClientMessage(playerid, COLOR_YELLOW, "- Killing other players also give you half their points."); SendClientMessage(playerid, COLOR_YELLOW, "- There are no other commands, this is a simple yet fun mode."); return 1; } return 0; } public LoopFunc() { static Float:levels[] = {10.3, 13.1, 15.9, 18.7, 21.5, 24.3, 100.0}; static rewards[] = {-3, -1, 1, 3, 5, 7, 10}; new Float:z; new scores = -51; new winnerid; for (new i = 0; i < MAX_PLAYERS; i++) { if (IsPlayerConnected(i)) { GetPlayerPos(i, z, z, z); for (new j = 0; j < sizeof (levels); j++) { if (levels[j] > z) { new pscore = GetPlayerScore(i); SetPlayerScore(i, pscore + rewards[j]); if (pscore < -50) SetPlayerScore(i, -50); pscore = GetPlayerScore(i); if(pscore > scores) { scores = pscore; winnerid = i; } break; } } } } if(LeadingPlayer != winnerid) { if(scores < MAX_SCORE) { LeadingPlayer = winnerid; new string[256], pname[256]; GetPlayerName(winnerid, pname, 256); format(string, 256, "~w~leading player is now~n~~b~%s ~y~[%d]",pname, GetPlayerScore(winnerid)); GameTextForAll(string, 5000, 4); } else GameOver(); } } public GameOver() { for (new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) TogglePlayerControllable(i, 0); } new string[256], pname[256]; GetPlayerName(LeadingPlayer, pname, 256); format(string, 256, "~r~game over~n~~w~winner: ~b~%s ~y~[%d]",pname, GetPlayerScore(LeadingPlayer)); GameTextForAll(string,10000,3); KillTimer(endroundtimer); KillTimer(loopfunctimer); SetTimer("ExitTheGameMode", 7000, false); } public ExitTheGameMode() { GameModeExit(); }