Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 20th, 2012  |  syntax: None  |  size: 5.54 KB  |  views: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf2>
  4.  
  5. #define TEAM_RANDOM     9
  6. #define TEAM_COPS       10
  7.  
  8. new bMoney[MAX_PLAYERS];
  9. new pBribe[MAX_PLAYERS];
  10. new pBribed[MAX_PLAYERS];
  11. new bRecently[MAX_PLAYERS];
  12. new bTimer[MAX_PLAYERS];
  13. new bAccepted[MAX_PLAYERS]; //0 = not confirmed yet. 1 = accepted. 2 = refused
  14.  
  15. forward BribeCancel(playerid);
  16.  
  17. public OnFilterScriptInit()
  18. {
  19.         print("\n--------------------------------------");
  20.         print(" Blank Filterscript by your name here");
  21.         print("--------------------------------------\n");
  22.         return 1;
  23. }
  24.  
  25. public OnFilterScriptExit()
  26. {
  27.         return 1;
  28. }
  29.  
  30. public OnPlayerConnect(playerid)
  31. {
  32.         return 1;
  33. }
  34.  
  35. public OnPlayerDisconnect(playerid, reason)
  36. {
  37.         return 1;
  38. }
  39.  
  40. public OnPlayerSpawn(playerid)
  41. {
  42.         return 1;
  43. }
  44.  
  45. public OnPlayerDeath(playerid, killerid, reason)
  46. {
  47.         return 1;
  48. }
  49.  
  50. stock FindTeam(playerid)
  51. {
  52.         new Team = GetPVarInt(playerid,"Team");
  53.         return Team;
  54. }
  55.  
  56. stock Float:GetDistanceBetweenPlayers(p1,p2)
  57. {
  58.         new Float:x1,Float:y1,Float:z1,Float:x3,Float:y3,Float:z3;
  59.         if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2)){
  60.                 return -1.00;
  61.         }
  62.         GetPlayerPos(p1,x1,y1,z1);
  63.         GetPlayerPos(p2,x3,y3,z3);
  64.         return floatsqroot(floatpower(floatabs(floatsub(x3,x1)),2)+floatpower(floatabs(floatsub(y3,y1)),2)+floatpower(floatabs(floatsub(z3,z1)),2));
  65. }
  66.  
  67. CMD:bribe(playerid,params[])
  68. {
  69.         new player1,Float:X,Float:Y,Float:Z,oName[24], pName[24],str[130],Team,amount;
  70.         Team = FindTeam(playerid);
  71.         if(Team != TEAM_RANDOM) return SendClientMessage(playerid,-1,"Sorry, This Command Is For Civilians Only");
  72.         if(sscanf(params,"ud",player1,amount)) return SendClientMessage(playerid,-1,"USAGE: /br(ribe) [playerid] [amount]");
  73.         GetPlayerPos(playerid,X,Y,Z);
  74.         GetPlayerName(playerid,pName,24); GetPlayerName(player1,oName,24);
  75.         if(amount < 0 || amount < GetPlayerMoney(playerid) || amount > 15000) return SendClientMessage(playerid,-1,"Invalid Amount. Max 15000");
  76.         if(!IsPlayerConnected(player1)) return SendClientMessage(playerid,-1,"Invalid Player ID.");
  77.         if(bRecently[player1] == 1) return SendClientMessage(playerid,-1,"Someone Has Bribed This Police Officer Recently");
  78.         if(bRecently[playerid] == 1) return SendClientMessage(playerid,-1,"Please Wait Before Attempting to Bribe Again");
  79.         if(FindTeam(player1) != TEAM_COPS) return SendClientMessage(playerid,-1,"This Player Isn't A Police Officer.");
  80.         if(GetDistanceBetweenPlayers(playerid,player1) > 8) return SendClientMessage(playerid,-1,"This Player Isn't Close Enough");
  81.         bMoney[playerid] = amount;
  82.         bAccepted[playerid] = 0;
  83.         pBribed[playerid] = player1;
  84.         pBribe[player1] = playerid;
  85.         bRecently[playerid] = 1; bRecently[player1] = 1;
  86.         bTimer[playerid] = SetTimerEx("BribeCancel",13000,false,"i",playerid);
  87.         format(str,130,"Warrant %s (%d) Has Attempted To Bribe You With $%d. Type /Ac(cept) To Accept It",pName,playerid);
  88.         SendClientMessage(player1,-1,str);
  89.         format(str,130,"You Have Attempted To Bribe %s (%d) With $%d. Wait And See If They Will Accept",oName,player1);
  90.         SendClientMessage(playerid,-1,str);
  91.         GameTextForPlayer(player1,"~w~Bribe Offered",3000,0);
  92.         return 1;
  93. }
  94. CMD:br(playerid,params[]) return cmd_bribe(playerid,params);
  95.  
  96. CMD:accept(playerid,params[])
  97. {
  98.         if(FindTeam(playerid) != TEAM_COPS) return SendClientMessage(playerid,-1,"This Command Is For Police Officers Only");
  99.         if(bRecently[playerid] == 1)
  100.         {
  101.             new pName[24],oName[24],str[130],player1;
  102.             player1 = pBribe[playerid];
  103.             GetPlayerName(playerid,pName,24); GetPlayerName(player1,oName,24);
  104.             GivePlayerMoney(playerid,bMoney[player1]);
  105.             GivePlayerMoney(player1,-bMoney[player1]);
  106.             if(bMoney[player1] > 9000) return SetPlayerWantedLevel(player1,0);
  107.             if(bMoney[player1] < 9000) return SetPlayerWantedLevel(player1,2);
  108.             bMoney[player1] = 0;
  109.             pBribed[player1] = -1; pBribe[playerid] = -1;
  110.             bAccepted[player1] = 1;
  111.             GameTextForPlayer(player1,"~w~Bribe Accepted",3000,3);
  112.             format(str,130,"You Have Accepted %s (%d)'s Bribe For $%d",oName,player1,bMoney[player1]);
  113.             SendClientMessage(playerid,-1,str);
  114.             format(str,130,"Officer %s (%d) Has Accepted Your Briibe For $%d",pName,playerid,bMoney[player1]);
  115.             SendClientMessage(player1,-1,str);
  116.         } else return SendClientMessage(playerid,-1,"You Have Not Been Bribed Recently");
  117.         return 1;
  118. }
  119. CMD:ac(playerid,params[]) return cmd_accept(playerid,params);
  120.  
  121. CMD:refuse(playerid,params[])
  122. {
  123.         if(FindTeam(playerid) != TEAM_COPS) return SendClientMessage(playerid,-1,"This Command Is For Police Officers Only");
  124.         if(bRecently[playerid] == 1)
  125.         {
  126.             new pName[24],oName[24],str[130],player1;
  127.             player1 = pBribe[playerid];
  128.             GetPlayerName(playerid,pName,24); GetPlayerName(player1,oName,24);
  129.             bMoney[player1] = 0;
  130.             pBribed[player1] = -1; pBribe[playerid] = -1;
  131.             bAccepted[player1] = 2;
  132.             format(str,130,"You Have Refused %s (%d)'s Bribe For $%d",oName,player1,bMoney[player1]);
  133.             SendClientMessage(playerid,-1,str);
  134.             format(str,130,"Officer %s (%d) Has Refused Your Briibe For $%d",pName,playerid,bMoney[player1]);
  135.             SendClientMessage(player1,-1,str);
  136.         } else return SendClientMessage(playerid,-1,"You Have Not Been Bribed Recently");
  137.         return 1;
  138. }
  139. CMD:ref(playerid,params[]) return cmd_refuse(playerid,params);
  140.  
  141. public BribeCancel(playerid)
  142. {
  143.         for(new i; i < MAX_PLAYERS; i++)
  144.         {
  145.             if(bRecently[i] == 1)
  146.             {
  147.                 if(bAccepted[i] == 0)
  148.                 {
  149.                     SendClientMessage(i,-1,"Bribe Canceled");
  150.                     bMoney[i] = 0;
  151.                     pBribe[i] = 0;
  152.                     pBribed[i] = 0;
  153.                     bAccepted[i] = 0;
  154.                         }
  155.                 }
  156.         }
  157.         return 1;
  158. }
clone this paste RAW Paste Data