Advertisement
Gireada

Event Luck

Apr 23rd, 2013
760
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.32 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. new Text:LuckEventTexT;
  5. new EventObj[17];
  6. new InEvent[MAX_PLAYERS];
  7. new Participanti;
  8. new EventStat;
  9. new obiectedisparuta;
  10. new timer1;
  11. new timer2;
  12. new Float:admins = 546.7480;
  13.  
  14. forward EventStart();
  15. forward EventCheck();
  16. forward EventDestroy();
  17.  
  18. main()
  19. {
  20.     print("\n----------------------------------");
  21.     print(" Luck Event by Gireada");
  22.     print("----------------------------------\n");
  23. }
  24.  
  25. public OnFilterScriptInit()
  26. {
  27.     EventObj[0] = CreateObject(19378, -130.59, 3287.54, 547.00,   0.00, 90.00, 0.00);
  28.     EventObj[1] = CreateObject(19375, -130.58, 3277.96, 547.00,   0.00, 90.00, 0.00);
  29.     EventObj[2] = CreateObject(19378, -130.58, 3268.43, 547.00,   0.00, 90.00, 0.00);
  30.     EventObj[3] = CreateObject(19375, -130.58, 3258.86, 547.00,   0.00, 90.00, 0.00);
  31.     EventObj[4] = CreateObject(19378, -140.87, 3258.86, 547.00,   0.00, 90.00, 0.00);
  32.     EventObj[5] = CreateObject(19375, -151.41, 3258.86, 547.00,   0.00, 90.00, 0.00);
  33.     EventObj[6] = CreateObject(19378, -161.75, 3258.86, 547.00,   0.00, 90.00, 0.00);
  34.     EventObj[7] = CreateObject(19375, -161.75, 3268.43, 547.00,   0.00, 90.00, 0.00);
  35.     EventObj[8] = CreateObject(19378, -161.75, 3277.98, 547.00,   0.00, 90.00, 0.00);
  36.     EventObj[9] = CreateObject(19375, -161.75, 3287.54, 547.00,   0.00, 90.00, 0.00);
  37.     EventObj[10] = CreateObject(19375, -140.88, 3268.42, 547.00,   0.00, 90.00, 0.00);
  38.     EventObj[11] = CreateObject(19378, -140.87, 3277.96, 547.00,   0.00, 90.00, 0.00);
  39.     EventObj[12] = CreateObject(19375, -140.87, 3287.54, 547.00,   0.00, 90.00, 0.00);
  40.     EventObj[13] = CreateObject(19378, -151.41, 3268.42, 547.00,   0.00, 90.00, 0.00);
  41.     EventObj[14] = CreateObject(19375, -151.41, 3277.96, 547.00,   0.00, 90.00, 0.00);
  42.     EventObj[15] = CreateObject(19378, -151.41, 3287.54, 547.00,   0.00, 90.00, 0.00);
  43.     print("\n--------------------------------------");
  44.     print(" Luck Event by Gireada");
  45.     print("--------------------------------------\n");
  46.     LuckEventTexT = TextDrawCreate(443.500000, 99.750000, "Participanti Luck:");
  47.     TextDrawLetterSize(LuckEventTexT, 0.449999, 1.600000);
  48.     TextDrawAlignment(LuckEventTexT, 1);
  49.     TextDrawColor(LuckEventTexT, -16776961);
  50.     TextDrawSetShadow(LuckEventTexT, 0);
  51.     TextDrawSetOutline(LuckEventTexT, 1);
  52.     TextDrawBackgroundColor(LuckEventTexT, -1);
  53.     TextDrawFont(LuckEventTexT, 1);
  54.     TextDrawSetProportional(LuckEventTexT, 1);
  55.     return 1;
  56. }
  57.  
  58. CMD:luckevent(playerid, params[])
  59. {
  60.     new string[256], nume[MAX_PLAYER_NAME];
  61.     if(IsPlayerAdmin(playerid))
  62.     {
  63.         if(EventStat == 0 && Participanti == 0)
  64.         {
  65.             EventStat = 1;
  66.             format(string, sizeof(string),"Admin-ul %s a dat start la Luck Event. Aveti 20 de secunde de a da /luck .",nume);
  67.             SendClientMessageToAll(0xFFFFFFFFF,string);
  68.             SetTimer("EventStart", 20000, false);
  69.         }
  70.     }
  71.     return 1;
  72. }
  73.  
  74. CMD:luck(playerid, params[])
  75. {
  76.     new string[256];
  77.     if(EventStat == 1)
  78.     {
  79.         Participanti++; InEvent[playerid] = 1;
  80.         SetPlayerPos(playerid,-150.9392, 3268.9268, 548.3915);
  81.         format(string, sizeof(string), "Participanti Luck: %d", Participanti);
  82.         TextDrawSetString(LuckEventTexT, string);
  83.         TextDrawShowForPlayer(playerid, LuckEventTexT);
  84.     }
  85.     return 1;
  86. }
  87.  
  88.  
  89. public OnFilterScriptExit()
  90. {
  91.     return 1;
  92. }
  93.  
  94. public EventStart()
  95. {
  96.     new string[512];
  97.     EventStat = 0;
  98.     format(string, sizeof(string),"Luck Event a inceput sunt %d participanti. Aveti grija la podea.",Participanti);
  99.     SendClientMessageToAll(0xFFFFFFFFF,string);
  100.     SendEventMessage("Luck Event: Aranjativa! Aveti 10 secunde.");
  101.     for(new i=0;i<=MAX_PLAYERS;i++)
  102.     {
  103.         if(InEvent[i] == 1)
  104.         {
  105.             GivePlayerWeapon(i, 46, 1);
  106.         }
  107.     }
  108.     format(string, sizeof(string), "Participanti Luck: %d", Participanti);
  109.     TextDrawSetString(LuckEventTexT, string);
  110.     timer2 = SetTimer("EventDestroy", 10000, false);
  111.     return 1;
  112. }
  113.  
  114. public EventCheck()
  115. {
  116.     new string[256],Float:x,Float:y,Float:z,nume[MAX_PLAYER_NAME];
  117.     for(new i=0;i<=MAX_PLAYERS;i++)
  118.     {
  119.         if(InEvent[i] == 1)
  120.         {
  121.             GetPlayerPos(i,x,y,z);
  122.             if(z<admins)
  123.             {
  124.                 Participanti--;InEvent[i]=0;
  125.                 TextDrawHideForPlayer(i, LuckEventTexT);
  126.             }
  127.         }
  128.     }
  129.     format(string, sizeof(string), "Participanti Luck: %d", Participanti);
  130.     TextDrawSetString(LuckEventTexT, string);
  131.     if(Participanti == 1)
  132.     {
  133.         for(new i=0;i<=MAX_PLAYERS;i++)
  134.         {
  135.             if(InEvent[i] == 1)
  136.             {
  137.                 GetPlayerPos(i,x,y,z);
  138.                 if(Participanti == 1)
  139.                 {
  140.                     GetPlayerName(i,nume,sizeof(nume)); GivePlayerMoney(i, 1000000);
  141.                     Participanti = 0; EventStat = 0;
  142.                     KillTimer(timer2); KillTimer(timer1);
  143.                     TextDrawHideForPlayer(i, LuckEventTexT);
  144.                     GivePlayerMoney(i, 1000000);
  145.                     format(string, sizeof(string), "%s a castigat Luck Event",nume);
  146.                     SendEventMessage(string);
  147.                 }
  148.             }
  149.         }
  150.     }
  151.     if(Participanti == 0)
  152.     {
  153.         KillTimer(timer2);
  154.         KillTimer(timer1);
  155.         SendEventMessage("Luck Event s-a incheiat");
  156.     }
  157.     return 1;
  158. }
  159.  
  160. public EventDestroy()
  161. {
  162.     new obiect = random(16),string[512],string2[256],nume[MAX_PLAYER_NAME];
  163.     if(obiectedisparuta <= 14)
  164.     {
  165.         if(IsValidObject(EventObj[obiect]))
  166.         {
  167.             SendEventMessage("Luck Event: Atentie dispare podeaua.");
  168.             DestroyObject(EventObj[obiect]);
  169.             obiectedisparuta++;
  170.             timer1 = SetTimer("EventCheck", 1000, false);
  171.             timer2 = SetTimer("EventDestroy", 10000, false);
  172.         }
  173.         else if(!IsValidObject(EventObj[obiect]))
  174.         {
  175.             SendEventMessage("Luck Event: Alarma falsa mai aveti 10 secunde.");
  176.             timer1 = SetTimer("EventCheck", 1000, false);
  177.             timer2 = SetTimer("EventDestroy", 10000, false);
  178.         }
  179.     }
  180.     else
  181.     {
  182.         format(string, sizeof(string), "Luck Event: Castigatorii evenimentului sunt:");
  183.         for(new i=0;i<MAX_PLAYERS;i++)
  184.         {
  185.             if(InEvent[i] == 1)
  186.             {
  187.                 GetPlayerName(i, nume, sizeof(nume));
  188.                 GivePlayerMoney(i, 1000000);
  189.                 format(string2, sizeof(string2), " %s",nume);
  190.                 strcat(string, string2);
  191.             }
  192.         }
  193.         SendClientMessageToAll(0xFFFFFFFFF,string);
  194.     }
  195.     return 1;
  196. }
  197.  
  198. stock SendEventMessage(const mesaj[])
  199. {
  200.     for(new i=0;i<MAX_PLAYERS;i++)
  201.     {
  202.         if(InEvent[i] == 1)
  203.         {
  204.             SendClientMessage(i, 0xFFFFFFFF, mesaj);
  205.         }
  206.     }
  207.     return 1;
  208. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement