Advertisement
Guest User

re

a guest
Jun 21st, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.38 KB | None | 0 0
  1. CMD:setfreq(playerid, params[]) {
  2. new string[256],password[20],password2[20],ownerid, sendername[25];
  3. if(PlayerInfo[playerid][pWTalkie] == 0) return SCM(playerid, COLOR_WHITE, "You don't have a walkie talkie.");
  4. new freqss2;
  5. if(sscanf(params, "dS(q)[20]",freqss2,password)) return SCM(playerid, COLOR_WHITE, "{dd0808}Syntax:{FFFFFF} /setfrequency [frequency] (0 to switch off).");
  6. if(freqss2 < 0 || freqss2 > 1000000) return SCM(playerid, COLOR_WHITE, "Invalid frequency specified. Valid frequencies: 1 - 1000000.");
  7. if(freqss2 == 0)
  8. {
  9. WTChannel[playerid] = 0;
  10. mysql_format(SQL,string,sizeof(string),"UPDATE `users` SET `WTChannel` = '%d' WHERE `name` = '%s'",WTChannel[playerid],PlayerInfo[playerid][pSQLID]);
  11. mysql_tquery(SQL,string,"","");
  12. SendClientMessage(playerid, COLOR_WHITE, "You have switched off your walkie-talkie.");
  13. return 1;
  14. }
  15. if(freqss2 < 100) return SCM(playerid, COLOR_WHITE, "Invalid walkie talkie frequency.");
  16. if(freqss2 >= 1000)
  17. {
  18. format(string, sizeof(string), "You are now broadcasting at the frequency of #%d khz.",freqss2);
  19. SCM(playerid, COLOR_WHITE, string);
  20. WTChannel[playerid] = freqss2;
  21. mysql_format(SQL,string,sizeof(string),"UPDATE `users` SET `WTChannel` = '%d' WHERE `name` = '%s'",WTChannel[playerid],PlayerInfo[playerid][pSQLID]);
  22. mysql_tquery(SQL,string,"","");
  23. }
  24. else
  25. {
  26. format(string, sizeof(string), "SELECT * FROM `frequencies` WHERE `freqid`='%d'", freqss2);
  27. new Cache: ab = mysql_query(SQL, string);
  28. if(cache_get_row_count() > 0)
  29. {
  30. cache_get_field_content(0, "password", password2);
  31. ownerid = cache_get_field_content_int(0, "ownerid");
  32. }
  33. else
  34. {
  35. cache_delete(ab);
  36. SendClientMessage(playerid, COLOR_WHITE, "Invalid frequency. This frequency can be bought from the /shop.");
  37. return 1;
  38. }
  39. cache_delete(ab);
  40. if(ownerid == PlayerInfo[playerid][pSQLID])
  41. {
  42. format(string, sizeof(string), "You are now broadcasting at the frequency of #%d khz.",freqss2);
  43. SCM(playerid, COLOR_WHITE, string);
  44. WTChannel[playerid] = freqss2;
  45. mysql_format(SQL,string,sizeof(string),"UPDATE `users` SET `WTChannel` = '%d' WHERE `name` = '%s'",WTChannel[playerid],PlayerInfo[playerid][pSQLID]);
  46. mysql_tquery(SQL,string,"","");
  47. }
  48. else
  49. {
  50. if(strcmp(password,password2,true) == 0)
  51. {
  52. format(string, sizeof(string), "You are now broadcasting at the frequency of #%d khz.",freqss2);
  53. SCM(playerid, COLOR_WHITE, string);
  54. WTChannel[playerid] = freqss2;
  55. mysql_format(SQL,string,sizeof(string),"UPDATE `users` SET `WTChannel` = '%d' WHERE `name` = '%s'",WTChannel[playerid],PlayerInfo[playerid][pSQLID]);
  56. mysql_tquery(SQL,string,"","");
  57. GetPlayerName(playerid,sendername,sizeof(sendername));
  58. foreach(Player, i) {
  59. if(WTChannel[i] == WTChannel[playerid]) {
  60. format(string, sizeof(string), "%s a intrat pe frecventa.",sendername);
  61. SCM(i, 0xC8E0DFFF, string);
  62. }
  63. }
  64. }
  65. else return SCM(playerid, COLOR_WHITE, "Invalid password! This is a private frequency. You need the password to enter.");
  66. }
  67. }
  68. return 1; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement