Advertisement
Guest User

Untitled

a guest
Nov 19th, 2010
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define COLOR_RED 0xFF0000AA
  4. #define COLOR_YELLOW 0xFFFF00AA
  5. #define Checkpoint1 -1253.9714,238.6661,14.1484
  6. #define Checkpoint2 1855.2505,-2494.0652,13.5547
  7. #define ResetMoneyBar ResetPlayerMoney
  8. #define UpdateMoneyBar GivePlayerMoney
  9.  
  10.  
  11. new flyjobrunning = 0;
  12. new info;
  13. enum pInfo
  14. {
  15. pCash,
  16. pBank,
  17. pJob,
  18. };
  19. new PlayerInfo[MAX_PLAYERS][pInfo];
  20.  
  21. //==============================================================================
  22. if(IsPlayerConnected(playerid))
  23. {
  24. new string3[128];
  25. format(string3, sizeof(string3), "Inferno Roleplay/Accounts/%s.ini", PlayerName(playerid));
  26. new File: hFile = fopen(string3, io_write);
  27. if (hFile)
  28. {
  29. strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 255);
  30. new var[32];
  31. format(var, 32, "Key=%s\n", PlayerInfo[playerid][pKey]);fwrite(hFile, var);
  32. PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
  33. format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
  34.  
  35. //==============================================================================
  36.  
  37.  
  38. public OnFilterScriptInit()
  39. {
  40. AddStaticVehicle(519,1729.8932,-2415.7798,14.4727,149.2040,1,1); //
  41.  
  42. info = CreatePickup(1239,1,1748.7014,-2421.0500,13.5547,-1);
  43. }
  44.  
  45. stock GivePlayerCash(playerid, money)
  46. {
  47. PlayerInfo[playerid][pCash] += money;
  48. UpdateMoneyBar(playerid,PlayerInfo[playerid][pCash]);
  49. return PlayerInfo[playerid][pCash];
  50. }
  51.  
  52. public OnPlayerCommandText(playerid, cmdtext[])
  53. {
  54. if (strcmp("/startflight", cmdtext, true, 10) == 0)
  55. {
  56. if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 519)
  57. {
  58. flyjobrunning = 1;
  59. SetPlayerCheckpoint(playerid, Checkpoint1, 3.0);
  60. GameTextForPlayer(playerid, "~g~You started the job, good luck!", 3000, 3);
  61. new name[MAX_PLAYER_NAME], string[48];
  62. flyjobrunning = 1;
  63. GetPlayerName(playerid, name, sizeof(name));
  64. format(string, sizeof(string), "%s is now delivering goods with a plane.", name );
  65. SendClientMessageToAll(COLOR_RED, string);
  66.  
  67. return 1;
  68. }
  69. SendClientMessage(playerid, COLOR_RED,"You have to be in the jobplane to start the job");
  70. }
  71. if (strcmp("/flyinfo", cmdtext, true, 10) == 0)
  72. {
  73. SendClientMessage(playerid, COLOR_YELLOW, "You need to bring the planeload to the airport in San Fierro.");
  74. SendClientMessage(playerid, COLOR_YELLOW, "There they will reward you for your help.");
  75. SendClientMessage(playerid, COLOR_YELLOW, "If you enter the truck, type /startflight and a red marker will appear.");
  76. SendClientMessage(playerid, COLOR_YELLOW, "Just fly to the marker and you're done.");
  77. return 1;
  78. }
  79. return 0;
  80. }
  81. public OnPlayerEnterCheckpoint(playerid)
  82. {
  83. if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 519)
  84. {
  85. if (IsPlayerInRangeOfPoint(playerid, 7.0,Checkpoint1))
  86. {
  87. SetPlayerCheckpoint(playerid, Checkpoint2, 7.0);
  88. GameTextForPlayer(playerid, "~g~Now fly back to Los Santos Airport to collect your paycheck.", 3000, 3);
  89. }
  90. if (IsPlayerInRangeOfPoint(playerid, 7.0,Checkpoint2))
  91. {
  92. GivePlayerCash(playerid, 1000);
  93. GameTextForPlayer(playerid, "~g~You Completed the job, well done!", 3000, 3);
  94. SetVehicleToRespawn(1);
  95. DisablePlayerCheckpoint(playerid);
  96. flyjobrunning = 0;
  97. }
  98. }
  99. }
  100.  
  101. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  102. {
  103. if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 519)
  104. {
  105. SendClientMessage(playerid, COLOR_RED, "You can start the Fly job with /startflight");
  106. }
  107. return 0;
  108. }
  109. public OnPlayerExitVehicle(playerid, vehicleid)
  110. {
  111. if((flyjobrunning) == 1)
  112. {
  113. flyjobrunning = 0;
  114. SendClientMessage(playerid, COLOR_RED, "You left the plane, you failed the job.");
  115.  
  116. }else if((flyjobrunning) == 0){
  117.  
  118. //Nothing
  119. }
  120. }
  121. public OnPlayerDeath(playerid, killerid, reason)
  122. {
  123. DisablePlayerCheckpoint(playerid);
  124. flyjobrunning = 0;
  125. return 1;
  126. }
  127.  
  128. public OnPlayerPickUpPickup(playerid, pickupid)
  129. {
  130. if(pickupid == info)
  131. {
  132. GameTextForPlayer(playerid, "~g~Welcome at the Fly job, use /flyinfo to know more", 3000, 3);
  133. }
  134. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement