Guest User

Untitled

a guest
Oct 27th, 2017
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. stock ShowRadioTextDraw(playerid)
  2. {
  3. PlayerTextDrawShow(playerid, PlayerText:RadioDraw[playerid]);
  4. PlayerTextDrawShow(playerid, PlayerText:ChannelDraw[playerid]);
  5. PlayerTextDrawShow(playerid, PlayerText:SlotDraw[playerid]);
  6. SetRadioChannel(playerid, GetPlayerChannel(playerid));
  7. SetRadioSlot(playerid, GetPlayerSlot(playerid));
  8. return 1;
  9. }
  10.  
  11. stock HideRadioTextDraw(playerid)
  12. {
  13. PlayerTextDrawHide(playerid, PlayerText:RadioDraw[playerid]);
  14. PlayerTextDrawHide(playerid, PlayerText:ChannelDraw[playerid]);
  15. PlayerTextDrawHide(playerid, PlayerText:SlotDraw[playerid]);
  16. return 1;
  17. }
  18.  
  19. stock RadioMSG(playerid, message[])
  20. {
  21. new msg[128];
  22. format(msg, sizeof(msg), "{00FFFF}[Radio]{DADADA}: %s", message);
  23. return SendClientMessageEx(playerid, -1, msg);
  24. }
  25.  
  26. stock SetRadioChannel(playerid, channel)
  27. {
  28. new msg[128];
  29. if(channel == 0)
  30. {
  31. format(msg, sizeof(msg), "~b~Chan: ~h~~g~0");
  32. PlayerInfo[playerid][pAuthed] = 0;
  33. }
  34. else
  35. {
  36. format(msg, sizeof(msg), "~b~Chan: ~h~~g~%d", channel);
  37. }
  38. PlayerTextDrawSetString(playerid, ChannelDraw[playerid], msg);
  39. PlayerInfo[playerid][pChannel] = channel;
  40. return 1;
  41. }
  42.  
  43. stock SetRadioSlot(playerid, slot)
  44. {
  45. new msg[128];
  46. format(msg, sizeof(msg), "~b~Slot: ~h~~g~%d", slot);
  47. PlayerTextDrawSetString(playerid, SlotDraw[playerid], msg);
  48. PlayerInfo[playerid][pSlot] = slot;
  49. return 1;
  50. }
  51.  
  52. // not show textdraw
  53. CMD:setchannel(playerid, params[])
  54. {
  55. new msg[128];
  56. new channelid,slot;
  57. if(sscanf(params, "d", channelid)) return SendClientMessageEx(playerid, COLOR_GRAD1, "/setchannel [channel ID]");
  58. if(PlayerInfo[playerid][pRadio] == 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "You don't have a radio.");
  59. if(!ChannelExist(channelid)) return RadioMSG(playerid, "No such channel.");
  60. if(channelid == 911 && PlayerInfo[playerid][pMember] != 1) return SendClientMessageEx(playerid, COLOR_GREY, "Your radio doesn't support in this channel (LSPD).");
  61. if(channelid == GetPlayerChannel(playerid)) return RadioMSG(playerid, "You are in this channel already.");
  62. format(msg, sizeof(msg), "Radio Channel sET [CH: %d, Slot: %d]", channelid, slot);
  63. SendClientMessageEx(playerid, COLOR_GREEN, msg);
  64. RadioMSG(playerid, "Before you can /r please authorize, /auth.");
  65. PlayerInfo[playerid][pAuthed] = 0;
  66. SetRadioChannel(playerid, channelid);
  67. SetRadioSlot(playerid, slot);
  68. ShowRadioTextDraw(playerid);
  69. return 1;
  70. }
  71.  
  72. CMD:setslot(playerid, params[])
  73. {
  74. new slot, string[128];
  75. if(sscanf(params, "d", slot)) return SendClientMessageEx(playerid, COLOR_GRAD1, "/setslot [slot-id]");
  76. if(PlayerInfo[playerid][pRadio] == 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "You don't have a radio.");
  77. if(slot == GetPlayerSlot(playerid)) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are in this slot already.");
  78. if(slot > 3 || slot < 1) return SendClientMessageEx(playerid, COLOR_GREY, "Slot must be 1-3.");
  79. SetRadioSlot(playerid, slot);
  80. format(string, sizeof(string), "You have set your radio slot to %d.", slot);
  81. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  82. ShowRadioTextDraw(playerid);
  83. return 1;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment