Advertisement
Guest User

Mine System By Sig Hansen and Shane Beddow

a guest
Jun 29th, 2012
736
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.17 KB | None | 0 0
  1. /*
  2.  ==================================================
  3.  |[FS]Mine by Sig Hansen and Shane Beddow         |
  4.  ==================================================
  5. */
  6.  
  7. #include <a_samp>
  8.  
  9. #define WHITE   0xFFFFFFFF
  10.  
  11. new countpos[MAX_PLAYERS];
  12. new timer[MAX_PLAYERS];
  13. new Text3D:laber[MAX_PLAYERS];
  14. new mine[MAX_PLAYERS][2];
  15. new status[MAX_PLAYERS];
  16. new minePickup[MAX_PLAYERS];
  17.  
  18. public OnFilterScriptInit()
  19. {
  20.     return 1;
  21. }
  22.  
  23. public OnPlayerCommandText(playerid, cmdtext[])
  24. {
  25.     if(strcmp(cmdtext,"/mine",true)==0)
  26.     {
  27.         if (IsPlayerInAnyVehicle(playerid))
  28.         {
  29.             SendClientMessage(playerid, WHITE, " You're in the car, so you are prohibited from using the command!!");
  30.             return 1;
  31.         }
  32.         if(status[playerid] == 1)
  33.         {
  34.             SendClientMessage(playerid, WHITE, " You have already established a mine!");
  35.             return 1;
  36.         }
  37.         new Float:X, Float:Y, Float:Z;
  38.         GetPlayerPos(playerid, X, Y, Z);
  39.         mine[playerid][0] = CreateObject(2992, X, Y, Z-0.85, 0.0, 0.0, 0.0);
  40.         mine[playerid][1] = CreateObject(19290, X, Y, Z-0.85, 0.0, 0.0, 0.0);
  41.         status[playerid] = 1;
  42.         countpos[playerid] = 11;
  43.         dtext(playerid);
  44.         return 1;
  45.     }
  46.     return 0;
  47. }
  48.  
  49.  
  50.  
  51. forward dtext(playerid);
  52. public dtext(playerid)
  53. {
  54.     timer[playerid] = SetTimerEx("dtext", 1000, 0, "i", playerid);
  55.     new Float:X, Float:Y, Float:Z;
  56.     GetObjectPos(mine[playerid][0], X, Y, Z);
  57.     if(countpos[playerid] == 11)
  58.     {
  59.         laber[playerid] = Create3DTextLabel("to activate the left: \n10 seconds!",0x00F900AA,X,Y,Z+1,40.0,0);
  60.         countpos[playerid] = 10;
  61.     }
  62.     else if(countpos[playerid] == 10)
  63.     {
  64.         Update3DTextLabelText(laber[playerid], 0x64F801AA, "to activate the left: \n9 seconds!");
  65.         countpos[playerid] = 9;
  66.     }
  67.     else if(countpos[playerid] == 9)
  68.     {
  69.         Update3DTextLabelText(laber[playerid], 0xBAF801AA, "to activate the left: \n8 seconds!");
  70.         countpos[playerid] = 8;
  71.     }
  72.     else if(countpos[playerid] == 8)
  73.     {
  74.         Update3DTextLabelText(laber[playerid], 0xDAF900AA, "to activate the left: \n7 seconds!");
  75.         countpos[playerid] = 7;
  76.     }
  77.     else if(countpos[playerid] == 7)
  78.     {
  79.         Update3DTextLabelText(laber[playerid], 0xFCEB18AA, "to activate the left: \n6 seconds!");
  80.         countpos[playerid] = 6;
  81.     }
  82.     else if(countpos[playerid] == 6)
  83.     {
  84.         Update3DTextLabelText(laber[playerid], 0xFCCE18AA, "to activate the left: \n5 seconds!");
  85.         countpos[playerid] = 5;
  86.     }
  87.     else if(countpos[playerid] == 5)
  88.     {
  89.         Update3DTextLabelText(laber[playerid], 0xFBA71AAA, "to activate the left: \n4 seconds!");
  90.         countpos[playerid] = 4;
  91.     }
  92.     else if(countpos[playerid] == 4)
  93.     {
  94.         Update3DTextLabelText(laber[playerid], 0xFA6F1BAA, "to activate the left: \n3 seconds!");
  95.         countpos[playerid] = 3;
  96.     }
  97.     else if(countpos[playerid] == 3)
  98.     {
  99.         Update3DTextLabelText(laber[playerid], 0xFA421BAA, "to activate the left: \n2 seconds!");
  100.         countpos[playerid] = 2;
  101.     }
  102.     else if(countpos[playerid] == 2)
  103.     {
  104.         Update3DTextLabelText(laber[playerid], 0xFF0F0FAA, "to activate the left: \n1 second!");
  105.         countpos[playerid] = 1;
  106.     }
  107.     else if(countpos[playerid] == 1)
  108.     {
  109.  
  110.         KillTimer(timer[playerid]);
  111.         Delete3DTextLabel(laber[playerid]);
  112.         countpos[playerid] = 0;
  113.         minePickup[playerid] = CreatePickup(0, 1, X, Y, Z, -1);
  114.     }
  115.     return 1;
  116. }
  117.  
  118. public OnPlayerPickUpPickup(playerid, pickupid)
  119. {
  120.     for(new i=0; i<MAX_PLAYERS; i++)
  121.     {
  122.         if(!IsPlayerConnected(i)) {continue;}
  123.         if(status[i] == 0) {continue;}
  124.         if(pickupid == minePickup[i])
  125.         {
  126.             new Float:X, Float:Y, Float:Z;
  127.             GetObjectPos(mine[i][0], X, Y, Z);
  128.             CreateExplosion(X, Y, Z, 7, 1);
  129.             DestroyPickup(minePickup[i]);
  130.             DestroyObject(mine[i][0]);
  131.             DestroyObject(mine[i][1]);
  132.             status[i] = 0;
  133.         }
  134.     }
  135.     return 1;
  136. }
  137.  
  138. public OnPlayerDisconnect(playerid, reason)
  139. {
  140.     if(status[playerid] == 1)
  141.     {
  142.         DestroyPickup(minePickup[playerid]);
  143.         DestroyObject(mine[playerid][0]);
  144.         DestroyObject(mine[playerid][1]);
  145.         status[playerid] = 0;
  146.         KillTimer(timer[playerid]);
  147.         Delete3DTextLabel(laber[playerid]);
  148.     }
  149.     return 1;
  150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement