Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.31 KB | None | 0 0
  1. #include <a_samp>
  2. /*
  3. System: War Activity
  4. Bulid By ron - biton
  5. BigMaN && EviLpRo
  6. */
  7. //===[Colors]==
  8. #define green 0xc7ff00ff
  9. #define red 0xff3300ff
  10. #define yellow 0xffff00ff
  11. #define blue 0x500bdff
  12. #define lightBlue 0x00ccffff
  13. //==[הגדרות - ניתן לשינוי]==
  14. #define Price 10000 // כמות הכסף שיקבל הזוכה
  15. #define Block 12 // מספר מקומות מוגבל, אם אתם מוסיפים אחד תוסיפו גם ספאון אחד
  16. #define CDN 40 // המספר שתתחיל ממנו הספירה הראשונה
  17. #define CDN2 10 // המספר שתתחיל ממנו הסיפרה השניה
  18. #define MinPlayers 2 // מספר מקומות מינימלי
  19. #define Money 200 // עלות כניסה לפעילות
  20. //===[משתנים]==
  21. new cd;
  22. new WarOn;
  23. new WarPlayers;
  24. new InWar[MAX_PLAYERS];
  25. new WarReg;
  26. new String[256];
  27. new Float:WarSpawns[12][3] ={
  28. {-1381.7242,1276.9611,1039.8672},
  29. {-1401.8888,1261.0510,1039.8741},
  30. {-1394.1561,1274.2472,1039.8672},
  31. {-1387.2743,1263.0626,1039.8741},
  32. {-1379.1420,1248.4054,1039.8672},
  33. {-1379.1001,1219.6829,1039.8672},
  34. {-1391.4531,1221.6755,1039.8672},
  35. {-1402.0007,1217.9125,1039.8672},
  36. {-1415.1235,1238.4708,1039.8672},
  37. {-1410.9012,1260.8301,1040.4379},
  38. {-1397.9063,1260.1892,1039.8741},
  39. {-1383.9586,1269.8687,1039.8672}
  40. };
  41.  
  42. new WarWeapons[14] = {
  43. 22,23,24,25,26,27,28,29,30,31,32,33,5,9
  44. };
  45. //===[Forward's]==
  46. forward WarCount();
  47. forward WarCount2();
  48. forward CheckWinner();
  49. forward ToWar();
  50. forward UnFreeze();
  51.  
  52. public OnPlayerDeath(playerid,killerid,reason)
  53. {
  54.     if(InWar[playerid] == 1)
  55.     {
  56.         WarPlayers--;
  57.         ResetPlayerWeapons(playerid);
  58.         SendClientMessage(playerid,red,".יצאת מהפעילות");
  59.     }
  60.     return 1;
  61. }
  62.  
  63. public OnPlayerDisconnect(playerid,reason)
  64. {
  65.     if(InWar[playerid] == 1)
  66.     {
  67.         WarPlayers--;
  68.     }
  69.     return 1;
  70. }
  71.  
  72. public OnPlayerCommandText(playerid,cmdtext[])
  73. {
  74. if(strcmp(cmdtext,"/WarStart",true)==0)
  75. {
  76.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,red,"ERROR: פקודה זו היא לאדמינים בלבד");
  77.     if(WarOn == 1) return SendClientMessage(playerid,red,"ERROR: פעילות זו כבר מופעלת");
  78.     WarReg = 1;
  79.     WarCount();
  80.     SendClientMessageToAll(lightBlue,"-----[War Activity]-----");
  81.     SendClientMessageToAll(lightBlue,".WaR החלה ההרשמה לפעילות");
  82.     SendClientMessageToAll(lightBlue,"/War - להרשמה הקש פקודה זו");
  83.     SendClientMessageToAll(lightBlue,"Money$ - כניסה לפעילות זו עולה");
  84.     SendClientMessageToAll(lightBlue,"Price$ - הפרס לזוכה בפעילות הוא");
  85.     SendClientMessageToAll(lightBlue,"-----[War Activity]-----");
  86.     return 1;
  87. }
  88.  
  89. if(strcmp(cmdtext,"/WarEnd",true)==0)
  90. {
  91.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,red,"ERROR: פקודה זו היא רק לאדמינים");
  92.     if(WarOn) return SendClientMessage(playerid,red,"ERROR: פעילות זו אינה מופעלת");
  93.     format(String,256,"War ביטל  את פעילות ה \"%s\" האדמין",GetName(playerid));
  94.     SendClientMessageToAll(yellow,String);
  95.     WarOn = 0;
  96.     WarPlayers = 0;
  97.     for(new i = 0; i < GetMaxPlayers(); i++)
  98.     {
  99.         if(IsPlayerConnected(i) && InWar[i] == 1)
  100.         {
  101.             SpawnPlayer(i);
  102.         }
  103.     }
  104.     return 1;
  105. }
  106.  
  107. if(strcmp(cmdtext,"/War",true)==0)
  108. {
  109.     if(WarOn == 0) return SendClientMessage(playerid,red,"ERROR: פעילות זו אינה מופעלת כעת");
  110.     if(WarReg == 0) return SendClientMessage(playerid,red,"ERROR: הפעילות כבר החלה");
  111.     if(WarPlayers == Block) return SendClientMessage(playerid,red,"ERROR: נגמרו כל המקומות בפעילות");
  112.     SendClientMessageToAll(lightBlue,"---------[War Activity]---------");
  113.     SendClientMessageToAll(lightBlue,".הצטרפת לפעילות בהצלחה");
  114.     SendClientMessageToAll(lightBlue,"בפעילות זאת מטרתך העיקרית היא לשרוד אחרון");
  115.     SendClientMessageToAll(lightBlue,"כדי לעשות זאת , תצטרך להתחמק מיריות של אחרים");
  116.     SendClientMessageToAll(lightBlue,"ולהרוג את כל מי שעומד בדרכך (:");
  117.     SendClientMessageToAll(lightBlue,"בהצלחה בפעילות, מקווים שתזכה..");
  118.     SendClientMessageToAll(lightBlue,"---------[War Activity]---------");
  119.     InWar[playerid] = 1;
  120.     WarPlayers++;
  121.     return 1;
  122. }
  123.  
  124. if(strcmp(cmdtext,"/WarExit",true)==0)
  125. {
  126.     if(WarOn == 0) return SendClientMessage(playerid,red,"ERROR: פעילות זו אינה מופעלת כעת");
  127.     if(InWar[playerid]) return SendClientMessage(playerid,red,"ERROR: אתה לא בפעילות");
  128.     SpawnPlayer(playerid);
  129.     InWar[playerid] = 0;
  130.     WarPlayers--;
  131.     SendClientMessage(playerid,red,".יצאת מהפעילות");
  132.     return 1;
  133. }
  134.  
  135. return 0;
  136. }
  137.  
  138. public WarCount()
  139. {
  140.     new cdt[256];
  141.     format(cdt,256,"~y~WaR: ~w~%d",cd);
  142.     if(cd > 0)
  143.     {
  144.         GameTextForAll(cdt,1000,6);
  145.         SetTimer("WarCount",1000,0);
  146.     }   else  if(cd == 15)  {
  147.             SendClientMessageToAll(green,"• /War - הפעילות תתחיל בעוד 15 שניות להצטרפות הקש •");
  148.             } else {
  149.             if(WarPlayers < MinPlayers) return SendClientMessageToAll(red,"הפעילות בוטלה, סיבה: חוסר משתתפים");
  150.             cd = CDN2;
  151.             WarReg = 0;
  152.             WarCount2();
  153.             ToWar();
  154.             for(new i=0;i<GetMaxPlayers();i++)
  155.             {
  156.                 if(IsPlayerConnected(i) && InWar[i] == 1)
  157.                 {
  158.                     SendClientMessage(i,green,".שוגרת לפעילות, הפעילות תתחיל בעוד מספר שניות");
  159.                 }
  160.             }
  161.                 }
  162.     return 1;
  163. }
  164.  
  165. public WarCount2()
  166. {
  167.     new cdt1[256];
  168.     format(cdt1,256,"~y~Start IN: ~w~%d",cd);
  169.     if(cd > 0)
  170.     {
  171.         GameTextForAll(cdt1,1000,6);
  172.         SetTimer("WarCount",1000,0);
  173.     }   else    {
  174.         UnFreeze();
  175.         SendClientMessageToAll(red,".הפעילות החלה בהצלחה למתמודדים");
  176.     }
  177. }
  178.  
  179. public ToWar()
  180. {
  181.     CheckWinner();
  182.     for(new i = 0; i < GetMaxPlayers();i++)
  183.     {
  184.         if(IsPlayerConnected(i) && InWar[i] == 1)
  185.         {
  186.             new Rand = random(sizeof(WarSpawns));
  187.             SetPlayerPos(i,WarSpawns[Rand][0],WarSpawns[Rand][1],WarSpawns[Rand][2]);
  188.             TogglePlayerControllable(i,0);
  189.             SetPlayerInterior(i,16);
  190.             SendClientMessage(i,yellow,".שוגרת לפעילות, הפעילות תתחיל בעוד מספר שניות");
  191.         }
  192.     }
  193.     return 1;
  194. }
  195.  
  196. public UnFreeze()
  197. {
  198.     for(new i = 0; i < GetMaxPlayers();i++)
  199.     {
  200.         if(IsPlayerConnected(i) && InWar[i] == 1)
  201.         {
  202.             TogglePlayerControllable(i,1);
  203.             new Rand = random(sizeof(WarWeapons));
  204.             GivePlayerWeapon(i,WarWeapons[Rand],10000);
  205.         }
  206.     }
  207.     return 1;
  208. }
  209.  
  210. public CheckWinner()
  211. {
  212.     if(WarPlayers > 1) return SetTimer("CheckWinner",1000,0);
  213.     for(new i = 0; i < GetMaxPlayers(); i++)
  214.     {
  215.         if(IsPlayerConnected(i) && InWar[i] == 1 && !WarOn)
  216.         {
  217.             GivePlayerMoney(i,Price);
  218.             format(String,256,"• %s Winner in Mini",GetName(i));
  219.             GameTextForAll(String,4000,4);
  220.             format(String,256,"• Warזכה בפעילות ה %s ברכותינו, השחקן •",GetName(i));
  221.             SendClientMessage(i,green,"כל הכבוד ! זכית בפעילות");
  222.             SendClientMessageToAll(yellow,String);
  223.             SpawnPlayer(i);
  224.             WarPlayers = 0;
  225.             WarOn = 0;
  226.             InWar[i] = 0;
  227.         }
  228.     }
  229.     return 1;
  230. }
  231.  
  232. stock GetName(playerid)
  233. {
  234.     new Name[MAX_PLAYER_NAME];
  235.     GetPlayerName(playerid,Name,MAX_PLAYER_NAME);
  236.     return Name;
  237. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement