Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 60.64 KB | None | 0 0
  1. CMD:mdc(playerid, params[])
  2. {
  3. if (!IsPoliceFaction(playerid))
  4. return SendClientMessage(playerid, COLOR_ADM, "PRISTUP ODBIJEN:{FFFFFF} You aren't authorized to use this.");
  5.  
  6. if(!IsPlayerInAnyVehicle(playerid))
  7. return SendClientMessage(playerid, COLOR_ADM, "SERVER: You aren't in a vehicle.");
  8.  
  9. if(GetPlayerVehicleSeat(playerid) > 1)
  10. return SendClientMessage(playerid, COLOR_ADM, "SERVER: You can't use the MDC from back there.");
  11.  
  12. new
  13. vehicleid = GetPlayerVehicleID(playerid)
  14. ;
  15.  
  16. if(!IsValidFactionCar(vehicleid) || IsValidFactionCar(vehicleid) && !FactionData[FactionCar[vehicleid][carFaction]][factionCopPerms])
  17. return SendClientMessage(playerid, COLOR_ADM, "SERVER: This vehicle doesn't have a MDC.");
  18.  
  19. ShowPlayerMDC(playerid);
  20. return 1;
  21. }
  22.  
  23. CMD:wanted(playerid, params[])
  24. {
  25. if (!IsPoliceFaction(playerid))
  26. return SendClientMessage(playerid, COLOR_ADM, "PRISTUP ODBIJEN:{FFFFFFF} You aren't authorized to use this.");
  27.  
  28. if(!PlayerData[playerid][pLAWduty])
  29. return SendClientMessage(playerid, COLOR_ADM, "PRISTUP ODBIJEN:{FFFFFFF} You aren't authorized to use this.");
  30.  
  31. new
  32. playerb,
  33. reason[128],
  34. add_query[256];
  35.  
  36. if(sscanf(params, "us[128]", playerb, reason))
  37. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /wanted [playerid/DioImena] [reason]");
  38.  
  39. if(!IsPlayerConnected(playerb))
  40. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You specified an invalid player.");
  41.  
  42. if(!pLoggedIn[playerb])
  43. return SendClientMessage(playerid, COLOR_ADM, "ERROR: That player hasn't logged in yet.");
  44.  
  45. if(strlen(reason) < 3 || strlen(reason) > 128)
  46. return SendClientMessage(playerid, COLOR_ADM, "The reason must be between 3 to 128 characters.");
  47.  
  48. mysql_format(m_Handle, add_query, sizeof(add_query), "INSERT INTO criminal_record (player_name, entry_reason, entry_date, entry_by) VALUES('%e', '%e', '%e', '%e')", ReturnName(playerb, 0), reason, ReturnDate(), ReturnName(playerid, 1));
  49. mysql_tquery(m_Handle, add_query, "OnPlayerAddCharge", "ii", playerid, playerb);
  50. return 1;
  51. }
  52.  
  53. CMD:setp(playerid, params[])
  54. {
  55. if (!IsPoliceFaction(playerid))
  56. return SendClientMessage(playerid, COLOR_ADM, "PRISTUP ODBIJEN:{FFFFFFF} You aren't authorized to use this.");
  57.  
  58. new
  59. id;
  60. if(sscanf(params, "i", id))
  61. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /setp [precinct id, 1-3]");
  62.  
  63. if(id < 1 || id > 3)
  64. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You specified an invalid precinct.");
  65.  
  66. switch(id)
  67. {
  68. case 1:
  69. {
  70. if(!FactionData[PlayerData[playerid][pFaction]][factionSpawnEx1][0])
  71. return SendClientMessage(playerid, COLOR_ADM, "That precinct hasn't been configured yet.");
  72. }
  73. case 2:
  74. {
  75. if(!FactionData[PlayerData[playerid][pFaction]][factionSpawnEx2][0])
  76. return SendClientMessage(playerid, COLOR_ADM, "That precinct hasn't been configured yet.");
  77. }
  78. case 3:
  79. {
  80. if(!FactionData[PlayerData[playerid][pFaction]][factionSpawnEx3][0])
  81. return SendClientMessage(playerid, COLOR_ADM, "That precinct hasn't been configured yet.");
  82. }
  83. }
  84.  
  85. PlayerData[playerid][pSpawnPrecinct] = id;
  86. Message(playerid, COLOR_ADM, "[!] Your precinct spawn is now set (%d). You will spawn there on login.", id);
  87. return 1;
  88. }
  89.  
  90. //FD Commands:
  91. CMD:finishop(playerid, params[])
  92. {
  93. if(!IsMedicFaction(playerid))
  94. return UnAuthMessage(playerid);
  95.  
  96. if(!PlayerData[playerid][pMEDduty])
  97. return UnAuthMessage(playerid);
  98.  
  99. new
  100. playerb,
  101. str[128];
  102.  
  103. if(sscanf(params, "u", playerb))
  104. return SendClientMessage(playerid, COLOR_GREY, "USAGE: /finishop [playerid/DioImena]");
  105.  
  106. if(!IsPlayerConnected(playerb))
  107. return SendClientMessage(playerid, COLOR_GREY, "ERROR: You specified an invalid player.");
  108.  
  109. if(playerb == playerid)
  110. return SendClientMessage(playerid, COLOR_GREY, "ERROR: You can't heal yourself.");
  111.  
  112. if(!GetDistanceBetweenPlayers(playerid, playerb, 6.0) && !IsPlayerInDynamicArea(playerb, HospitalArea))
  113. return SendClientMessage(playerid, COLOR_GREY, "SERVER: You aren't near that player.");
  114.  
  115. if(GetPlayerTeam(playerb) != STATE_WOUNDED)
  116. return SendClientMessage(playerid, COLOR_GREY, "SERVER: The player needs to be brutally wounded.");
  117.  
  118. PlayerData[playerb][pBrutallyWounded] = 0;
  119.  
  120. SetPlayerTeam(playerb, STATE_ALIVE);
  121. SetPlayerHealth(playerb, 50);
  122.  
  123. format(str, sizeof(str), "** HQ: %s %s finished an operation on %s! **", ReturnRank(playerid), ReturnName(playerid, 0), ReturnName(playerb));
  124. SendFDMessage(COLOR_EMT, str);
  125.  
  126. format(str, sizeof(str), "%s revived %s with \"/finishop\".", ReturnName(playerid), ReturnName(playerb));
  127. adminWarn(1, str);
  128.  
  129. Message(playerid, COLOR_EMT, "SERVER: You finished the operation on %s.", ReturnName(playerb, 0));
  130. Message(playerb, COLOR_EMT, "SERVER: You were operated on by %s.", ReturnName(playerid, 0));
  131. return 1;
  132. }
  133.  
  134. CMD:putinambu(playerid, params[])
  135. {
  136. if(!IsMedicFaction(playerid))
  137. return UnAuthMessage(playerid);
  138.  
  139. if(!PlayerData[playerid][pMEDduty])
  140. return UnAuthMessage(playerid);
  141.  
  142. new
  143. playerb, str[128],
  144. vehicleid = GetPlayerVehicleID(playerid);
  145.  
  146. if(GetVehicleModel(vehicleid) != 416)
  147. return SendClientMessage(playerid, COLOR_GREY, "SERVER: You aren't inside an ambulance.");
  148.  
  149. if(sscanf(params, "u", playerb))
  150. return SendClientMessage(playerid, COLOR_GREY, "USAGE: /putinambu [playerid/DioImena]");
  151.  
  152. if(!GetDistanceBetweenPlayers(playerid, playerb, 6.0) && !IsPlayerInDynamicArea(playerb, HospitalArea))
  153. return SendClientMessage(playerid, COLOR_GREY, "SERVER: You aren't near that player.");
  154.  
  155. if(GetPlayerTeam(playerb) != STATE_WOUNDED)
  156. return SendClientMessage(playerid, COLOR_GREY, "SERVER: The player needs to be brutally wounded.");
  157.  
  158. new
  159. seat_available = -1;
  160.  
  161. foreach(new i : Player) if(IsPlayerInVehicle(i, vehicleid))
  162. {
  163. if(GetPlayerVehicleSeat(i) != 2)
  164. {
  165. seat_available = 2;
  166. }
  167. else if(GetPlayerVehicleSeat(i) != 3)
  168. {
  169. seat_available = 3;
  170. }
  171. }
  172. if(seat_available == -1)
  173. return SendClientMessage(playerid, COLOR_ADM, "SERVER: There's no room in your Ambulance.");
  174.  
  175. format(str, sizeof(str), "puts %s into the ambulance.", ReturnName(playerb, 0));
  176. cmd_me(playerid, str);
  177.  
  178. PutPlayerInVehicle(playerb, vehicleid, seat_available);
  179. PlayerData[playerb][pInsideAmbulance] = 1;
  180. return 1;
  181. }
  182.  
  183. //
  184. CMD:buydrink(playerid, params[])
  185. {
  186. if(!IsPlayerInBusiness(playerid))
  187. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't in an establishment.");
  188.  
  189. new id = IsPlayerInBusiness(playerid);
  190.  
  191. if(BusinessData[id][businessType] != BIZ_CLUB)
  192. return SendClientMessage(playerid, COLOR_ADM, "ERROR: This isn't a club.");
  193.  
  194. if(3 > PlayerData[playerid][pMoney])
  195. return SendClientMessage(playerid, COLOR_ADM, "You can't afford a drink. ($3)");
  196.  
  197. SendClientMessage(playerid, COLOR_YELLOW, "You bought a Drink! Use /usedrink, /givedrink!");
  198. GiveMoney(playerid, -3);
  199.  
  200. PlayerData[playerid][pDrinks]++;
  201. return 1;
  202. }
  203.  
  204. //Business commands
  205. CMD:buybiz(playerid, params[])
  206. {
  207. if(!pLoggedIn[playerid])return true;
  208. if(CountPlayerBusinesses(playerid) == 1)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You already own a business.");
  209.  
  210. new string[128], bizid = 0;
  211.  
  212. for(new i = 0; i < MAX_BUSINESS; i++){
  213. if(BusinessData[i][businessID] != 0){
  214. if(IsPlayerInRangeOfPoint(playerid, 3.0, BusinessData[i][businessExt][0], BusinessData[i][businessExt][1], BusinessData[i][businessExt][2])){
  215. bizid = i;
  216. }
  217. }
  218. }
  219.  
  220. if(bizid == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't near any businesses.");
  221. if(BusinessData[bizid][businessOwnerSQL] != 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You can't buy a business that's already owned.");
  222. if(BusinessData[bizid][businessType] == 8 || BusinessData[bizid][businessType] == 9)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You can't buy this type of business.");
  223. if(PlayerData[playerid][pMoney] < BusinessData[bizid][businessMarketPrice]){
  224. format(string, sizeof(string), "Insufficient amount. This business cost $%s. Please arrange a sufficient payment.", MoneyFormat(BusinessData[bizid][businessMarketPrice]));
  225. SendClientMessage(playerid, COLOR_ADM, string);
  226. return true;
  227. }
  228. if(PlayerData[playerid][pLevel] < BusinessData[bizid][businessLevel])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't the level required for this business.");
  229.  
  230. GiveMoney(playerid, -BusinessData[bizid][businessMarketPrice]);
  231. BusinessData[bizid][businessOwnerSQL] = PlayerData[playerid][pSQLID];
  232.  
  233. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  234. GameTextForPlayer(playerid, "Congratulations!~n~You're now the owner of this business!", 4000, 5);
  235.  
  236. SaveSQLInt(BusinessData[bizid][businessID], "businesses", "OwnerSQL", BusinessData[bizid][businessOwnerSQL]);
  237.  
  238. DestroyDynamicPickup(BusinessData[bizid][businessPickup]);
  239. BusinessData[bizid][businessPickup] = CreateDynamicPickup(1239, 14, BusinessData[bizid][businessExt][0], BusinessData[bizid][businessExt][1], BusinessData[bizid][businessExt][2], 0);
  240.  
  241. return true;
  242. }
  243.  
  244. CMD:sellbiz(playerid, params[])
  245. {
  246. if(!pLoggedIn[playerid])return true;
  247. if(CountPlayerBusinesses(playerid) == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own a business.");
  248.  
  249. new string[128], confirm[60];
  250.  
  251. if(sscanf(params, "s[60]", confirm))return SendClientMessage(playerid, COLOR_ADM, "SERVER:{FFFFFF} You're about to sell your business. Type /sellbiz confirm to confirm.");
  252.  
  253. if(strmatch(confirm, "confirm")){
  254. for(new i = 0; i < MAX_BUSINESS; i++){
  255. if(BusinessData[i][businessID] != 0){
  256. if(IsPlayerInRangeOfPoint(playerid, 3.0, BusinessData[i][businessExt][0], BusinessData[i][businessExt][1], BusinessData[i][businessExt][2])){
  257. if(BusinessData[i][businessOwnerSQL] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this business.");
  258.  
  259. BusinessData[i][businessOwnerSQL] = 0;
  260. SaveSQLInt(BusinessData[i][businessID], "businesses", "OwnerSQL", 0);
  261.  
  262. GameTextForPlayer(playerid, "You sold your business!", 3000, 5);
  263. format(string, sizeof(string), "SERVER:{FFFFFF} You sold your business. You were paid $%s of the market price.", MoneyFormat(BusinessData[i][businessMarketPrice] / 2));
  264. SendClientMessage(playerid, COLOR_ADM, string);
  265.  
  266. GiveMoney(playerid, BusinessData[i][businessMarketPrice] / 2);
  267. }
  268. }
  269. }
  270. }
  271. return true;
  272. }
  273.  
  274. CMD:bizinfo(playerid, params[])
  275. {
  276. if(!pLoggedIn[playerid])return true;
  277. if(CountPlayerBusinesses(playerid) == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't own a business.");
  278. if(!IsPlayerInBusiness(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't in your business.");
  279.  
  280. new bizid = IsPlayerInBusiness(playerid), string[128], lockString[40];
  281. if(BusinessData[bizid][businessOwnerSQL] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this business.");
  282.  
  283. if(BusinessData[bizid][businessLocked])
  284. format(lockString, sizeof(lockString), "Yes");
  285.  
  286. else
  287. format(lockString, sizeof(lockString), "No");
  288.  
  289. SendClientMessage(playerid, COLOR_DARKGREEN, "____________________________________________");
  290. format(string, sizeof(string), "*** %s ***", BusinessData[bizid][businessName]);
  291. SendClientMessage(playerid, COLOR_DARKGREEN, string);
  292. format(string, sizeof(string), "Owner:[%s] Level:[%d] Value:[%d] Type:[%d] Locked:[%s] ID:[%d]", ReturnName(playerid, 1), BusinessData[bizid][businessLevel],
  293. BusinessData[bizid][businessMarketPrice], BusinessData[bizid][businessType], lockString, BusinessData[bizid][businessID]);
  294. SendClientMessage(playerid, COLOR_WHITE, string);
  295.  
  296. format(string, sizeof(string), "Cashbox:[%s] Entrance Fee:[%s] Products[%d / 500]", MoneyFormat(BusinessData[bizid][businessCashbox]), MoneyFormat(BusinessData[bizid][businessFee]), BusinessData[bizid][businessProduct]);
  297. SendClientMessage(playerid, COLOR_WHITE, string);
  298.  
  299. SendClientMessage(playerid, COLOR_WHITE, "Employees: /hirelist");
  300.  
  301. SendClientMessage(playerid, COLOR_DARKGREEN, "____________________________________________");
  302.  
  303. return true;
  304. }
  305.  
  306. CMD:bizcashbox(playerid, params[])
  307. {
  308. if(CountPlayerBusinesses(playerid) == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't own a business.");
  309. if(!IsPlayerInBusiness(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't in your business.");
  310.  
  311. new bizid = IsPlayerInBusiness(playerid),
  312. specifier[30],
  313. type[30];
  314.  
  315. if(BusinessData[bizid][businessOwnerSQL] != PlayerData[playerid][pSQLID])
  316. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't own this business.");
  317.  
  318. if(sscanf(params, "s[30]S()[30]", specifier, type))
  319. {
  320. SendClientMessage(playerid, COLOR_DARKGREEN, "____________________________________________");
  321. Message(playerid, COLOR_ADM, "You have: $%s inside your business.", MoneyFormat(BusinessData[bizid][businessCashbox]));
  322. SendClientMessage(playerid, COLOR_GREY, "Use /bizcashbox [withdraw/deposit] to handle it.");
  323. return 1;
  324. }
  325.  
  326. if(!strcmp(specifier, "withdraw"))
  327. {
  328. new amount;
  329. if(sscanf(type, "i", amount))
  330. return SendClientMessage(playerid, COLOR_DARKGREEN, "USAGE: /bizcashbox withdraw [amount]");
  331.  
  332. if(amount < 1 || amount > BusinessData[bizid][businessCashbox])
  333. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You specified an invalid amount.");
  334.  
  335. WriteLog("business_logs/cashbox_withdraw.txt", "[%s] %s withdrew $%s from the $%s cashbox. [New amount: $%s]", ReturnDateLog(), ReturnName(playerid), MoneyFormat(amount), MoneyFormat(BusinessData[bizid][businessCashbox]), (BusinessData[bizid][businessCashbox]-amount));
  336.  
  337. GiveMoney(playerid, amount);
  338. BusinessData[bizid][businessCashbox]-= amount;
  339.  
  340. Message(playerid, COLOR_DARKGREEN, "You withdrew $%s from your business. (Total: $%s)", MoneyFormat(amount), MoneyFormat(BusinessData[bizid][businessCashbox]));
  341. }
  342. else if(!strcmp(specifier, "deposit"))
  343. {
  344. new amount;
  345. if(sscanf(type, "i", amount))
  346. return SendClientMessage(playerid, COLOR_DARKGREEN, "USAGE: /bizcashbox deposit [amount]");
  347.  
  348. if(amount < 1 || amount > PlayerData[playerid][pMoney])
  349. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You specified an invalid amount.");
  350.  
  351. WriteLog("business_logs/cashbox_deposit.txt", "[%s] %s deposited %s into the %s cashbox. [New cashbox: $%s - New on hand: $%s]",
  352. ReturnDateLog(), ReturnName(playerid), MoneyFormat(amount), MoneyFormat(BusinessData[bizid][businessCashbox]), MoneyFormat((BusinessData[bizid][businessCashbox]+amount)), MoneyFormat((PlayerData[playerid][pMoney]-amount)));
  353.  
  354. GiveMoney(playerid, -amount);
  355. BusinessData[bizid][businessCashbox]+= amount;
  356.  
  357. Message(playerid, COLOR_DARKGREEN, "You deposited $%s into your business. (Total: $%s)", MoneyFormat(amount), MoneyFormat(BusinessData[bizid][businessCashbox]));
  358. }
  359. else return SendClientMessage(playerid, COLOR_ADM, "ERROR: Invalid Parameter.");
  360. return 1;
  361. }
  362.  
  363. CMD:bizfee(playerid, params[])
  364. {
  365. if(!pLoggedIn[playerid])return true;
  366. if(CountPlayerBusinesses(playerid) == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own a business.");
  367. if(!IsPlayerInBusiness(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in your business.");
  368.  
  369. new bizid = IsPlayerInBusiness(playerid), string[128], fee;
  370.  
  371. if(BusinessData[bizid][businessOwnerSQL] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this business.");
  372.  
  373. if(sscanf(params, "d", fee))return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /bizfee [0-50]");
  374. if(fee < 0 || fee > 50)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} Business fee must be between 0 and 50.");
  375.  
  376. BusinessData[bizid][businessFee] = fee;
  377. SaveSQLInt(BusinessData[bizid][businessID], "businesses", "Fee", BusinessData[bizid][businessFee]);
  378.  
  379. format(string, sizeof(string), "Your businesses' fee was set to $%d!", fee);
  380. SendClientMessage(playerid, COLOR_DARKGREEN, string);
  381.  
  382. return true;
  383. }
  384.  
  385. CMD:bizname(playerid, params[])
  386. {
  387. if(!pLoggedIn[playerid])return true;
  388. if(CountPlayerBusinesses(playerid) == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own a business.");
  389. if(!IsPlayerInBusiness(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in your business.");
  390.  
  391. new bizid = IsPlayerInBusiness(playerid), string[128], bName[128];
  392.  
  393. if(BusinessData[bizid][businessOwnerSQL] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this business.");
  394. if(sscanf(params, "s[128]", bName))return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /bizfee [business name]");
  395.  
  396. format(BusinessData[bizid][businessName], 128, "%s", bName);
  397. SaveBusiness(bizid);
  398.  
  399. format(string, sizeof(string), "Your business is now named %s!", bName);
  400. SendClientMessage(playerid, COLOR_DARKGREEN, string);
  401.  
  402. return true;
  403. }
  404.  
  405. CMD:hirelist(playerid, params[])
  406. {
  407. if(!pLoggedIn[playerid])return true;
  408. if(CountPlayerBusinesses(playerid) == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own a business.");
  409. if(!IsPlayerInBusiness(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in your business.");
  410.  
  411. new bizid = IsPlayerInBusiness(playerid);
  412.  
  413. if(BusinessData[bizid][businessOwnerSQL] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this business.");
  414.  
  415. ShowBusinessEmployees(playerid, bizid);
  416. return true;
  417. }
  418.  
  419. CMD:hire(playerid, params[])
  420. {
  421. if(CountPlayerBusinesses(playerid) == 0)
  422. return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own a business.");
  423.  
  424. if(!IsPlayerInBusiness(playerid))
  425. return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in your business.");
  426.  
  427. new
  428. bizid = IsPlayerInBusiness(playerid),
  429. playerb;
  430.  
  431. if(BusinessData[bizid][businessOwnerSQL] != PlayerData[playerid][pSQLID])
  432. return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this business.");
  433.  
  434. if(!isnull(params) && !strcmp(params, "cancel"))
  435. {
  436. if(OfferedHireTo[playerid] == INVALID_PLAYER_ID)
  437. return SendClientMessage(playerid, COLOR_ADM, "SERVER: You haven't made an offer to anyone.");
  438.  
  439. Message(OfferedHireTo[playerid], COLOR_ADM, "SERVER: %s cancelled their offer for you.", ReturnName(playerid));
  440. Message(playerid, COLOR_ADM, "SERVER: You cancelled your offer to %s.", ReturnName(OfferedHireTo[playerid]));
  441.  
  442. OfferedHireBy[OfferedHireTo[playerid]] = INVALID_PLAYER_ID;
  443. OfferedHireTo[playerid] = INVALID_PLAYER_ID;
  444. OfferedHireBusinessID[playerid] = 0;
  445. return 1;
  446. }
  447.  
  448. if(OfferedHireTo[playerid] != INVALID_PLAYER_ID)
  449. return SendClientMessage(playerid, COLOR_ADM, "SERVER: You have a pending offer. Wait for them to accept or cancel.");
  450.  
  451. if(sscanf(params, "u", playerb))
  452. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /hire [playerid/DioImena]");
  453.  
  454. if(!IsPlayerConnected(playerb))
  455. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You specified an invalid player.");
  456.  
  457. if(!GetDistanceBetweenPlayers(playerid, playerb, 5.0))
  458. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't near that player.");
  459.  
  460. if(OfferedHireBy[playerb] != INVALID_PLAYER_ID)
  461. return SendClientMessage(playerid, COLOR_ADM, "SERVER: This player already has an offer.");
  462.  
  463. Message(playerid, COLOR_ADM, "You offered %s to work for %s.", ReturnName(playerb, 0), BusinessData[bizid][businessName]);
  464. SendClientMessage(playerid, COLOR_ADM, "Use /hire cancel to disregard the offer.");
  465.  
  466. Message(playerb, COLOR_ADM, "%s offered you a job at %s. Use /hireaccept YES to work there or /hireaccept NO.", ReturnName(playerid, 0), BusinessData[bizid][businessName]);
  467.  
  468. OfferedHireBusinessID[playerid] = BusinessData[bizid][businessID];
  469.  
  470. OfferedHireBy[playerb] = playerid;
  471. OfferedHireTo[playerid] = playerb;
  472. return 1;
  473. }
  474.  
  475. CMD:hireaccept(playerid, params[])
  476. {
  477. if(OfferedHireBy[playerid] == INVALID_PLAYER_ID)
  478. return SendClientMessage(playerid, COLOR_ADM, "SERVER: Nobody offered you a job.");
  479.  
  480. if(!strcmp(params, "yes", true))
  481. {
  482.  
  483. Message(playerid, COLOR_ADM, "You accepted %s's offer and are now working at their business!", ReturnName(OfferedHireBy[playerid]));
  484. Message(OfferedHireBy[playerid], COLOR_ADM, "%s accepted your job offer.", ReturnName(playerid));
  485.  
  486. PlayerData[playerid][pWorkOn] = OfferedHireBusinessID[OfferedHireBy[playerid]];
  487.  
  488. OfferedHireTo[OfferedHireBy[playerid]] = INVALID_PLAYER_ID;
  489. OfferedHireBusinessID[OfferedHireBy[playerid]] = 0;
  490. OfferedHireBy[playerid] = INVALID_PLAYER_ID;
  491. }
  492. else if(!strcmp(params, "no", true))
  493. {
  494. Message(playerid, COLOR_ADM, "You declined %s's offer.", ReturnName(OfferedHireBy[playerid]));
  495. Message(OfferedHireBy[playerid], COLOR_ADM, "%s declined your job offer.", ReturnName(playerid));
  496.  
  497. OfferedHireTo[OfferedHireBy[playerid]] = INVALID_PLAYER_ID;
  498. OfferedHireBusinessID[OfferedHireBy[playerid]] = 0;
  499. OfferedHireBy[playerid] = INVALID_PLAYER_ID;
  500. }
  501. else return SendClientMessage(playerid, COLOR_ADM, "SERVER: It's either a YES or a NO.");
  502. return 1;
  503. }
  504.  
  505. CMD:quitwork(playerid, params[])
  506. {
  507. if(!PlayerData[playerid][pWorkOn])
  508. return SendClientMessage(playerid, COLOR_ADM, "SERVER: You aren't hired by any business.");
  509.  
  510. Message(playerid, COLOR_ADM, "You quit your job at %s.", BusinessData[PlayerData[playerid][pWorkOn]][businessName]);
  511.  
  512. PlayerData[playerid][pWorkOn] = 0;
  513. SavePlayer(playerid);
  514. return 1;
  515. }
  516.  
  517. CMD:fire(playerid, params[])
  518. {
  519. if(CountPlayerBusinesses(playerid) == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own a business.");
  520. if(!IsPlayerInBusiness(playerid))return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't in your business.");
  521.  
  522. new bizid = IsPlayerInBusiness(playerid),
  523. playerb;
  524.  
  525. if(BusinessData[bizid][businessOwnerSQL] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this business.");
  526.  
  527. if(sscanf(params, "u", playerb))
  528. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /fire [playerid/DioImena]");
  529.  
  530. if(!IsPlayerConnected(playerb))
  531. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You specified an invalid player.");
  532.  
  533. if(!pLoggedIn[playerb])
  534. return SendClientMessage(playerid, COLOR_ADM, "ERROR: That player isn't logged in.");
  535.  
  536. if(PlayerData[playerb][pWorkOn] != BusinessData[bizid][businessID])
  537. return SendClientMessage(playerid, COLOR_ADM, "ERROR: That player isn't one of your workers.");
  538.  
  539. PlayerData[playerb][pWorkOn] = 0;
  540. SavePlayer(playerb);
  541.  
  542. Message(playerb, COLOR_ADM, "%s fired you from their business.", ReturnName(playerid));
  543. Message(playerid, COLOR_ADM, "You fired %s.", ReturnName(playerb));
  544. return 1;
  545. }
  546.  
  547. //Property Commands
  548. CMD:buyhouse(playerid, params[])
  549. {
  550. if(!pLoggedIn[playerid])return true;
  551.  
  552. if(CountPlayerHouses(playerid) == 3)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You own maximum amount of houses.");
  553.  
  554. new string[128], propertyID = 0;
  555.  
  556. for(new i = 0; i < MAX_PROPERTY; i++){
  557. if(PropertyData[i][propertyid] != 0){
  558. if(IsPlayerInRangeOfPoint(playerid, 3.0, PropertyData[i][propertyExterior][0], PropertyData[i][propertyExterior][1], PropertyData[i][propertyExterior][2])){
  559. if(GetPlayerInterior(playerid) == PropertyData[i][propertyExteriorID] && GetPlayerVirtualWorld(playerid) == PropertyData[i][propertyExteriorWorld]){
  560. propertyID = i;
  561. }
  562. }
  563. }
  564. }
  565.  
  566. if(propertyID == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't near any properties.");
  567. if(PropertyData[propertyID][propertyOwnerSQL] != 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You can't buy property that's already owned.");
  568. if(PlayerData[playerid][pMoney] < PropertyData[propertyID][propertyMarketPrice]){
  569. format(string, sizeof(string), "Insufficient amount. This house cost $%s. Please arrange a sufficient payment.", MoneyFormat(PropertyData[propertyID][propertyMarketPrice]));
  570. SendClientMessage(playerid, COLOR_ADM, string);
  571. return true;
  572. }
  573. if(PlayerData[playerid][pLevel] < PropertyData[propertyID][propertyLevel])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't the level required for this property.");
  574.  
  575. GiveMoney(playerid, -PropertyData[propertyID][propertyMarketPrice]);
  576.  
  577. PropertyData[propertyID][propertyOwnerSQL] = PlayerData[playerid][pSQLID];
  578.  
  579. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  580. GameTextForPlayer(playerid, "Congratulations!~n~You're now the owner of this property!", 4000, 5);
  581.  
  582. DestroyDynamic3DTextLabel(PropertyData[propertyID][ForSaleSign]);
  583.  
  584. SaveSQLInt(PropertyData[propertyID][propertyid], "properties", "OwnerSQL", PropertyData[propertyID][propertyOwnerSQL]);
  585.  
  586. WriteLog("property_logs/buyproperty_log.txt", "[%s] %s bought Property ID %i for $%s", ReturnDate(), ReturnName(playerid), propertyID, MoneyFormat(PropertyData[propertyID][propertyMarketPrice]));
  587. return true;
  588. }
  589.  
  590. CMD:sellhouse(playerid, params[])
  591. {
  592. if(!pLoggedIn[playerid])return true;
  593.  
  594. if(CountPlayerHouses(playerid) == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own a house.");
  595.  
  596. new string[128], confirm[60];
  597.  
  598. if(sscanf(params, "s[60]", confirm))return SendClientMessage(playerid, COLOR_ADM, "SERVER:{FFFFFF} You're about to sell your house. Type /sellhouse confirm to confirm. ");
  599.  
  600. if(strmatch(confirm, "confirm")){
  601.  
  602. for(new i = 0; i < MAX_PROPERTY; i++){
  603.  
  604. if(PropertyData[i][propertyid] != 0){
  605. if(IsPlayerInRangeOfPoint(playerid, 4.0, PropertyData[i][propertyExterior][0], PropertyData[i][propertyExterior][1], PropertyData[i][propertyExterior][2]))
  606. {
  607. if(PropertyData[i][propertyOwnerSQL] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this house.");
  608.  
  609. PropertyData[i][propertyOwnerSQL] = 0;
  610. SaveSQLInt(PropertyData[i][propertyid], "properties", "OwnerSQL", 0);
  611.  
  612. DestroyDynamic3DTextLabel(PropertyData[i][ForSaleSign]);
  613.  
  614. if(PropertyData[i][propertyType] == 1){
  615. format(string, sizeof(string), "Complex[%d] For Sale:\nPrice: $%d\nLevel: %d", i, PropertyData[i][propertyMarketPrice], PropertyData[i][propertyLevel]);
  616. PropertyData[i][ForSaleSign] = CreateDynamic3DTextLabel(string, COLOR_TEXTDRAW, PropertyData[i][propertyExterior][0], PropertyData[i][propertyExterior][1], PropertyData[i][propertyExterior][2], 15.0);
  617. }
  618. else if(PropertyData[i][propertyType] == 2){
  619. format(string, sizeof(string), "Apartment[%d] For Sale:\nPrice: $%d\nLevel: %d", i, PropertyData[i][propertyMarketPrice], PropertyData[i][propertyLevel]);
  620. PropertyData[i][ForSaleSign] = CreateDynamic3DTextLabel(string, COLOR_YELLOW, PropertyData[i][propertyExterior][0], PropertyData[i][propertyExterior][1], PropertyData[i][propertyExterior][2], 20.0, .worldid = PropertyData[i][propertyExteriorWorld]);
  621. }
  622. else if(PropertyData[i][propertyType] == 3){
  623. format(string, sizeof(string), "House[%d] For Sale:\nPrice: $%d\nLevel: %d", i, PropertyData[i][propertyMarketPrice], PropertyData[i][propertyLevel]);
  624. PropertyData[i][ForSaleSign] = CreateDynamic3DTextLabel(string, COLOR_YELLOW, PropertyData[i][propertyExterior][0], PropertyData[i][propertyExterior][1], PropertyData[i][propertyExterior][2], 15.0);
  625. }
  626.  
  627. PlayerData[playerid][pSpawnSelect] = 0;
  628.  
  629. GameTextForPlayer(playerid, "You sold your property!", 3000, 5);
  630. format(string, sizeof(string), "SERVER:You sold your house. You were paid $%s of the market price.", MoneyFormat(PropertyData[i][propertyMarketPrice] / 2));
  631. SendClientMessage(playerid, COLOR_ADM, string);
  632.  
  633. GiveMoney(playerid, PropertyData[i][propertyMarketPrice] / 2);
  634.  
  635. WriteLog("property_logs/sellproperty_log.txt", "[%s] %s sold Property ID %i for $%s", ReturnDate(), ReturnName(playerid), i, MoneyFormat(PropertyData[i][propertyMarketPrice] / 2));
  636. SavePlayer(playerid);
  637. return true;
  638. }
  639. }
  640. }
  641. }
  642. SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't near a house.");
  643. return true;
  644. }
  645.  
  646. CMD:home(playerid, params[])
  647. {
  648. if(!pLoggedIn[playerid])return true;
  649.  
  650. if(CountPlayerHouses(playerid) == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own any houses.");
  651.  
  652. for(new i = 0; i < MAX_PROPERTY; i++)
  653. {
  654. if(PropertyData[i][propertyid] != 0){
  655. if(PropertyData[i][propertyOwnerSQL] == PlayerData[playerid][pSQLID]){
  656.  
  657. SetPlayerCheckpoint(playerid, PropertyData[i][propertyExterior][0], PropertyData[i][propertyExterior][1], PropertyData[i][propertyExterior][2], 3.0);
  658. GameTextForPlayer(playerid, "~r~Waypoint ~y~set to your home!", 4000, 4);
  659. }
  660. }
  661. }
  662.  
  663. return true;
  664. }
  665.  
  666. CMD:cmdspot(playerid, params[])
  667. {
  668. if(!pLoggedIn[playerid])return true;
  669.  
  670. new hid = IsPlayerInProperty(playerid);
  671.  
  672. if(hid == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You can't do this right now.");
  673. if (PropertyData[hid][propertyOwnerSQL] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this house.");
  674.  
  675. GetPlayerPos(playerid, Resources[playerid][CmdSpot][0], Resources[playerid][CmdSpot][1], Resources[playerid][CmdSpot][2]);
  676.  
  677. PropertyData[hid][propertyCheckPos][0] = Resources[playerid][CmdSpot][0];
  678. PropertyData[hid][propertyCheckPos][1] = Resources[playerid][CmdSpot][1];
  679. PropertyData[hid][propertyCheckPos][2] = Resources[playerid][CmdSpot][2];
  680.  
  681. SaveSQLFloat(PropertyData[hid][propertyid], "properties", "CheckPosX", Resources[playerid][CmdSpot][0]);
  682. SaveSQLFloat(PropertyData[hid][propertyid], "properties", "CheckPosY", Resources[playerid][CmdSpot][1]);
  683. SaveSQLFloat(PropertyData[hid][propertyid], "properties", "CheckPosZ", Resources[playerid][CmdSpot][2]);
  684.  
  685. SendClientMessage(playerid, COLOR_WHITE, "You've set a new spot to perform certain commands at.");
  686. SendClientMessage(playerid, COLOR_WHITE, "/takegun, /place");
  687.  
  688. return true;
  689. }
  690.  
  691. CMD:check(playerid, params[])
  692. {
  693. if(!pLoggedIn[playerid]) return true;
  694.  
  695. new string[2000], hid = IsPlayerInProperty(playerid);
  696.  
  697. string[0] = 0;
  698.  
  699. if(IsPlayerInAnyVehicle(playerid))
  700. {
  701. new vehicleid = GetPlayerVehicleID(playerid);
  702.  
  703. if(!IsValidFactionCar(vehicleid) && !IsValidPlayerCar(vehicleid))
  704. return SendClientMessage(playerid, COLOR_ADM, "SERVER: This command can only be used for private vehicles. You are in a public static vehicle.");
  705.  
  706. if(IsValidPlayerCar(vehicleid))
  707. {
  708. for(new i = 1; i < 8; i++)
  709. {
  710. if(!CarData[vehicleid][carWeapons][i])
  711. format(string, sizeof(string), "%s%d. [Empty]\n", string, i);
  712.  
  713. else
  714. format(string, sizeof(string), "%s%d. %s[Ammo: %d]\n", string, i, ReturnWeaponName(CarData[vehicleid][carWeapons][i]), CarData[vehicleid][carWeaponsAmmo][i]);
  715.  
  716. ShowPlayerDialog(playerid, DIALOG_USE, DIALOG_STYLE_LIST, "Trunk", string, ">>>", "");
  717. }
  718. }
  719. else if(IsValidFactionCar(vehicleid))
  720. {
  721. if(FactionCar[vehicleid][carFaction] > 0 && FactionCar[vehicleid][carFaction] == PlayerData[playerid][pFaction] && FactionCar[vehicleid][carGunRack])
  722. {
  723. ShowPlayerDialog(playerid, DIALOG_USE, DIALOG_STYLE_LIST, "Trunk", "1. Shotgun[Ammo: 100]\n2. MP5[Ammo:200]\n3. M4[Ammo:200]\n4. SPAZ[Ammo:100]\n5. Sniper[Ammo:50]\n6. Camera\n7. Pepperspray", "Ok", "");
  724. }
  725. }
  726. }
  727.  
  728. if(hid && IsPlayerInRangeOfPoint(playerid, 3.0, PropertyData[hid][propertyCheckPos][0], PropertyData[hid][propertyCheckPos][1], PropertyData[hid][propertyCheckPos][2])){
  729.  
  730. for(new i = 0; i < 21; i ++)
  731. {
  732. if(!PropertyData[hid][propertyWeapons][i])
  733. format(string, sizeof(string), "%s%d. [Empty]\n", string, i);
  734.  
  735. else
  736. format(string, sizeof(string), "%s%d. %s[Ammo:%d]\n", string, i, ReturnWeaponName(PropertyData[hid][propertyWeapons][i]), PropertyData[hid][propertyAmmo][i]);
  737. }
  738.  
  739. ShowPlayerDialog(playerid, DIALOG_USE, DIALOG_STYLE_LIST, "House Weapon Storage(Capacity of 20)", string, ">>>", "");
  740. }
  741. return true;
  742. }
  743.  
  744. CMD:propdrugs(playerid, params[])
  745. {
  746. new
  747. id;
  748.  
  749. if( (id = IsPlayerInProperty(playerid)) != 0)
  750. {
  751. if(IsPlayerInRangeOfPoint(playerid, 3.0, PropertyData[id][propertyCheckPos][0], PropertyData[id][propertyCheckPos][1], PropertyData[id][propertyCheckPos][2]) && isnull(params))
  752. {
  753. new primary_str[800], define_str[128];
  754.  
  755. strcat(primary_str, "Slot\tDrug\tQuantity\n");
  756.  
  757. for(new i = 1; i < MAX_PROPERTY_DRUGS; i++)
  758. {
  759. if(PropertyData[id][propertydrugQuantity][i])
  760. format(define_str, 128, "%i.\t%s\t%i\n", i, ReturnDrugsName(PropertyData[id][propertydrugType][i]), PropertyData[id][propertydrugQuantity][i]); //format(define_str, sizeof(define_str), "[ %i. %s (%d) ]\n", i, ReturnDrugsName(PropertyData[id][propertydrugType][i]), PropertyData[id][propertydrugQuantity][i]);
  761.  
  762. else format(define_str, 128, "%i.\tEmpty\n", i);//format(define_str, sizeof(define_str), "[ %i. Empty ]\n", i);
  763. strcat(primary_str, define_str);
  764. }
  765. ShowPlayerDialog(playerid, DIALOG_USE, DIALOG_STYLE_TABLIST_HEADERS, "Property drugs", primary_str, "<<", ">>");
  766. }
  767. else
  768. {
  769. if(isnull(params))
  770. SendClientMessage(playerid, COLOR_ADM, "USAGE: You aren't at your safe position.");
  771. }
  772.  
  773. new specifier[30], task[30];
  774. new queries[290];
  775.  
  776. if(sscanf(params, "s[30]S()[30]", specifier, task))
  777. {
  778. SendClientMessage(playerid, COLOR_ADM, "USAGE: /propdrugs [put - remove] [slot_id]");
  779. SendClientMessage(playerid, COLOR_ADM, "TIP:{FFFFFF} View your houses drugs by leaving the paramater blank.");
  780. return 1;
  781. }
  782.  
  783. if(!strcmp(specifier, "put", true))
  784. {
  785. new my_slot, my_quantity;
  786. new property_slot = -1;
  787.  
  788. if(sscanf(task, "ii", my_slot, my_quantity))
  789. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /propdrugs put [slot_id] [quantity]");
  790.  
  791. if(my_slot < 1 || my_slot > MAX_PLAYER_DRUGS)
  792. return SendClientMessage(playerid, COLOR_GREY, "You specified an invalid slot.");
  793.  
  794. if(!DrugData[playerid][drugQuanity][my_slot])
  795. return SendClientMessage(playerid, COLOR_GREY, "There's nothing in that drug slot.");
  796.  
  797. if(my_quantity < 1 || my_quantity > DrugData[playerid][drugQuanity][my_slot])
  798. return SendClientMessage(playerid, COLOR_GREY, "You specified a bad amount.");
  799.  
  800. for(new i = 1; i < MAX_PROPERTY_DRUGS; i++) if(!PropertyData[id][propertydrugQuantity][i])
  801. {
  802. property_slot = i;
  803. break;
  804. }
  805. if(property_slot == -1)
  806. return SendClientMessage(playerid, COLOR_GREY, "There's no room left in your house.");
  807.  
  808. PropertyData[id][propertydrugType][property_slot] = DrugData[playerid][drugType][my_slot];
  809. PropertyData[id][propertydrugQuantity][property_slot] = my_quantity;
  810.  
  811. mysql_format(m_Handle, queries, sizeof(queries), "INSERT INTO property_drugs (property_id, slot_id, drug_quantity, drug_type) VALUES(%i, %i, %i, %i)", PropertyData[id][propertyid], property_slot, my_quantity, DrugData[playerid][drugType][my_slot]);
  812. mysql_tquery(m_Handle, queries, "OnHouseDrugInsert", "iiii", playerid, id, DrugData[playerid][drugQuanity][my_slot], DrugData[playerid][drugType][my_slot]);
  813.  
  814. DrugData[playerid][drugQuanity][my_slot]-= my_quantity;
  815. if(DrugData[playerid][drugQuanity][my_slot] < 1)
  816. {
  817. DrugData[playerid][drugType][my_slot] = 0;
  818. }
  819.  
  820. new string[128];
  821. format(string, sizeof(string), "* %s puts something in the house.", ReturnName(playerid, 0));
  822. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 10.0, 3000);
  823.  
  824. Message(playerid, COLOR_ADM, "You put {FFFFFF}%i{FF6347} grams of {FFFFFF}%s{FF6347} in the house.", my_quantity, ReturnDrugsName(PropertyData[id][propertydrugType][property_slot]));
  825. return 1;
  826. }
  827. else if(!strcmp(specifier, "remove", true))
  828. {
  829. new property_slot;
  830. new my_slot = ReturnDrugSlot(playerid);
  831.  
  832. if(sscanf(task, "i", property_slot))
  833. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /propdrugs remove [slot_id]");
  834.  
  835. if(property_slot < 1 || property_slot >= MAX_PROPERTY_DRUGS)
  836. return SendClientMessage(playerid, COLOR_GREY, "You specified an invalid slot.");
  837.  
  838. if(my_slot == -1)
  839. return SendClientMessage(playerid, COLOR_ADM, "You can't hold anymore drugs.");
  840.  
  841. DrugData[playerid][drugQuanity][my_slot] = PropertyData[id][propertydrugQuantity][property_slot];
  842. DrugData[playerid][drugType][my_slot] = PropertyData[id][propertydrugType][property_slot];
  843.  
  844. new string[128];
  845. format(string, sizeof(string), "* %s takes something from the house.", ReturnName(playerid, 0));
  846. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 10.0, 3000);
  847.  
  848. Message(playerid, COLOR_ADM, "You took {FFFFFF}%i{FF6347} grams of {FFFFFF}%s{FF6347} from the house.", PropertyData[id][propertydrugQuantity][property_slot], ReturnDrugsName(PropertyData[id][propertydrugType][property_slot]));
  849.  
  850. mysql_format(m_Handle, queries, sizeof(queries), "DELETE FROM property_drugs WHERE property_id = %i AND slot_id = %i", PropertyData[id][propertyid], property_slot);
  851. mysql_tquery(m_Handle, queries, "OnHouseDrugRemove", "iiii", playerid, id, PropertyData[id][propertydrugQuantity][property_slot], PropertyData[id][propertydrugType][property_slot]);
  852.  
  853. PropertyData[id][propertydrugQuantity][property_slot] = 0;
  854. PropertyData[id][propertydrugType][property_slot] = 0;
  855. return 1;
  856. }
  857. else SendClientMessage(playerid, COLOR_ADM, "SERVER: Invalid Paramater.");
  858. }
  859. else SendClientMessage(playerid, COLOR_ADM, "You aren't inside a house.");
  860. return 1;
  861. }
  862.  
  863. CMD:place(playerid, params[])
  864. {
  865. new
  866. string[128],
  867. id,
  868. slot_id,
  869. weapon_id,
  870. ammo
  871. ;
  872.  
  873. if((id = IsPlayerInProperty(playerid)) != 0)
  874. {
  875. if(!IsPlayerInRangeOfPoint(playerid, 4.0, PropertyData[id][propertyCheckPos][0], PropertyData[id][propertyCheckPos][1], PropertyData[id][propertyCheckPos][2]))
  876. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't near the command spot.");
  877.  
  878. if(GetPlayerWeapon(playerid) == 0)
  879. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't holding your weapon.");
  880.  
  881. weapon_id = ReturnWeapon(playerid);
  882.  
  883. if(weapon_id == -1)
  884. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You aren't holding a weapon.");
  885.  
  886. ammo = ReturnWeaponAmmo(playerid, weapon_id);
  887. slot_id = House_ReturnWeaponSlot(id);
  888.  
  889. PropertyData[id][propertyWeapons][slot_id] = weapon_id;
  890. PropertyData[id][propertyAmmo][slot_id] = ammo;
  891.  
  892. TakePlayerWeapon(playerid, weapon_id);
  893. SaveProperty(id);
  894.  
  895. format(string, sizeof(string), "* %s stores a %s in the house.", ReturnName(playerid, 0), ReturnWeaponName(weapon_id));
  896. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  897. SendClientMessage(playerid, COLOR_EMOTE, string);
  898.  
  899. WriteLog("weapon_logs/property_place.txt", "[%s] %s (DBID: %i) placed %s (Ammo: %i) in Property %i", ReturnDate(), ReturnName(playerid), PlayerData[playerid][pSQLID], ReturnWeaponName(weapon_id), ammo, id);
  900. return 1;
  901. }
  902.  
  903. if(IsPlayerInAnyVehicle(playerid))
  904. {
  905. id = GetPlayerVehicleID(playerid);
  906.  
  907. if(!IsValidFactionCar(id) && !IsValidPlayerCar(id))
  908. return SendClientMessage(playerid, COLOR_ADM, "SERVER: This command can only be used for private vehicles. You are in a public static vehicle.");
  909.  
  910. if(IsValidPlayerCar(id))
  911. {
  912. if(sscanf(params, "i", weapon_id))
  913. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /place [weapon id]");
  914.  
  915. if(!PlayerHasWeapon(playerid, weapon_id))
  916. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have that weapon.");
  917.  
  918. slot_id = Car_ReturnWeaponSlot(id);
  919.  
  920. if(slot_id == -1)
  921. return SendClientMessage(playerid, COLOR_ADM, "ERROR: This vehicle is at full capacity.");
  922.  
  923. ammo = ReturnWeaponAmmo(playerid, weapon_id);
  924.  
  925. if(SlotBeingUsed[id][slot_id])
  926. return SendClientMessage(playerid, COLOR_ADM, "You can't place your weapon there right now.");
  927.  
  928. PlayerPlacingWeapon[playerid] = 1;
  929. PlayerPlacingWeaponSlot[playerid] = slot_id;
  930.  
  931. PlayerPlacingWeaponID[playerid] = weapon_id;
  932. PlayerPlacingWeaponAmmo[playerid] = ammo;
  933.  
  934. SlotBeingUsed[id][slot_id] = 1;
  935. PlayerPlacingInVehicle[playerid] = id;
  936.  
  937. new
  938. Float:x[3];
  939. GetPlayerPos(playerid, x[0], x[1], x[2]);
  940.  
  941. CarData[id][carWeaponObject][slot_id] = CreateDynamicObject(ReturnWeaponsModel(weapon_id), x[0], x[1], x[2], 80.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  942. EditDynamicObject(playerid, CarData[id][carWeaponObject][slot_id]);
  943.  
  944. SendClientMessage(playerid, COLOR_ADM, "INFO: Hold {FFFFFF}W{FF6347} or {FFFFFF}SPACE{FF6347} to move your camera.");
  945. Message(playerid, COLOR_YELLOW, "You're storing a %s with %i Ammo.", ReturnWeaponName(weapon_id), ammo);
  946.  
  947. RemovePlayerWeapon(playerid, weapon_id);
  948.  
  949. /*CarData[id][carWeapons][slot_id] = weapon_id;
  950. CarData[id][carWeaponsAmmo][slot_id] = ammo;
  951.  
  952. TakePlayerWeapon(playerid, weapon_id);
  953. SaveCar(id);
  954.  
  955. format(string, sizeof(string), "* %s stores a %s in the %s.", ReturnName(playerid, 0), ReturnWeaponName(weapon_id), ReturnVehicleName(id));
  956. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 20.0, 2000);
  957.  
  958. format(string, sizeof(string), "[!] You have stored a %s in the %s.", ReturnWeaponName(weapon_id), ReturnVehicleName(id));
  959. SendClientMessage(playerid, COLOR_YELLOW, string);
  960.  
  961. format(string, sizeof(string), "%s put a %s[%d] (slot %d)", ReturnName(playerid), ReturnWeaponName(weapon_id), ammo, slot_id);
  962. LogVehicleAction(id, string);
  963.  
  964. WriteLog("weapon_logs/vehicle_place.txt", "[%s] %s (DBID: %i) placed %s (Ammo: %i) in Vehicle DBID %i", ReturnDate(), ReturnName(playerid), PlayerData[playerid][pSQLID], ReturnWeaponName(weapon_id), ammo, CarData[id][carID]);*/
  965. return 1;
  966. }
  967.  
  968. if(IsValidFactionCar(id) && FactionData[FactionCar[id][carFaction]][factionCopPerms])
  969. {
  970. if(sscanf(params, "i", weapon_id))
  971. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /place [weapon id]");
  972.  
  973. if(weapon_id != 25 && weapon_id != 29 && weapon_id != 27 && weapon_id != 31 && weapon_id != 34 && weapon_id != 41 && weapon_id != 43)
  974. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You can't put that in this car.");
  975.  
  976. switch(weapon_id)
  977. {
  978. case 25:
  979. {
  980. if(!PlayerHasWeapon(playerid, 25) && !IsSaveableWeapon(playerid, 25))
  981. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  982.  
  983. TakePlayerWeapon(playerid, 25);
  984.  
  985. format(string, sizeof(string), "* %s places their Shotgun in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  986. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  987. SendClientMessage(playerid, COLOR_EMOTE, string);
  988. }
  989. case 29:
  990. {
  991. if(!PlayerHasWeapon(playerid, 29) && !IsSaveableWeapon(playerid, 29))
  992. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  993.  
  994. TakePlayerWeapon(playerid, 29);
  995.  
  996. format(string, sizeof(string), "* %s places their MP5 in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  997. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  998. SendClientMessage(playerid, COLOR_EMOTE, string);
  999. }
  1000. case 31:
  1001. {
  1002. if(!PlayerHasWeapon(playerid, 31) && !IsSaveableWeapon(playerid, 31))
  1003. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  1004.  
  1005. TakePlayerWeapon(playerid, 31);
  1006.  
  1007. format(string, sizeof(string), "* %s places their M4 in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  1008. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  1009. SendClientMessage(playerid, COLOR_EMOTE, string);
  1010. }
  1011. case 34:
  1012. {
  1013. if(!PlayerHasWeapon(playerid, 34) && !IsSaveableWeapon(playerid, 34))
  1014. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  1015.  
  1016. TakePlayerWeapon(playerid, 34);
  1017.  
  1018. format(string, sizeof(string), "* %s places their Sniper Rifle in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  1019. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  1020. SendClientMessage(playerid, COLOR_EMOTE, string);
  1021. }
  1022. case 41:
  1023. {
  1024. if(!PlayerHasWeapon(playerid, 41) && !IsSaveableWeapon(playerid, 41))
  1025. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  1026.  
  1027. TakePlayerWeapon(playerid, 41);
  1028.  
  1029. format(string, sizeof(string), "* %s places their Spray Can in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  1030. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  1031. SendClientMessage(playerid, COLOR_EMOTE, string);
  1032. }
  1033. case 43:
  1034. {
  1035. if(!PlayerHasWeapon(playerid, 45) && !IsSaveableWeapon(playerid, 45))
  1036. return SendClientMessage(playerid, COLOR_ADM, "ERROR: You don't have this weapon.");
  1037.  
  1038. TakePlayerWeapon(playerid, 45);
  1039.  
  1040. format(string, sizeof(string), "* %s places their Camera in the %s.", ReturnName(playerid, 0), ReturnVehicleName(id));
  1041. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  1042. SendClientMessage(playerid, COLOR_EMOTE, string);
  1043. }
  1044. }
  1045. return 1;
  1046. }
  1047. }
  1048. SendClientMessage(playerid, COLOR_ADM, "SERVER: You can't place your weapon anywhere.");
  1049. return 1;
  1050. }
  1051.  
  1052. CMD:takegun(playerid, params[])
  1053. {
  1054. if(!pLoggedIn[playerid])return true;
  1055.  
  1056. new string[128], hid = IsPlayerInProperty(playerid), slotid;
  1057. new WEAPON_INDEX;
  1058.  
  1059. if(IsPlayerInRangeOfPoint(playerid, 3.0, PropertyData[hid][propertyCheckPos][0], PropertyData[hid][propertyCheckPos][1], PropertyData[hid][propertyCheckPos][2]))
  1060. {
  1061. if(sscanf(params, "d", slotid))return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /takegun slot_id");
  1062.  
  1063. if(!PropertyData[hid][propertyWeapons][slotid])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} There's nothing in that slot.");
  1064. if(Weapon[playerid][WEAPON_INDEX][eWeaponID] > 25) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You can only equip one primary weapon at a time.");
  1065. if(slotid < 0 || slotid > 20)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} That slot doesn't exist.");
  1066.  
  1067. GivePlayerGun(playerid, PropertyData[hid][propertyWeapons][slotid], PropertyData[hid][propertyAmmo][slotid], WEAPON_UNKNOWN_GIVEN);
  1068.  
  1069. format(string, sizeof(string), "* %s takes a %s from the house.", ReturnName(playerid, 0), ReturnWeaponName(PropertyData[hid][propertyWeapons][slotid]));
  1070. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  1071. SendClientMessage(playerid, COLOR_EMOTE, string);
  1072.  
  1073. WriteLog("weapon_logs/property_take.txt", "[%s] %s took %s (Ammo: %d) from Property DBID %d", ReturnDate(), ReturnName(playerid, 1), ReturnWeaponName(PropertyData[hid][propertyWeapons][slotid]),
  1074. PropertyData[hid][propertyAmmo][slotid], hid);
  1075.  
  1076. PropertyData[hid][propertyWeapons][slotid] = 0;
  1077. PropertyData[hid][propertyAmmo][slotid] = 0;
  1078.  
  1079. SaveProperty(hid);
  1080. return true;
  1081. }
  1082. if(IsPlayerInAnyVehicle(playerid)) {
  1083.  
  1084. new vehicleid = GetPlayerVehicleID(playerid), w_slot_id;
  1085.  
  1086. if(!IsValidFactionCar(vehicleid) && !IsValidPlayerCar(vehicleid))
  1087. return SendClientMessage(playerid, COLOR_ADM, "SERVER: This command can only be used for private vehicles. You are in a public static vehicle.");
  1088.  
  1089. if ( IsValidPlayerCar(vehicleid) ) {
  1090. if(sscanf(params, "d", w_slot_id)) return SendClientMessage(playerid, COLOR_ADM, "USAGE: /takegun slot_id");
  1091. if ( w_slot_id < 1 || w_slot_id > 4 ) return SendClientMessage(playerid, COLOR_ADM, "ERROR: That slot doesn't exist.");
  1092. if ( !CarData[vehicleid][carWeapons][w_slot_id] ) return SendClientMessage(playerid, COLOR_ADM, "ERROR: There's nothing in that slot.");
  1093.  
  1094. GivePlayerGun(playerid, CarData[vehicleid][carWeapons][w_slot_id], CarData[vehicleid][carWeaponsAmmo][w_slot_id], WEAPON_UNKNOWN_GIVEN);
  1095. SetPlayerArmedWeapon(playerid,0);
  1096.  
  1097. format(string, sizeof(string), "* %s takes a %s from the %s.", ReturnName(playerid, 0), ReturnWeaponName(CarData[vehicleid][carWeapons][w_slot_id]), ReturnVehicleName(vehicleid));
  1098. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  1099. SendClientMessage(playerid, COLOR_EMOTE, string);
  1100.  
  1101. WriteLog("weapon_logs/vehicle_take.txt", "[%s] %s took %s (Ammo: %d) from %s (Vehicle DBID %d)", ReturnDate(), ReturnName(playerid, 1), ReturnWeaponName(CarData[vehicleid][carWeapons][w_slot_id]),
  1102. CarData[vehicleid][carWeaponsAmmo][w_slot_id], ReturnVehicleName(vehicleid), CarData[vehicleid][carID]);
  1103.  
  1104. format(string, sizeof(string), "%s took a %s[%d] (slot %d)", ReturnName(playerid), ReturnWeaponName(CarData[vehicleid][carWeapons][w_slot_id]), CarData[vehicleid][carWeaponsAmmo][w_slot_id], w_slot_id);
  1105. LogVehicleAction(vehicleid, string);
  1106.  
  1107. if(IsValidDynamicObject(CarData[vehicleid][carWeaponObject][w_slot_id]))
  1108. DestroyDynamicObject(CarData[vehicleid][carWeaponObject][w_slot_id]);
  1109.  
  1110. CarData[vehicleid][carWeapons][w_slot_id] = 0;
  1111. CarData[vehicleid][carWeaponsAmmo][w_slot_id] = 0;
  1112.  
  1113. SaveCar(vehicleid);
  1114. return true;
  1115. }
  1116. else if( IsValidFactionCar(vehicleid) ) {
  1117. if(FactionCar[vehicleid][carFaction] != PlayerData[playerid][pFaction])
  1118. return SendClientMessage(playerid, COLOR_ADM, "PRISTUP ODBIJEN:{FFFFFF} You don't have the keys to this vehicle.");
  1119.  
  1120. if(FactionCar[vehicleid][carGunRack]) {
  1121.  
  1122. if(sscanf(params, "d", w_slot_id)) return SendClientMessage(playerid, COLOR_WHITE, "/takegun slot_id (ID List in /check.)");
  1123. if ( w_slot_id < 0 || w_slot_id > 7 ) return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} That slot ID does not exist.");
  1124.  
  1125. switch ( w_slot_id ) {
  1126. case 1: {
  1127. GivePlayerGun(playerid, 25, 100, WEAPON_SERVER_GIVEN);
  1128.  
  1129. format(string, sizeof(string), "* %s takes a Shotgun from the %s.", ReturnName(playerid, 0), ReturnVehicleName(vehicleid));
  1130. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  1131. SendClientMessage(playerid, COLOR_EMOTE, string);
  1132. }
  1133. case 2: {
  1134. GivePlayerGun(playerid, 29, 200, WEAPON_SERVER_GIVEN);
  1135.  
  1136. format(string, sizeof(string), "* %s takes a MP5 from the %s.", ReturnName(playerid, 0), ReturnVehicleName(vehicleid));
  1137. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  1138. SendClientMessage(playerid, COLOR_EMOTE, string);
  1139. }
  1140. case 3: {
  1141. GivePlayerGun(playerid, 31, 200, WEAPON_SERVER_GIVEN);
  1142.  
  1143. format(string, sizeof(string), "* %s takes a M4 from the %s.", ReturnName(playerid, 0), ReturnVehicleName(vehicleid));
  1144. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  1145. SendClientMessage(playerid, COLOR_EMOTE, string);
  1146. }
  1147. case 4: { return SendClientMessage(playerid, COLOR_ADM, "SERVER: This is not available right now. "); }
  1148. case 5: {
  1149. GivePlayerGun(playerid, 34, 200, WEAPON_SERVER_GIVEN);
  1150.  
  1151. format(string, sizeof(string), "* %s takes a Sniper Rifle from the %s.", ReturnName(playerid, 0), ReturnVehicleName(vehicleid));
  1152. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  1153. SendClientMessage(playerid, COLOR_EMOTE, string);
  1154. }
  1155. case 6: {
  1156. GivePlayerGun(playerid, 43, 100, WEAPON_SERVER_GIVEN);
  1157.  
  1158. format(string, sizeof(string), "* %s takes a Camera from the %s.", ReturnName(playerid, 0), ReturnVehicleName(vehicleid));
  1159. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  1160. SendClientMessage(playerid, COLOR_EMOTE, string);
  1161. }
  1162. case 7: {
  1163. GivePlayerGun(playerid, 41, 200, WEAPON_SERVER_GIVEN);
  1164.  
  1165. format(string, sizeof(string), "* %s takes a Spray Can from the %s.", ReturnName(playerid, 0), ReturnVehicleName(vehicleid));
  1166. SetPlayerChatBubble(playerid, string, COLOR_EMOTE, 25.0, 3000);
  1167. SendClientMessage(playerid, COLOR_EMOTE, string);
  1168. }
  1169. }
  1170.  
  1171. return true;
  1172. }
  1173. else {
  1174. SendClientMessage(playerid, COLOR_ADM, "SERVER: Unavailable Feature.");
  1175. return true;
  1176. }
  1177. }
  1178. }
  1179. SendClientMessage(playerid, COLOR_ADM, "SERVER: You can't do this right now.");
  1180. return true;
  1181. }
  1182.  
  1183. CMD:myhouse(playerid, params[])
  1184. {
  1185. if( CountPlayerHouses(playerid) == 0 )
  1186. return SendClientMessage(playerid, COLOR_ADM, "You don't own a house.");
  1187.  
  1188. new prim_str[30], sub_str[30], thr_str[30];
  1189. new id;
  1190.  
  1191. if( !IsPlayerInProperty(playerid) )
  1192. return SendClientMessage(playerid, COLOR_ADM, "You aren't inside a house.");
  1193.  
  1194. id = IsPlayerInProperty(playerid);
  1195.  
  1196. if( PropertyData[id][propertyOwnerSQL] != PlayerData[playerid][pSQLID] )
  1197. return SendClientMessage(playerid, COLOR_ADM, "You don't own this house.");
  1198.  
  1199. if( sscanf(params, "s[30]S()[30]S()[30]", prim_str, sub_str, thr_str) )
  1200. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /myhouse [info, cashbox]");
  1201.  
  1202. if(!strcmp(prim_str, "info", true))
  1203. {
  1204. new garage_id;
  1205. for(new i; i < MAX_PROPERTY_GARAGES; i++)
  1206. {
  1207. if(GarageData[i][garagePropertyID] == id)
  1208. garage_id = i;
  1209. }
  1210.  
  1211. Message(playerid, COLOR_GREY, "Your House ID is: %i", id);
  1212. Message(playerid, COLOR_GREY, "Garage ID:[%s] Market price:[$%s] Level:[%i]", (garage_id != 0) ? (MoneyFormat(garage_id)) : ("None"), MoneyFormat(PropertyData[id][propertyMarketPrice]), PropertyData[id][propertyLevel]);
  1213. }
  1214. else if(!strcmp(prim_str, "cashbox", true))
  1215. {
  1216. new ink[32], quantity;
  1217.  
  1218. if(sscanf(sub_str, "s[32]", ink))
  1219. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /myhouse cashbox [ take, put, info ]");
  1220.  
  1221. if(!strcmp(ink, "take", true))
  1222. {
  1223. if(sscanf(thr_str, "i", quantity))
  1224. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /myhouse cashbox take [quantity]");
  1225.  
  1226. if( quantity < 1 || quantity > PropertyData[id][propertyMoney] )
  1227. return SendClientMessage(playerid, COLOR_ADM, "You specified an invalid amount.");
  1228.  
  1229. WriteLog("property_logs/cashboxtake_log.txt", "[%s] %s took $%s from Property %i's Cashbox. [Previous cashbox: $%i - Onhand now: $%i]", ReturnDateLog(), ReturnName(playerid), MoneyFormat(quantity), PropertyData[id][propertyid], (PropertyData[id][propertyMoney]-quantity), (PlayerData[playerid][pMoney]+quantity));
  1230. Message(playerid, COLOR_GREY, "[%s] You took $%s from the $%s in your cashbox.", ReturnDateLog(), MoneyFormat(quantity), MoneyFormat(PropertyData[id][propertyMoney]));
  1231.  
  1232. GiveMoney( playerid, quantity );
  1233. PropertyData[id][propertyMoney]-= quantity;
  1234.  
  1235. SaveSQLInt(PropertyData[id][propertyid], "properties", "Money", PropertyData[id][propertyMoney]);
  1236. }
  1237. else if(!strcmp(ink, "put", true))
  1238. {
  1239. if(sscanf(thr_str, "i", quantity))
  1240. return SendClientMessage(playerid, COLOR_ADM, "USAGE: /myhouse cashbox put [quantity]");
  1241.  
  1242. if( quantity < 1 || quantity > PlayerData[playerid][pMoney] )
  1243. return SendClientMessage(playerid, COLOR_ADM, "You specified an invalid amount.");
  1244.  
  1245. WriteLog("property_logs/cashboxput_log.txt", "[%s] %s put $%s into Property %i's Cashbox. [Previous cashbox: $%i - Previous Onhand: $%i - Onhand now: $%i]", ReturnDateLog(), ReturnName(playerid), MoneyFormat(quantity), PropertyData[id][propertyid], PropertyData[id][propertyMoney], PlayerData[playerid][pMoney], (PlayerData[playerid][pMoney]-quantity));
  1246. Message(playerid, COLOR_GREY, "[%s] You put $%s into the current $%s cashbox.", ReturnDateLog(), MoneyFormat(quantity), MoneyFormat(PropertyData[id][propertyMoney]));
  1247.  
  1248. PropertyData[id][propertyMoney]+= quantity;
  1249. GiveMoney( playerid, -quantity );
  1250.  
  1251. SaveSQLInt(PropertyData[id][propertyid], "properties", "Money", PropertyData[id][propertyMoney]);
  1252. }
  1253. else if(!strcmp(ink, "info", true))
  1254. {
  1255. Message(playerid, COLOR_GREY, "As of %s, you have $%s in your cashbox.", ReturnDateLog(), MoneyFormat(PropertyData[id][propertyMoney]));
  1256. }
  1257. else return SendClientMessage(playerid, COLOR_ADM, "SERVER: Nevazeca opcija.");
  1258. }
  1259. else return SendClientMessage(playerid, COLOR_ADM, "SERVER: Nevazeca opcija.");
  1260. return 1;
  1261. }
  1262.  
  1263. CMD:setrentable(playerid, params[])
  1264. {
  1265. if(!pLoggedIn[playerid])return true;
  1266.  
  1267. new hid = IsPlayerInProperty(playerid);
  1268.  
  1269. if(CountPlayerHouses(playerid) == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own any houses.");
  1270. if (!hid)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You need to be inside your house.");
  1271. if(PropertyData[hid][propertyOwnerSQL] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this house.");
  1272.  
  1273. if(PropertyData[hid][propertyRentable] == 0){
  1274. PropertyData[hid][propertyRentable] = 1;
  1275. SaveSQLInt(PropertyData[hid][propertyid], "properties", "Rentable", PropertyData[hid][propertyRentable]);
  1276. SendClientMessage(playerid, COLOR_DARKGREEN, "Your house is now rentable. Use `/setrent` to set the rent.");
  1277. }
  1278. else{
  1279. PropertyData[hid][propertyRentable] = 0;
  1280. SaveSQLInt(PropertyData[hid][propertyid], "properties", "Rentable", PropertyData[hid][propertyRentable]);
  1281. SendClientMessage(playerid, COLOR_DARKGREEN, "Your house is no longer rentable.");
  1282. }
  1283.  
  1284. return true;
  1285. }
  1286.  
  1287. CMD:setrent(playerid, params[])
  1288. {
  1289. if(!pLoggedIn[playerid])return true;
  1290.  
  1291. new string[128], rent, hid = IsPlayerInProperty(playerid);
  1292.  
  1293. if(CountPlayerHouses(playerid) == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own any houses.");
  1294. if (!hid)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You need to be inside your house.");
  1295. if(PropertyData[hid][propertyOwnerSQL] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this house.");
  1296.  
  1297. if(sscanf(params, "d", rent))return SendClientMessage(playerid, COLOR_ADM, "USAGE:{FFFFFF} /setrent [$1-$500]");
  1298. if(rent < 0 || rent > 500)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} The rent must be at least $1 and not greater than $500.");
  1299.  
  1300. PropertyData[hid][propertyRentPrice] = rent;
  1301. SaveSQLInt(PropertyData[hid][propertyid], "properties", "RentPrice", PropertyData[hid][propertyRentPrice]);
  1302.  
  1303. format(string, sizeof(string), "Your houses rent is now $%s.", MoneyFormat(rent));
  1304. SendClientMessage(playerid, COLOR_ADM, string);
  1305.  
  1306. WriteLog("property_logs/setrent_log.txt", "[%s] %s set their House DBID %i rent to $%s", ReturnDate(), ReturnName(playerid), hid, MoneyFormat(rent));
  1307. return true;
  1308. }
  1309.  
  1310. CMD:rentroom(playerid, params[])
  1311. {
  1312. if(!pLoggedIn[playerid])return true;
  1313.  
  1314. new string[128];
  1315.  
  1316. if(PlayerData[playerid][pRenting])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You can only rent at one house.");
  1317.  
  1318. for(new i = 0; i < MAX_PROPERTY; i++)
  1319. {
  1320. if(PropertyData[i][propertyid] != 0){
  1321. if(IsPlayerInRangeOfPoint(playerid, 3.0, PropertyData[i][propertyExterior][0], PropertyData[i][propertyExterior][1], PropertyData[i][propertyExterior][2])){
  1322. if(!PropertyData[i][propertyRentable])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} This house isn't rentable.");
  1323. if(PropertyData[i][propertyOwnerSQL] == PlayerData[playerid][pSQLID])
  1324. return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You can't rent at your own home.");
  1325.  
  1326. PlayerData[playerid][pRenting] = PropertyData[i][propertyid];
  1327. GiveMoney(playerid, -PropertyData[i][propertyRentPrice]);
  1328.  
  1329. SaveSQLInt(PlayerData[playerid][pSQLID], "players", "Renting", PlayerData[playerid][pRenting]);
  1330.  
  1331. format(string, sizeof(string), "You're now renting at this house. Cost: $%s.", MoneyFormat(PropertyData[i][propertyRentPrice]));
  1332. SendClientMessage(playerid, COLOR_ADM, string);
  1333.  
  1334. WriteLog("property_logs/rentroom_log.txt", "[%s] %s is renting house ID %d", ReturnDate(), ReturnName(playerid, 1), i);
  1335. return true;
  1336. }
  1337. }
  1338. }
  1339. SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You're not near a house.");
  1340. return true;
  1341. }
  1342.  
  1343. CMD:unrentroom(playerid, params[])
  1344. {
  1345. if(!pLoggedIn[playerid])return true;
  1346.  
  1347. if(!PlayerData[playerid][pRenting])
  1348. return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You aren't renting anywhere.");
  1349.  
  1350. PlayerData[playerid][pRenting] = false;
  1351. cmd_setspawn(playerid, "1");
  1352.  
  1353. return true;
  1354. }
  1355.  
  1356. CMD:tenants(playerid, params[])
  1357. {
  1358. if(!pLoggedIn[playerid])return true;
  1359.  
  1360. new hid = IsPlayerInProperty(playerid);
  1361.  
  1362. if(CountPlayerHouses(playerid) == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own any houses.");
  1363. if (!hid)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You need to be inside your house.");
  1364. if(PropertyData[hid][propertyOwnerSQL] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this house.");
  1365.  
  1366. ShowTenantNames(playerid, hid);
  1367.  
  1368. return true;
  1369. }
  1370.  
  1371. CMD:evictall(playerid, params[])
  1372. {
  1373. if(!pLoggedIn[playerid])return true;
  1374.  
  1375. new hid = IsPlayerInProperty(playerid);
  1376.  
  1377. if(CountPlayerHouses(playerid) == 0)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own any houses.");
  1378. if (!hid)return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You need to be inside your house.");
  1379. if(PropertyData[hid][propertyOwnerSQL] != PlayerData[playerid][pSQLID])return SendClientMessage(playerid, COLOR_ADM, "ERROR:{FFFFFF} You don't own this house.");
  1380.  
  1381. new confirm[90];
  1382.  
  1383. if(sscanf(params, "s[90]", confirm))return SendClientMessage(playerid, COLOR_ADM, "SERVER:{FFFFFF} Are you sure you want to evict all your tenants? Type /evictall `confirm` to continue.");
  1384.  
  1385. if(strmatch(confirm, "confirm")){
  1386.  
  1387. EvictAllTenants(playerid, hid);
  1388. }
  1389.  
  1390. return true;
  1391.  
  1392. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement