Advertisement
XpDeviL

[SA-MP] xProtection - Spawn Koruması // by XpDeviL

Mar 15th, 2017
6,202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.83 KB | None | 0 0
  1. /*
  2.         xProtection - Spawn Koruması
  3.                                         by XpDeviL | www.xpdevil.com
  4.                                        
  5.             Özellikler:
  6.            
  7.             * Oyuncu spawn olunca 10 saniyelik bir korumaya sahip olur.
  8.             * Eğer oyuncu hareket eder veya ateş ederse koruma iptal olur.
  9.             * Spawn koruması olan oyuncuyu vuran oyuncuya, spawn koruması olduğuna dair mesaj gider.
  10. */
  11.  
  12. #include <a_samp>
  13.  
  14. enum xsp
  15. {
  16.     protected,
  17.     protectTimer,
  18. };
  19. new xProtection[MAX_PLAYERS][xsp];
  20.  
  21. public OnFilterScriptInit()
  22. {
  23.     print("\n+-----------------------------------------------------------+");
  24.     print("|                                                           |");
  25.     print("|       xProtection - Spawn Koruması ! Yüklendi !      |");
  26.     print("|                                                           |");
  27.     print("+----------------------------------------------+------------+");
  28.     print("                                               | by XpDeviL |");
  29.     print("                                               +------------+");
  30.     return 1;
  31. }
  32.  
  33. public OnPlayerSpawn(playerid)
  34. {
  35.     xProtection[playerid][protected] = 1;
  36.     SetPlayerHealth(playerid, 65535.0);
  37.     SetPlayerAttachedObject(playerid, 9, 18741, 1, -1.075000, 0.019999, -1.651001, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000);
  38.     xProtection[playerid][protectTimer] = SetTimerEx("EndProtect", 10000, false, "d", playerid);
  39.     SendClientMessage(playerid, -1, "{00FF00}[!] {00FFB3}10 saniyelik spawn koruması aktifleştirildi! Hareket ederseniz koruma sona eder.");
  40.     return 1;
  41. }
  42.  
  43. public OnPlayerUpdate(playerid)
  44. {
  45.     if(xProtection[playerid][protected] == 1)
  46.     {
  47.         new Keys,ud,lr;
  48.         GetPlayerKeys(playerid,Keys,ud,lr);
  49.      
  50.         if(ud == KEY_UP || ud == KEY_DOWN || lr == KEY_LEFT || lr == KEY_RIGHT || Keys == KEY_JUMP)
  51.         {
  52.             SendClientMessage(playerid, -1, "{FF0000}[!] {FFA500}Hareket ettiğiniz için spawn koruması sona erdi!");
  53.             EndProtection(playerid);
  54.         }
  55.     }
  56.     return 1;
  57. }
  58.  
  59. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
  60. {
  61.     if(xProtection[playerid][protected] == 1)
  62.     {
  63.         SendClientMessage(playerid, -1, "{FF0000}[!] {FFA500}Ateş ettiğiniz için spawn koruması sona erdi!");
  64.         EndProtection(playerid);
  65.     }
  66.    
  67.     if(hittype == BULLET_HIT_TYPE_PLAYER)
  68.     {
  69.         if(xProtection[hitid][protected] == 1)
  70.         {
  71.             SendClientMessage(playerid, -1, "{FF0000}[!] {FFA500}Ateş ettiğiniz oyuncunun spawn koruması var!");
  72.         }
  73.     }
  74.     return 1;
  75. }
  76.  
  77. forward EndProtect(playerid);
  78. public EndProtect(playerid)
  79. {
  80.     EndProtection(playerid);
  81.     SendClientMessage(playerid, -1, "{FF0000}[!] {FFA500}Spawn korumanız sona erdi!");
  82.     return 1;
  83. }
  84.  
  85. forward EndProtection(playerid);
  86. public EndProtection(playerid)
  87. {
  88.     xProtection[playerid][protected] = 0;
  89.     SetPlayerHealth(playerid, 100.0);
  90.     RemovePlayerAttachedObject(playerid, 9);
  91.     KillTimer(xProtection[playerid][protectTimer]);
  92.     return 1;
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement