Advertisement
vihj

Untitled

Feb 24th, 2023
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 KB | None | 0 0
  1. #include <YSI\y_hooks>
  2.  
  3. #define QUEST_OBJECTS 5
  4. #define QUEST_MODEL 19054
  5. #define QUEST_VEHICLE 560
  6.  
  7. new
  8. SpecialQuest[MAX_PLAYERS],
  9. questObject[MAX_PLAYERS],
  10. questVehicle[MAX_PLAYERS];
  11.  
  12. new Float:quest_locations[][3] = {
  13.  
  14.  
  15. };
  16. hook OnGameModeInit() {
  17. CreateDynamic3DTextLabel("{FF0000}Special Quest{FFFFFF}\n Use (/startquest)", -1, 870.2846,-25.2255,63.9659, 10.0);
  18.  
  19. new actorid = CreateActor(67, x, y, z, a);
  20. ApplyActorAnimation(actorid, "COP_AMBIENT", "Coplook_loop", 4.0, 0, 1, 1, 1, -1);
  21. }
  22. hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
  23. if(SpecialQuest[playerid]) {
  24. if(newkeys & KEY_YES) {
  25. if(IsPlayerInAnyVehicle(playerid))
  26. return SCM(playerid, COLOR_LGREEN, "Eroare: Nu poti colecta din masina!");
  27.  
  28. new
  29. Float: x, Float: y, Float: z;
  30.  
  31. GetPlayerObjectPos(playerid, questObject[playerid], x, y, z);
  32. if(!PlayerToPoint(3.0, playerid, x, y, z))
  33. return 1;
  34.  
  35. PlayerInfo[playerid][quest_objects] ++;
  36. UpdateVar(playerid, "quest_objects", PlayerInfo[playerid][quest_objects]);
  37.  
  38. RemovePlayerMapIcon(playerid, 50);
  39. DestroyPlayerObject(playerid, questObject[playerid]);
  40.  
  41. if(CheckObjects(playerid) == QUEST_OBJECTS) {
  42.  
  43. DestroyVehicle(questVehicle[playerid]);
  44.  
  45. questVehicle[playerid] = 0;
  46. SpecialQuest[playerid] = 0;
  47.  
  48.  
  49. new
  50. rand_money = 20000 + random(10000),
  51. rand_rp = 3 + random(3),
  52. rand_pp = 3 + random(3),
  53. rand_dp = 20 + random(30);
  54.  
  55. GivePlayerMoney(playerid, rand_money);
  56. PlayerInfo[playerid][pExp] += rand_rp;
  57. PlayerInfo[playerid][pPremiumPoints] += rand_pp;
  58. PlayerInfo[playerid][pDPoints] += rand_dp;
  59.  
  60. Update(playerid, pCashx);
  61. Update(playerid, pRP);
  62. Update(playerid, pPremiumPointsx);
  63. Update(playerid, pDPoints);
  64.  
  65.  
  66. gString[0] = EOS;
  67. format(gString, sizeof(gString), "Felicitari! (rand_money), rand_rp, rand_pp, rand_dp);
  68. SCM(playerid, COLOR_YELLOW, gString);
  69. }
  70. else set_quest_point(playerid);
  71. }
  72. }
  73. return 1;
  74. }
  75.  
  76. YCMD:resetquest(playerid, params[], help) {
  77. if(PlayerInfo[playerid][pAdmin] < 6)
  78. return 1;
  79.  
  80. foreach(new i : Player) {
  81. PlayerInfo[i][quest_objects] = 0;
  82. UpdateVar(i, "quest_objects", 0);
  83.  
  84. }
  85. return 1;
  86. }
  87.  
  88. YCMD:startquest(playerid, params[], help) {
  89. if(CheckObjects(playerid) == QUEST_OBJECTS)
  90. return SCM(playerid, COLOR_LGREEN, "Eroare: Ai terminat deja acest quest!");
  91.  
  92. if(!PlayerToPoint(2.0, playerid, 870.2846,-25.2255,63.9659)) {
  93. if(CP[playerid] != 0) return ShowPlayerDialogEx(playerid, DIALOG_CHECKPOINT, DIALOG_STYLE_MSGBOX, "Checkpoint", "Ai deja un checkpoint activ.\nDoresti sa-l anulezi? Daca da, apasa pe 'Ok'.", "Ok", "Exit");
  94. SetPlayerCheckpoint(playerid, x, y, z, 2.0);
  95. CP[playerid] = 43;
  96. return 1;
  97. }
  98. questVehicle[playerid] = CreateVehicleEx(QUEST_VEHICLE, x, y, z, -1, -1, -1, -1);
  99. PutPlayerInVehicle(playerid, questVehicle[playerid], 0);
  100. SpecialQuest[playerid] = 1;
  101. set_quest_point(playerid);
  102. return 1;
  103. }
  104.  
  105. YCMD:stopquest(playerid, params[], help) {
  106. if(!SpecialQuest[playerid])
  107. return SCM(playerid, COLOR_LGREEN, "Eroare: Nu faci Quest-ul Special!");
  108.  
  109. RemovePlayerMapIcon(playerid, 50);
  110. DestroyVehicle(questVehicle[playerid]);
  111.  
  112. questVehicle[playerid] = 0;
  113. SpecialQuest[playerid] = 0;
  114.  
  115. gString[0] = EOS;
  116. format(gString, sizeof(gString), "Quest oprit! Progres: %d/%d", CheckObjects(playerid), QUEST_OBJECTS);
  117. SCM(playerid, COLOR_YELLOW, gString);
  118. return 1;
  119. }
  120.  
  121.  
  122. return true;
  123. }
  124. set_quest_point(playerid) {
  125.  
  126. new
  127. rand = random(sizeof(quest_locations));
  128.  
  129. SetPlayerMapIcon(playerid, 50, quest_locations[rand][0], quest_locations[rand][1], quest_locations[rand][2], 56, -1, MAPICON_GLOBAL);
  130.  
  131. gString[0] = EOS;
  132. format(gString, sizeof(gString), "Distanta pana la obiect: %0.2fm (progres: %d/%d)", GetPlayerDistanceFromPoint(playerid, quest_locations[rand][0], quest_locations[rand][1], quest_locations[rand][2]), CheckObjects(playerid), QUEST_OBJECTS);
  133. SCM(playerid, COLOR_YELLOW, gString);
  134.  
  135. questObject[playerid] = CreatePlayerObject(playerid, QUEST_MODEL, quest_locations[rand][0], quest_locations[rand][1], quest_locations[rand][2], 0.0, 0.0, 0.0);
  136. return 1;
  137. }
  138.  
  139. CheckObjects(playerid) return PlayerInfo[playerid][quest_objects];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement