15.06.2010, 12:28
Limex's Flying Mini Mission Script 2.0
Features- 3 shamals, 1 at each city airport.
- Get in any shamal to start the mini mission.
- Fly to the destinations and get $500 per flight!
- Get out of the shamal to end the mission.
- 1.0:
- Initial Release - 2.0:
- Dynamic money variable allowing you to change the money earnt easily.
- Vehicles get removed when the filterscript is unloaded.
- Changed alot of variables to defines.
- Added alot of comments to the script.
Code:
/* Limex's Flying Mini Mission Script 2.0 Features: - 3 shamals, 1 at each city airport. - Get in any shamal to start the mini mission. - Fly to the destinations and get $500 per flight (Can be changed by editing the MONEY_EARNT define)! - Get out of the shamal to end the mission. Made by Limex at forum.sa-mp.com also known as A on IRC Feel free to modify it and use it however you want! I don't care. 1.0: Initial Release 2.0: - Dynamic money variable allowing you to change the money earnt easily. - Vehicles get removed when the filterscript is unloaded. - Changed alot of variables to defines. - Added alot of comments to the script. */ #include <a_samp> #define WHITE 0xFFFFFF00 // The colour used for all SendClientMessage functions in this script (White). #define MONEY_EARNT 500 // MONEY_EARNT is how much the player gets when they enter a checkpoint. #define LVA 1 #define LSA 2 // These three defines are used with the PLANESTAGE variable. #define SFA 3 #define LVX 1477.2230 #define LVY 1571.7928 // These are the X, Y and Z coordinates of Las Venturas Airport. #define LVZ 10.8125 #define LSX 1789.4841 #define LSY -2593.2522 // These are the X, Y and Z coordinates of Los Santos Airport. #define LSZ 13.5469 #define SFX -1425.1704 #define SFY 67.5904 // These are the X, Y and Z coordinates of San Fierro Airport. #define SFZ 14.1484 new LSP, SFP, LVP, PLANESTAGE[MAX_PLAYERS]; // These variables store the vehicle ID's. PLANESTAGE stores what airport each player is flying to. public OnFilterScriptInit() { LSP = AddStaticVehicle(519,1920.9860,-2249.6777,14.4692,179.1806,36,73); SFP = AddStaticVehicle(519,-1351.0986,-256.9580,15.0618,312.2511,36,73); // This is what spawns the 3 shamals (1 at each airport!); LVP = AddStaticVehicle(519,1608.9287,1630.6162,11.7423,179.5136,36,73); return 1; } public OnFilterScriptExit() { DestroyVehicle(LSP); DestroyVehicle(SFP); // This is what destroys the 3 shamals when the filterscript is unloaded. DestroyVehicle(LVP); return 1; } public OnPlayerConnect(playerid) { PLANESTAGE[playerid] = 0; //When a player connects they are set to not be a pilot. return 1; } public OnPlayerEnterCheckpoint(playerid) { /* This is where the money is given when they go through a checkpoint. The person is then directed to another airport. */ new veh = GetPlayerVehicleID(playerid); if(veh == LVP || veh == LSP || veh == SFP) { if(IsPlayerInRangeOfPoint(playerid, 10.0, LVX, LVY, LVZ) && PLANESTAGE[playerid] == LVA) { new string[64]; format(string, sizeof(string), "You earnt $%d! Now go to LS Airport!", MONEY_EARNT); SendClientMessage(playerid, WHITE, string); PLANESTAGE[playerid] = LSA; DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, LSX, LSY, LSZ, 10.0); GivePlayerMoney(playerid, MONEY_EARNT); } else if(IsPlayerInRangeOfPoint(playerid, 10.0, LSX, LSY, LSZ) && PLANESTAGE[playerid] == LSA) { new string[64]; format(string, sizeof(string), "You earnt $%d! Now go to SF Airport!", MONEY_EARNT); SendClientMessage(playerid, WHITE, string); PLANESTAGE[playerid] = SFA; DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, SFX, SFY, SFZ, 10.0); GivePlayerMoney(playerid, MONEY_EARNT); } else if(IsPlayerInRangeOfPoint(playerid, 10.0, SFX, SFY, SFZ) && PLANESTAGE[playerid] == SFA) { new string[64]; format(string, sizeof(string), "You earnt $%d! Now go to LV Airport!", MONEY_EARNT); SendClientMessage(playerid, WHITE, string); PLANESTAGE[playerid] = LVA; DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, LVX, LVY, LVZ, 10.0); GivePlayerMoney(playerid, MONEY_EARNT); } } return 1; } public OnPlayerStateChange(playerid,newstate,oldstate) { /* This is where the player is given the pilot job when they enter a shamal. They also loose the job when they leave the shamal. */ if(newstate == PLAYER_STATE_DRIVER) { new veh = GetPlayerVehicleID(playerid); if(veh == LVP) { new string[64]; format(string, sizeof(string), "Go to LS airport to earn $%d!", MONEY_EARNT); SendClientMessage(playerid, WHITE, string); PLANESTAGE[playerid] = LSA; DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, LSX, LSY, LSZ, 10.0); } else if(veh == LSP) { new string[64]; format(string, sizeof(string), "Go to SF airport to earn $%d!", MONEY_EARNT); SendClientMessage(playerid, WHITE, string); PLANESTAGE[playerid] = SFA; DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, SFX, SFY, SFZ, 10.0); } else if(veh == SFP) { new string[64]; format(string, sizeof(string), "Go to LV airport to earn $%d!", MONEY_EARNT); SendClientMessage(playerid, WHITE, string); PLANESTAGE[playerid] = LVA; DisablePlayerCheckpoint(playerid); SetPlayerCheckpoint(playerid, LVX, LVY, LVZ, 10.0); } } else if(newstate == PLAYER_STATE_ONFOOT) { if(PLANESTAGE[playerid] != 0) { PLANESTAGE[playerid] = 0; SendClientMessage(playerid, WHITE, "You are no longer a pilot!"); } } return 1; }
http://www.ashleylipscombe.com/flymm2.pwn - V2.0 (LATEST VERSION - RECCOMENDED)
http://www.ashleylipscombe.com/flymm.pwn V1.0 - NOT RECCOMENDED - OUTDATED
Feedback
If you've got any suggestions or any bug reports, just reply here! Also reply back on what you think of it!