Advertisement
Guest User

Untitled

a guest
Apr 11th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // uncomment the line below if you want to write a filterscript
  2. #define FILTERSCRIPT
  3.  
  4. #include <a_samp>
  5. #include <zcmd>
  6.  
  7. #define COLOR_LIGHTBLUE 0x33CCFFAA
  8.  
  9. #define MISSIONTIME                  (2) //2 minutes
  10.  
  11. #define BOUNTYMONEY     100000
  12.  
  13. new connectedids[MAX_PLAYERS], onlineplayers, playername[MAX_PLAYER_NAME+5], hiton = -1, recenthit = 0, bounty, bonus;
  14.  
  15. forward NewHit();
  16. forward HitKilled(playerid);
  17.  
  18. public OnFilterScriptInit()
  19. {
  20.     return 1;
  21. }
  22.  
  23. public OnFilterScriptExit()
  24. {
  25.     return 1;
  26. }
  27.  
  28. public OnGameModeInit()
  29. {
  30.     // Don't use these lines if it's a filterscript
  31.     SetGameModeText("Blank Script");
  32.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  33.     return 1;
  34. }
  35.  
  36. public OnGameModeExit()
  37. {
  38.     return 1;
  39. }
  40.  
  41. public OnPlayerRequestClass(playerid, classid)
  42. {
  43.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  44.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  45.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  46.     return 1;
  47. }
  48.  
  49. public OnPlayerDeath(playerid, killerid, reason)
  50. {
  51.     if(hiton == killerid)
  52.     {
  53.         new pName[ MAX_PLAYER_NAME ], vName[ MAX_PLAYER_NAME ], string[ 128 ];
  54.         GetPlayerName(killerid,pName,sizeof pName);
  55.         GetPlayerName(playerid,vName,sizeof vName);
  56.         GivePlayerMoney(playerid, bounty + bonus);
  57.         format(string,sizeof string,"[HIT] {FFFFFF}%s skotose to stoxo %s kai kerdise (%d{6EF83C}${FFFFFF}) me bonus (%d{6EF83C}${FFFFFF})",pName, vName, bounty, bonus);
  58.         SendClientMessageToAll(0x48977996,string);
  59.         hiton = -1;
  60.         recenthit = 0;
  61.     }
  62.     return 1;
  63. }
  64.  
  65. CMD:peirates(playerid, params[])
  66. {
  67.     if(IsPlayerAdmin(playerid))
  68.     {
  69.         if(recenthit >= 1)
  70.         {
  71.             SendClientMessageToAll(COLOR_LIGHTBLUE, "Se ena lepto ksekinaei kinigi paixton! Etoimasteite!");
  72.             SetTimer("NewHit",(1000*60*MISSIONTIME),1);
  73.             recenthit = 0;
  74.         }
  75.     }
  76.     return 1;
  77. }
  78.  
  79. public NewHit()
  80. {
  81.     new string[180];
  82.     new playersid;
  83.     bounty = random(BOUNTYMONEY);
  84.     for(new i=0; i<MAX_PLAYERS; i++)
  85.     {
  86.         if(IsPlayerConnected(i))
  87.         {
  88.             connectedids[onlineplayers] = i;
  89.             onlineplayers++;
  90.         }
  91.     }
  92.     GetPlayerName(connectedids[random(onlineplayers)], playername, sizeof(playername));
  93.     playersid = GetPlayerIdFromName(playername);
  94.  
  95.     bonus = GetPlayerScore(playersid) + random(10000);
  96.  
  97.     SendClientMessageToAll(COLOR_LIGHTBLUE, "|__________Plirofories__________|");
  98.     format(string, sizeof(string), "Stoxos: %s", playername);
  99.     format(string, sizeof(string), "Amoivi: $%i", bounty);
  100.     format(string, sizeof(string), "Bonus: $%i", bonus);
  101.     SendClientMessageToAll(COLOR_LIGHTBLUE, string);
  102.  
  103.     hiton = playersid;
  104.     return 1;
  105. }
  106.  
  107. stock GetPlayerIdFromName(pname[])
  108. {
  109.   for(new i = 0; i <= MAX_PLAYERS; i++)
  110.   {
  111.     if(IsPlayerConnected(i))
  112.     {
  113.       new playername2[MAX_PLAYER_NAME];
  114.       GetPlayerName(i, playername2, sizeof(playername2));
  115.       if(strcmp(playername2, pname, true, strlen(pname)) == 0)
  116.       {
  117.         return i;
  118.       }
  119.     }
  120.   }
  121.   return INVALID_PLAYER_ID;
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement