Advertisement
Guest User

Untitled

a guest
May 29th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.05 KB | None | 0 0
  1. dcmd_sellweapon(playerid, params[])
  2. {
  3. if(Jailed[playerid] == 1)
  4. {
  5. SendClientMessage(playerid, COLOR_ERROR, "You cannot use this command in jail");
  6. return 1;
  7. }
  8. if(gTeam[playerid] != TEAM_GUNS)
  9. {
  10. SendClientMessage(playerid, COLOR_ERROR, "Only Weapon Dealers can sell weapons");
  11. return 1;
  12. }
  13. new x_nr[64];
  14. new giveplayerid;
  15. if(sscanf(params,"ud",giveplayerid,x_nr))
  16. {
  17. SendClientMessage(playerid, COLOR_ERROR, "USAGE: /sellweapon (id) [WEAPON.No]");
  18. return 1;
  19. }
  20. if(!IsNumeric(x_nr))
  21. {
  22. SendClientMessage(playerid, COLOR_ERROR, "USAGE: /sellweapon (id) [WEAPON.No] ID Must be a number");
  23. return 1;
  24. }
  25. if(Jailed[giveplayerid] == 1)
  26. {
  27. SendClientMessage(playerid, COLOR_ERROR, "You cannot sell weapons to a prisoner");
  28. return 1;
  29. }
  30. if(OfferedGuns[giveplayerid] == 0)
  31. {
  32. SendClientMessage(playerid, COLOR_ERROR,"No Weapon Dealer has offered to sell this player weapons. Use /sellweapons id first");
  33. return 1;
  34. }
  35. new workername[24];
  36. new costumername[24];
  37. new string[256];
  38. GetPlayerName(playerid,workername, 24);
  39. GetPlayerName(giveplayerid, costumername, 24);
  40. if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 15)
  41. {
  42. format(string, sizeof(string), "%s(%d) Is not close enough. You cannot sell weapons to that player",costumername,giveplayerid);
  43. SendClientMessage(playerid, COLOR_ERROR, string);
  44. return 1;
  45. }
  46. new oscore;
  47. if(IsPlayerConnected(playerid))
  48. {
  49. if(strcmp(x_nr,"1",true) == 0)
  50. {
  51. if(GetPlayerMoney(giveplayerid) <= 2499)
  52. {
  53. SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
  54. format(string, sizeof(string), "%s(%d) Has tried to sell you a Silenced 9mm weapon. You cannot afford $2500",workername,playerid);
  55. SendClientMessage(giveplayerid, COLOR_ERROR, string);
  56. SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
  57. format(string, sizeof(string), "%s(%d) cannot afford that weapon",costumername,giveplayerid);
  58. SendClientMessage(playerid, COLOR_ERROR, string);
  59. return 1;
  60. }
  61. GivePlayerWeapon(giveplayerid,23,100);
  62. GivePlayerMoney(giveplayerid, -2500);
  63. GivePlayerMoney(playerid,1500);
  64. SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
  65. format(string, sizeof(string), "%s(%d) Has sold you a Silenced 9mm weapon with 100 Ammo for $2500",workername,playerid);
  66. SendClientMessage(giveplayerid, 0x00C7FFAA, string);
  67. SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sold_|");
  68. format(string, sizeof(string), "%s(%d) Has purchased a Silenced 9mm weapon from you. You receive a $1500 bonus",costumername,giveplayerid);
  69. SendClientMessage(playerid, 0x00C7FFAA, string);
  70. oscore = GetPlayerScore(playerid);
  71. SetPlayerScore(playerid, oscore +1);
  72. }
  73. else if(strcmp(x_nr,"2",true) == 0)
  74. {
  75. if(GetPlayerMoney(giveplayerid) <= 999)
  76. {
  77. SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
  78. format(string, sizeof(string), "%s(%d) Has tried to sell you a Tec9 weapon. You cannot afford $1000",workername,playerid);
  79. SendClientMessage(giveplayerid, COLOR_ERROR, string);
  80. SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
  81. format(string, sizeof(string), "%s(%d) cannot afford that weapon",costumername,giveplayerid);
  82. SendClientMessage(playerid, COLOR_ERROR, string);
  83. return 1;
  84. }
  85. GivePlayerWeapon(giveplayerid,32,500);
  86. GivePlayerMoney(giveplayerid, -1000);
  87. GivePlayerMoney(playerid,1500);
  88. SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
  89. format(string, sizeof(string), "%s(%d) Has sold you a Tec9 weapon with 500 Ammo for $1000",workername,playerid);
  90. SendClientMessage(giveplayerid, 0x00C7FFAA, string);
  91. SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sold_|");
  92. format(string, sizeof(string), "%s(%d) Has purchased a Tec9 weapon from you. You receive a $1500 bonus",costumername,giveplayerid);
  93. SendClientMessage(playerid, 0x00C7FFAA, string);
  94. oscore = GetPlayerScore(playerid);
  95. SetPlayerScore(playerid, oscore +1);
  96. }
  97. else if(strcmp(x_nr,"3",true) == 0)
  98. {
  99. if(GetPlayerMoney(giveplayerid) <= 3499)
  100. {
  101. SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
  102. format(string, sizeof(string), "%s(%d) Has tried to sell you a Sawnoff Shotgun weapon. You cannot afford $3500",workername,playerid);
  103. SendClientMessage(giveplayerid, COLOR_ERROR, string);
  104. SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
  105. format(string, sizeof(string), "%s(%d) cannot afford that weapon",costumername,giveplayerid);
  106. SendClientMessage(playerid, COLOR_ERROR, string);
  107. return 1;
  108. }
  109. GivePlayerWeapon(giveplayerid,26,30);
  110. GivePlayerMoney(giveplayerid, -3500);
  111. GivePlayerMoney(playerid,1500);
  112. SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
  113. format(string, sizeof(string), "%s(%d) Has sold you a Sawnoff Shotgun weapon with 30 Ammo for $3500",workername,playerid);
  114. SendClientMessage(giveplayerid, 0x00C7FFAA, string);
  115. SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sold_|");
  116. format(string, sizeof(string), "%s(%d) Has purchased a Sawnoff Shotgun weapon from you. You receive a $1500 bonus",costumername,giveplayerid);
  117. SendClientMessage(playerid, 0x00C7FFAA, string);
  118. oscore = GetPlayerScore(playerid);
  119. SetPlayerScore(playerid, oscore +1);
  120. }
  121. else if(strcmp(x_nr,"4",true) == 0)
  122. {
  123. if(GetPlayerMoney(giveplayerid) <= 14999)
  124. {
  125. SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
  126. format(string, sizeof(string), "%s(%d) Has tried to sell you a Sniper Rifle weapon. You cannot afford $15000",workername,playerid);
  127. SendClientMessage(giveplayerid, COLOR_ERROR, string);
  128. SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
  129. format(string, sizeof(string), "%s(%d) cannot afford that weapon",costumername,giveplayerid);
  130. SendClientMessage(playerid, COLOR_ERROR, string);
  131. return 1;
  132. }
  133. GivePlayerWeapon(giveplayerid,34,30);
  134. GivePlayerMoney(giveplayerid, -15000);
  135. GivePlayerMoney(playerid,1500);
  136. SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
  137. format(string, sizeof(string), "%s(%d) Has sold you a Sniper Rifle weapon with 30 Ammo for $15000",workername,playerid);
  138. SendClientMessage(giveplayerid, 0x00C7FFAA, string);
  139. SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sold_|");
  140. format(string, sizeof(string), "%s(%d) Has purchased a Sniper Rifle weapon from you. You receive a $1500 bonus",costumername,giveplayerid);
  141. SendClientMessage(playerid, 0x00C7FFAA, string);
  142. oscore = GetPlayerScore(playerid);
  143. SetPlayerScore(playerid, oscore +1);
  144. }
  145. else if(strcmp(x_nr,"5",true) == 0)
  146. {
  147. if(GetPlayerMoney(giveplayerid) <= 7999)
  148. {
  149. SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
  150. format(string, sizeof(string), "%s(%d) Has tried to sell you a AK47 weapon. You cannot afford $8000",workername,playerid);
  151. SendClientMessage(giveplayerid, COLOR_ERROR, string);
  152. SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
  153. format(string, sizeof(string), "%s(%d) cannot afford that weapon",costumername,giveplayerid);
  154. SendClientMessage(playerid, COLOR_ERROR, string);
  155. return 1;
  156. }
  157. GivePlayerWeapon(giveplayerid,30,200);
  158. GivePlayerMoney(giveplayerid, -8000);
  159. GivePlayerMoney(playerid,1500);
  160. SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
  161. format(string, sizeof(string), "%s(%d) Has sold you a AK47 weapon with 200 Ammo for $8000",workername,playerid);
  162. SendClientMessage(giveplayerid, 0x00C7FFAA, string);
  163. SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sold_|");
  164. format(string, sizeof(string), "%s(%d) Has purchased a AK47 weapon from you. You receive a $1500 bonus",costumername,giveplayerid);
  165. SendClientMessage(playerid, 0x00C7FFAA, string);
  166. oscore = GetPlayerScore(playerid);
  167. SetPlayerScore(playerid, oscore +1);
  168. }
  169. else if(strcmp(x_nr,"6",true) == 0)
  170. {
  171. if(GetPlayerMoney(giveplayerid) <= 499)
  172. {
  173. SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
  174. format(string, sizeof(string), "%s(%d) Has tried to sell you Armor. You cannot afford $500",workername,playerid);
  175. SendClientMessage(giveplayerid, COLOR_ERROR, string);
  176. SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
  177. format(string, sizeof(string), "%s(%d) cannot afford Armor",costumername,giveplayerid);
  178. SendClientMessage(playerid, COLOR_ERROR, string);
  179. return 1;
  180. }
  181. SetPlayerArmour(giveplayerid, 100);
  182. GivePlayerMoney(giveplayerid, -500);
  183. GivePlayerMoney(playerid,1500);
  184. SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
  185. format(string, sizeof(string), "%s(%d) Has sold you Armor for $500",workername,playerid);
  186. SendClientMessage(giveplayerid, 0x00C7FFAA, string);
  187. SendClientMessage(playerid, 0xA9A9A9AA, "|_Weapon Sold_|");
  188. format(string, sizeof(string), "%s(%d) Has purchased Armor from you. You receive a $1500 bonus",costumername,giveplayerid);
  189. SendClientMessage(playerid, 0x00C7FFAA, string);
  190. oscore = GetPlayerScore(playerid);
  191. SetPlayerScore(playerid, oscore +1);
  192. }
  193. else
  194. {
  195. SendClientMessage(playerid, COLOR_ERROR, "USAGE: /sellweapon (id) (WEAPON.No)");
  196. return 1;
  197. }
  198. }
  199. return 1;
  200. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement