Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <core>
- #include <float>
- #pragma tabsize 0
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define PocketMoney 5000 //Spawn Money
- #define INACTIVE_PLAYER_ID 255
- #define GIVECASH_DELAY 5000
- #define NUMVALUES 4
- forward MoneyGrubScoreUpdate();
- forward Givecashdelaytimer(playerid);
- forward SetPlayerRandomSpawn(playerid);
- forward SetupPlayerForClassSelection(playerid);
- forward GameModeExitFunc();
- forward SendPlayerFormattedText(playerid, const str[], define);
- forward public SendAllFormattedText(playerid, const str[], define);
- //------------------------------------------------------------------------------------------------------
- new CashScoreOld;
- new iSpawnSet[MAX_PLAYERS];
- new Float:gRandomPlayerSpawns[7][3] = {
- {2006.1472,-2344.7959,13.5469},
- {2001.7155,-2289.6697,13.5469},
- {1959.5466,-2245.2151,13.5469},
- {1900.1530,-2239.2261,13.5469},
- {1882.0526,-2310.1973,13.5469},
- {1879.8099,-2348.6899,13.5469},
- {1884.3619,-2400.3230,13.5547}
- };
- new Float:gCopPlayerSpawns[1][3] = {
- {2297.1064,2452.0115,10.8203}
- };
- new gActivePlayers[MAX_PLAYERS];
- new gLastGaveCash[MAX_PLAYERS];
- //------------------------------------------------------------------------------------------------------
- main()
- {
- print(" ");
- print(" ");
- print(" ==================");
- print(" ");
- print(" Sky Fight 1.3");
- print(" Created By: Luke");
- print(" ");
- print(" ==================");
- print(" ");
- print(" ");
- }
- //------------------------------------------------------------------------------------------------------
- public MoneyGrubScoreUpdate()
- {
- new CashScore;
- new name[MAX_PLAYER_NAME];
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- if (IsPlayerConnected(i))
- {
- GetPlayerName(i, name, sizeof(name));
- CashScore = GetPlayerMoney(i);
- SetPlayerScore(i, CashScore);
- if (CashScore > CashScoreOld)
- {
- CashScoreOld = CashScore;
- }
- }
- }
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerConnect(playerid)
- {
- GameTextForPlayer(playerid,"~n~ ~n~ ~w~Welcome To ~r~Sky Fight ~w~v1.3",16000,5);
- SendPlayerFormattedText(playerid, "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=", 0);
- SendPlayerFormattedText(playerid, "Welcome to Sky Fight (v1.3)", 0);
- SendPlayerFormattedText(playerid, "If you need help type /help", 0);
- SendPlayerFormattedText(playerid, "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=", 0);
- gActivePlayers[playerid]++;
- gLastGaveCash[playerid] = GetTickCount();
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerDisconnect(playerid)
- {
- gActivePlayers[playerid]--;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new string[256];
- new playermoney;
- new sendername[MAX_PLAYER_NAME];
- new giveplayer[MAX_PLAYER_NAME];
- new cmd[256];
- new giveplayerid, moneys, idx;
- cmd = strtok(cmdtext, idx);
- if(strcmp(cmd, "/help", true) == 0) {
- SendPlayerFormattedText(playerid,"New to Sky Fight? Well, the objective is simple.",0);
- SendPlayerFormattedText(playerid,"Grab a Plane/Helicopter and hit the skies!",0);
- SendPlayerFormattedText(playerid,"Kill everyone and anyone else that comes in YOUR sky!",0);
- SendPlayerFormattedText(playerid,"",0);
- SendPlayerFormattedText(playerid,"Your the king of the skies, so prove it to everyone else by", 0);
- SendPlayerFormattedText(playerid,"simply killing everyone else with your Plane/Helicopter!",0);
- return 1;
- }
- if(strcmp(cmd, "/rules", true) == 0) {
- SendPlayerFormattedText(playerid,"Although we don't have many rules, the ones we have you NEED to follow.",0);
- SendPlayerFormattedText(playerid," 1. No Hacking/Cheating/Bug Abusing or anything of the sort.",0);
- SendPlayerFormattedText(playerid," 2. Be a good sport, don't flame or yell at other players.",0);
- SendPlayerFormattedText(playerid," 3. Simply have Fun!", 0);
- return 1;
- }
- if(strcmp(cmd, "/pay", true) == 0) {
- new tmp[256];
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [PlayerID] [Amount]");
- return 1;
- }
- giveplayerid = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [PlayerID] [Amount]");
- return 1;
- }
- moneys = strval(tmp);
- if (IsPlayerConnected(giveplayerid)) {
- GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
- GetPlayerName(playerid, sendername, sizeof(sendername));
- playermoney = GetPlayerMoney(playerid);
- if (moneys > 0 && playermoney >= moneys) {
- GivePlayerMoney(playerid, (0 - moneys));
- GivePlayerMoney(giveplayerid, moneys);
- format(string, sizeof(string), " *You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- format(string, sizeof(string), " *You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
- SendClientMessage(giveplayerid, COLOR_YELLOW, string);
- printf(" *%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
- }
- else {
- SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount.");
- }
- }
- else {
- format(string, sizeof(string), "%d is not an active player.", giveplayerid);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- }
- return 1;
- }
- return 0;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerSpawn(playerid)
- {
- SetPlayerWorldBounds(playerid, 2353.109, 1208.455, -2056.897, -2988.564);
- GivePlayerMoney(playerid, PocketMoney);
- SetPlayerInterior(playerid,0);
- SetPlayerRandomSpawn(playerid);
- TogglePlayerClock(playerid,1);
- return 1;
- }
- public SetPlayerRandomSpawn(playerid)
- {
- if (iSpawnSet[playerid] == 1)
- {
- new rand = random(sizeof(gCopPlayerSpawns));
- SetPlayerPos(playerid, gCopPlayerSpawns[rand][0], gCopPlayerSpawns[rand][1], gCopPlayerSpawns[rand][2]); // Warp the player
- SetPlayerFacingAngle(playerid, 270.0);
- }
- else if (iSpawnSet[playerid] == 0)
- {
- new rand = random(sizeof(gRandomPlayerSpawns));
- SetPlayerPos(playerid, gRandomPlayerSpawns[rand][0], gRandomPlayerSpawns[rand][1], gRandomPlayerSpawns[rand][2]); // Warp the player
- }
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerDeath(playerid, killerid, reason)
- {
- new name[MAX_PLAYER_NAME];
- new string[256];
- new deathreason[20];
- new playercash;
- GetPlayerName(playerid, name, sizeof(name));
- GetWeaponName(reason, deathreason, 20);
- if (killerid == INVALID_PLAYER_ID) {
- switch (reason) {
- case WEAPON_DROWN:
- {
- format(string, sizeof(string), " ** %s drowned.)", name);
- }
- default:
- {
- if (strlen(deathreason) > 0) {
- format(string, sizeof(string), " ** %s died. (%s)", name, deathreason);
- } else {
- format(string, sizeof(string), " ** %s died.", name);
- }
- }
- }
- }
- else {
- new killer[MAX_PLAYER_NAME];
- GetPlayerName(killerid, killer, sizeof(killer));
- if (strlen(deathreason) > 0) {
- format(string, sizeof(string), " ** %s killed %s. (%s)", killer, name, deathreason);
- } else {
- format(string, sizeof(string), " ** %s killed %s.", killer, name);
- }
- }
- SendClientMessageToAll(COLOR_RED, string);
- {
- playercash = GetPlayerMoney(playerid);
- if (playercash > 0)
- {
- GivePlayerMoney(killerid, playercash);
- ResetPlayerMoney(playerid);
- }
- else
- {
- }
- }
- if(killerid == INVALID_PLAYER_ID) {
- SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
- ResetPlayerMoney(playerid);
- } else {
- SendDeathMessage(killerid,playerid,reason);
- SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
- playercash = GetPlayerMoney(playerid);
- if (playercash > 0) {
- GivePlayerMoney(killerid, playercash);
- ResetPlayerMoney(playerid);
- }
- else
- {
- }
- }
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerRequestClass(playerid, classid)
- {
- iSpawnSet[playerid] = 0;
- SetupPlayerForClassSelection(playerid);
- return 1;
- }
- public SetupPlayerForClassSelection(playerid)
- {
- SetPlayerInterior(playerid,0);
- SetPlayerPos(playerid,1629.8392,-2288.5488,94.1328);
- SetPlayerFacingAngle(playerid, 45.9620);
- SetPlayerCameraPos(playerid,1628.1469,-2287.2246,95.2250);
- SetPlayerCameraLookAt(playerid,1629.8392,-2288.5488,94.1328);
- }
- public GameModeExitFunc()
- {
- GameModeExit();
- }
- public OnGameModeInit()
- {
- SetGameModeText("Sky Fight");
- ShowPlayerMarkers(1);
- ShowNameTags(1);
- // Player Class's
- AddPlayerClass(285,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(287,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(270,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(271,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(269,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(276,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(275,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(248,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(100,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(247,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(204,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(203,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(173,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(175,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(174,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(102,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(104,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(103,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(109,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(108,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(110,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(116,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(114,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(115,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(122,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(123,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(120,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(299,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(297,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(268,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(292,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(169,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- AddPlayerClass(56,1958.3783,1343.1572,15.3746,270.1425,46,1,0,0,-1,-1);
- // Car Spawns
- AddStaticVehicle(476,1901.6326,-2281.7292,14.2519,207.4987,7,6); // RUSTLER Plane 1
- AddStaticVehicle(476,1915.5544,-2274.7009,14.2515,194.9342,1,6); // RUSTLER Plane 2
- AddStaticVehicle(476,1930.6199,-2268.5801,14.2507,183.4229,89,91); // RUSTLER Plane 3
- AddStaticVehicle(476,1946.9194,-2266.3423,14.2524,175.6082,119,117); // RUSTLER Plane 4
- AddStaticVehicle(476,1963.5221,-2267.8687,14.2506,164.4326,103,102); // RUSTLER Plane 5
- AddStaticVehicle(476,1978.1501,-2272.1570,14.2482,156.1803,77,87); // RUSTLER Plane 6
- AddStaticVehicle(425,1878.8654,-2365.2329,14.4373,231.1387,43,0); // HUNTER Helicopter 1
- AddStaticVehicle(425,1862.1017,-2378.8735,14.1304,237.1812,43,0); // HUNTER Helicopter 2
- AddStaticVehicle(520,1869.7185,-2444.6877,14.2844,262.3140,0,0); // HYDRA 1
- AddStaticVehicle(520,1865.8258,-2432.7229,14.2776,256.8309,0,0); // HYDRA 2
- AddStaticVehicle(476,1995.9371,-2380.2893,14.2363,89.7214,6,7); // RUSTLER 7
- AddStaticVehicle(476,1994.6183,-2398.4636,14.2433,89.2167,71,77); // RUSTLER 8
- AddStaticVehicle(476,1996.4241,-2321.9807,14.2489,90.1316,7,6); // RUSTLER 9
- AddStaticVehicle(476,1992.9398,-2304.1401,14.2528,105.1293,1,6); // RUSTLER 10
- // Pickups
- AddStaticPickup(356, 15, 1853.9034,-2328.6262,13.5469); //HIDDEN GUN M4
- AddStaticPickup(361, 15, 1385.2852,-2586.4070,13.5469); //HIDDEN GUN FLAMETHROWER
- AddStaticPickup(359, 15, 1524.0764,-2392.8154,13.5547); //HIDDEN GUN RPG
- SetTimer("MoneyUpdate", 1000, 1);
- return 1;
- }
- public SendPlayerFormattedText(playerid, const str[], define)
- {
- new tmpbuf[256];
- format(tmpbuf, sizeof(tmpbuf), str, define);
- SendClientMessage(playerid, 0xFF004040, tmpbuf);
- }
- public SendAllFormattedText(playerid, const str[], define)
- {
- new tmpbuf[256];
- format(tmpbuf, sizeof(tmpbuf), str, define);
- SendClientMessageToAll(0xFFFF00AA, tmpbuf);
- }
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment