AryanV

TRL Treasure Hunt System - By TheRaGeLord

Jul 15th, 2015
560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.88 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf2>
  4. #define MAX_TREASURE 40
  5. new treasure[MAX_TREASURE];
  6. new Text3D:Label[MAX_TREASURE];
  7. new treasures;
  8. #define COLOR_BLUE 0x009AE5B0
  9. #define COLOR_YELLOW 0xFFFF00B4
  10. #define COLOR_RED 0xB40000B5
  11.  
  12. public OnFilterScriptInit()
  13. {
  14.     print("\n======================================");
  15.     print(" TRL Treasure Hunt by Rage Loaded!");
  16.     print("======================================\n");
  17.     return 1;
  18. }
  19.  
  20. public OnFilterScriptExit()
  21. {
  22.     print("\n======================================");
  23.     print(" TRL Treasure Hunt by Rage Loaded!");
  24.     print("======================================\n");
  25.     return 1;
  26. }
  27.  
  28.  
  29.  
  30. public OnPlayerSpawn(playerid)
  31. {
  32.     return 1;
  33. }
  34.  
  35. public OnPlayerPickUpPickup(playerid, pickupid)
  36. {
  37.   for(new i=1; i<MAX_TREASURE; i++)
  38.   {
  39.     if(pickupid == treasure[i]){
  40.      new prize= random(5);
  41.      switch(prize){
  42.      case 0:
  43.      {  GivePlayerMoney(playerid, 10000);
  44.        SendClientMessage(playerid, COLOR_YELLOW, "Treasure Found! Congratulations You have found $10,000. Enjoy!");
  45.        destroytext(i);
  46.       treasure[i]=0;
  47.        break;
  48.      }
  49.      case 1:
  50.      {  GivePlayerMoney(playerid, 10000);
  51.        SendClientMessage(playerid, COLOR_YELLOW, "Treasure Found! Congratulations You have found $10,000. Enjoy!");
  52.        destroytext(i);
  53.     treasure[i]=0;
  54.        break;
  55.      }
  56.      case 2:
  57.      {
  58.        GivePlayerMoney(playerid, 5000);
  59.        SendClientMessage(playerid, COLOR_YELLOW, "Treasure Found! Congratulations You have found $5,000. Enjoy!");
  60.        destroytext(i);
  61.     treasure[i]=0;
  62.        break;
  63.      }
  64.      case 3:
  65.      {
  66.        GivePlayerMoney(playerid, 5000);
  67.        SendClientMessage(playerid, COLOR_YELLOW, "Treasure Found! Congratulations You have found $5,000. Enjoy!");
  68.        destroytext(i);
  69.     treasure[i]=0;
  70.        break;
  71.      }
  72.      case 4:
  73.      {
  74.      GivePlayerWeapon(playerid,36,50);
  75.        SendClientMessage(playerid, COLOR_YELLOW, "Treasure Found! Congratulations You have found a Rocket launcher(50 Ammos). Enjoy!");
  76.        destroytext(i);
  77.     treasure[i]=0;
  78.        break;
  79.      }
  80.      case 5:
  81.      {
  82.        GivePlayerWeapon(playerid, 38,200);
  83.        SendClientMessage(playerid, COLOR_YELLOW, "Treasure Found! Congratulations You have found a Minigun(100 Ammos). Enjoy!");
  84.        destroytext(i);
  85.       treasure[i]=0;
  86.        break;
  87.  
  88.       }
  89.      }
  90. destroytext(i);
  91.     break;
  92.     }
  93.  
  94.   }
  95. return 1;
  96. }
  97.  
  98. CMD:ctreasure(playerid, params[]){
  99. if(IsPlayerAdmin(playerid)){
  100. new Float:x,Float:y,Float:z;
  101. GetPlayerPos(playerid,x,y,z);
  102. for(new i=1;i<MAX_TREASURE;i++){
  103. if(treasure[i]==0){
  104. treasure[i]=CreatePickup(1274,19,x-1.5,y-1.5,z+0.5,0);
  105. new strr[123];
  106. format(strr, sizeof(strr)," Treasure \nID:%d",i);
  107. Label[i]=Create3DTextLabel(strr,0xEBFF0077, x-1.5,y-1.5,z+0.8, 5, 0, 0);
  108. new str[123];
  109. format(str,sizeof(str),"You successfully created a treasure(ID:%d) Type /destroyt [Treasure ID] to Destroy it",i);
  110. SendClientMessage(playerid, COLOR_BLUE,str);
  111. treasures++;
  112. break;
  113. }
  114. }
  115. }
  116. else return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command");
  117. return 1;
  118. }
  119.  
  120. CMD:destroyt(playerid,params[]){
  121. if(IsPlayerAdmin(playerid)){
  122. new tid;
  123. if (sscanf(params, "i", tid)) return SendClientMessage(playerid,COLOR_RED,"Usage: /destroyt [Treasure ID]");
  124. destroytext(tid);
  125. new str[123];
  126. format(str,sizeof(str),"Success: Your Request for Deleting Treasure(ID:%d) has been accepted. Treasure would have been deleted if it was existing..", tid);
  127. SendClientMessage(playerid, COLOR_RED, str);
  128. }
  129. else return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command");
  130. return 1;
  131. }
  132.  
  133. CMD:destroyallt(playerid, params[]){
  134. if(IsPlayerAdmin(playerid)){
  135. for(new i=0;i<MAX_TREASURE;i++){
  136. destroytext(i);
  137. }
  138. SendClientMessage(playerid, COLOR_RED, "You have deleted all treasures that were placed");
  139. }
  140. else return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command");
  141. return 1;
  142. }
  143.  
  144. stock destroytext(id){
  145. DestroyPickup(treasure[id]);
  146. Delete3DTextLabel(Label[id]);
  147.  
  148. }
Add Comment
Please, Sign In to add comment