Advertisement
Guest User

Untitled

a guest
Mar 14th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.47 KB | None | 0 0
  1. CMD:editbiz(playerid, params[])
  2. {
  3. new text[15],amount, string[128],name[32];
  4. if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "Eroare: Nu esti autorizat sa folosesti aceasta comanda.");
  5. if(sscanf(params,"s[15]", text))
  6. {
  7. SendClientMessage(playerid, COLOR_WHITE, "USAGE: /editbiz [items]");
  8. SendClientMessage(playerid, COLOR_WHITE, "Items: price, fee, lock, vault, name");
  9. return 1;
  10. }
  11. if(strcmp(text, "price", true, 5) == 0)
  12. {
  13. if(sscanf(params, "s[15]i",text,amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /editbiz price [amount]");
  14. if(amount < 0) return SendClientMessage(playerid, COLOR_WHITE, "Eroare: Valoare introdusa nu poate fi mai mica decat 0.");
  15. for(new b = 0; b < MAX_BUSINESSES; b++)
  16. {
  17. if(IsPlayerInRangeOfPoint(playerid, 5.0, BizInfo[b][bExteriorPos][0], BizInfo[b][bExteriorPos][1], BizInfo[b][bExteriorPos][2]))
  18. {
  19. BizInfo[b][bPrice] = amount;
  20. UpdateBusiness(b);
  21. format(string, sizeof(string), "You have edited price to %d$ for business %d.",amount,b);
  22. SendClientMessage(playerid, COLOR_YELLOW, string);
  23. format(string, sizeof(string), "AdmCmd: %s has edited the price to %d for business %d.",PlayerInfo[playerid][pUsername],amount,b);
  24. SendMessageToAdmins(4, COLOR_LIGHTRED, string);
  25. format(string, sizeof(string), "%s has edited the price to %d for business %d.",PlayerInfo[playerid][pUsername],amount,b);
  26. ABroadcast(string);
  27. break;
  28. }
  29. }
  30. }
  31. if(strcmp(text, "fee", true, 3) == 0)
  32. {
  33. if(sscanf(params, "s[15]i",text,amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /editbiz fee [amount]");
  34. if(amount < 1) return SendClientMessage(playerid, COLOR_WHITE, "Eroare: Valoare introdusa nu poate fi mai mica decat 1.");
  35. for(new b = 0; b < MAX_BUSINESSES; b++)
  36. {
  37. if(IsPlayerInRangeOfPoint(playerid, 5.0, BizInfo[b][bExteriorPos][0], BizInfo[b][bExteriorPos][1], BizInfo[b][bExteriorPos][2]))
  38. {
  39. BizInfo[b][bFee] = amount;
  40. UpdateBusiness(b);
  41. format(string, sizeof(string), "You have edited fee to %d$ for business %d.",amount,b);
  42. SendClientMessage(playerid, COLOR_YELLOW, string);
  43. format(string, sizeof(string), "AdmCmd: %s has edited the fee to %d for business %d.",PlayerInfo[playerid][pUsername],amount,b);
  44. SendMessageToAdmins(4, COLOR_LIGHTRED, string);
  45. format(string, sizeof(string), "%s has edited the fee to %d for business %d.",PlayerInfo[playerid][pUsername],amount,b);
  46. ABroadcast(string);
  47. break;
  48. }
  49. }
  50. }
  51. if(strcmp(text, "lock", true, 4) == 0)
  52. {
  53. if(sscanf(params, "s[15]i",text,amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /editbiz lock [0/1]");
  54. if(amount < 0 || amount > 1) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /editbiz lock [0/1]");
  55. for(new b = 0; b < MAX_BUSINESSES; b++)
  56. {
  57. if(IsPlayerInRangeOfPoint(playerid, 5.0, BizInfo[b][bExteriorPos][0], BizInfo[b][bExteriorPos][1], BizInfo[b][bExteriorPos][2]))
  58. {
  59. BizInfo[b][bLocked] = amount;
  60. UpdateBusiness(b);
  61. format(string, sizeof(string), "You have edited lock to %d for business %d.",amount,b);
  62. SendClientMessage(playerid, COLOR_YELLOW, string);
  63. format(string, sizeof(string), "AdmCmd: %s has edited the lock to %d for business %d.",PlayerInfo[playerid][pUsername],amount,b);
  64. SendMessageToAdmins(4, COLOR_LIGHTRED, string);
  65. format(string, sizeof(string), "%s has edited the lock to %d for business %d.",PlayerInfo[playerid][pUsername],amount,b);
  66. ABroadcast(string);
  67. break;
  68. }
  69. }
  70. }
  71. if(strcmp(text, "vault", true, 5) == 0)
  72. {
  73. if(sscanf(params, "s[15]i",text,amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /editbiz vault [amount]");
  74. if(amount < 0) return SendClientMessage(playerid, COLOR_WHITE, "Eroare: Valoare introdusa nu poate fi mai mica decat 0.");
  75. for(new b = 0; b < MAX_BUSINESSES; b++)
  76. {
  77. if(IsPlayerInRangeOfPoint(playerid, 5.0, BizInfo[b][bExteriorPos][0], BizInfo[b][bExteriorPos][1], BizInfo[b][bExteriorPos][2]))
  78. {
  79. BizInfo[b][bVault] = amount;
  80. UpdateBusiness(b);
  81. format(string, sizeof(string), "You have edited vault to %d$ for business %d.",amount,b);
  82. SendClientMessage(playerid, COLOR_YELLOW, string);
  83. format(string, sizeof(string), "AdmCmd: %s has edited the vault to %d for business %d.",PlayerInfo[playerid][pUsername],amount,b);
  84. SendMessageToAdmins(4, COLOR_LIGHTRED, string);
  85. format(string, sizeof(string), "%s has edited the vault to %d for business %d.",PlayerInfo[playerid][pUsername],amount,b);
  86. ABroadcast(string);
  87. break;
  88. }
  89. }
  90. }
  91. if(strcmp(text, "name", true, 4) == 0)
  92. {
  93. if(sscanf(params, "s[15]s[32]",text,name)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /editbiz name [new name]");
  94. if(strlen(name) < 1) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /editbiz name [new name]");
  95. for(new b = 0; b < MAX_BUSINESSES; b++)
  96. {
  97. if(IsPlayerInRangeOfPoint(playerid, 5.0, BizInfo[b][bExteriorPos][0], BizInfo[b][bExteriorPos][1], BizInfo[b][bExteriorPos][2]))
  98. {
  99. format(BizInfo[b][bName], 32, name);
  100. UpdateBusiness(b);
  101. format(string, sizeof(string), "You have edited name for business %d.",amount,b);
  102. SendClientMessage(playerid, COLOR_YELLOW, string);
  103. format(string, sizeof(string), "AdmCmd: %s has edited the name to %s for business %d.",PlayerInfo[playerid][pUsername],name,b);
  104. SendMessageToAdmins(4, COLOR_LIGHTRED, string);
  105. format(string, sizeof(string), "%s has edited the name to %s for business %d.",PlayerInfo[playerid][pUsername],name,b);
  106. ABroadcast(string);
  107. break;
  108. }
  109. }
  110. }
  111. return 1;
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement