Advertisement
Guest User

Simplecell

a guest
Oct 24th, 2010
835
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.11 KB | None | 0 0
  1. //Cellphone System V1 from Redstreets RPG. I have edited it so everyone can use it.
  2. //I have worked on it for 1/2 days, so please give me credits for it and DON'T remove them.
  3.  
  4. //._________________________________________.
  5. //|Including Functions: |
  6. //| Simply call players by using /call [id]|
  7. //| SMS function /sms [id] |
  8. //| Using cellphone animations (Yay!) |
  9. //| Simply cancel calls by using /cancel |
  10. //.-----------------------------------------.
  11.  
  12. //Earlier things that i released:
  13. //- Simple Bank System V1: http://forum.sa-mp.com/showthread.php?t=139268&highlight=sean5874
  14. //If you wanna see more cool scripts, visit 217.18.71.36:7777 (RedStreets RPG)
  15. //And for now, enjoy this script!
  16. //------------------------------------------------------------------------------
  17. #define FILTERSCRIPT
  18.  
  19. #include <a_samp>
  20. #include <dcmd>
  21.  
  22. #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  23.  
  24. #define COLOR_RED 0xFF0000AA
  25. #define COLOR_YELLOW 0xFFFF00AA
  26.  
  27. new gname[MAX_PLAYER_NAME];
  28. new pname[MAX_PLAYER_NAME];
  29. new playeronphone[MAX_PLAYERS];
  30. new called[MAX_PLAYERS];
  31. new str[128];
  32. new str2[128];
  33.  
  34. forward SendPhoneMessage(playerid,text[]);
  35. forward SendChat(text[]);
  36. #if defined FILTERSCRIPT
  37.  
  38. public OnFilterScriptInit()
  39. {
  40. print("\n._________________________________________.");
  41. print("|Cell Phone System V1 from RedStreets RPG.|");
  42. print("|Made by sean5874 aka Danny. |");
  43. print(".-----------------------------------------.\n");
  44. return 1;
  45. }
  46.  
  47. public OnFilterScriptExit()
  48. {
  49. return 1;
  50. }
  51.  
  52. #endif
  53.  
  54. public OnPlayerConnect(playerid)
  55. {
  56. SetPVarInt(playerid,"receiverid", -1);
  57. return 1;
  58. }
  59.  
  60. public OnPlayerText(playerid, text[])
  61. {
  62. if(playeronphone[playerid] == 1) {
  63. new receiverid;
  64. receiverid = GetPVarInt(playerid, "receiverid");
  65. GetPlayerName(playerid, pname, sizeof(pname));
  66. format(str2, sizeof str2,"%s (cellphone): %s",pname,text);
  67. SendClientMessage(playerid, COLOR_YELLOW, str2);
  68. SendClientMessage(receiverid, COLOR_YELLOW, str2);
  69. return 0;
  70. } else {
  71. return 1;
  72. }
  73. }
  74.  
  75. public OnPlayerCommandText(playerid, cmdtext[])
  76. {
  77. dcmd(call,4,cmdtext);
  78. dcmd(p,1,cmdtext);
  79. dcmd(h,1,cmdtext);
  80. dcmd(sms, 3, cmdtext);
  81. dcmd(cancel, 6, cmdtext);
  82. return 0;
  83. }
  84.  
  85. dcmd_call(playerid, params[]) {
  86. new giveplayerid;
  87. if(sscanf(params, "i", giveplayerid)) {
  88. SendClientMessage(playerid, COLOR_RED, "USAGE: /call [id]"); return 1;
  89. }
  90. if(!IsPlayerConnected(giveplayerid)) {
  91. SendClientMessage(playerid, COLOR_RED,"You receive a busy tone..."); return 1;
  92. }
  93. //if(playerid == giveplayerid) {
  94. // SendClientMessage(playerid, COLOR_RED, "You can't call yourself!"); return 1;
  95. //}
  96. GetPlayerName(giveplayerid, gname, sizeof(gname));
  97. GetPlayerName(playerid, pname, sizeof(pname));
  98. SetPVarInt(playerid, "receiverid", giveplayerid);
  99. SetPVarInt(giveplayerid, "receiverid", playerid);
  100. format(str, sizeof str,"You are calling %s.. Connecting...",gname);
  101. SendClientMessage(playerid, COLOR_YELLOW, str);
  102. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
  103. format(str2, sizeof str2,"Your cellphone starts to ring. Use /p to pickup. Caller: %s",pname);
  104. SendClientMessage(giveplayerid, COLOR_YELLOW, str2);
  105. called[giveplayerid] = 1;
  106. return true;
  107. }
  108. dcmd_p(playerid,params[]) {
  109. #pragma unused params
  110. if(called[playerid] == 0) {
  111. SendClientMessage(playerid, COLOR_RED,"Nobody has called you yet!"); return 1;
  112. }
  113. new receiverid = GetPVarInt(playerid,"receiverid");
  114. playeronphone[playerid] = 1;
  115. playeronphone[receiverid] = 1;
  116. called[playerid] = 0;
  117. SendClientMessage(receiverid,COLOR_YELLOW,"Someone is picking up your call..");
  118. SendClientMessage(playerid,COLOR_YELLOW,"You have picked up the call.");
  119. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
  120. return true;
  121. }
  122. dcmd_h(playerid, params[]) {
  123. #pragma unused params
  124. new receiverid;
  125. receiverid = GetPVarInt(playerid, "receiverid");
  126. if(playeronphone[playerid] == 0) {
  127. SendClientMessage(playerid, COLOR_RED,"You are not on the phone!"); return 1;
  128. }
  129. SendClientMessage(playerid, COLOR_YELLOW,"You have hanged up the phone.");
  130. SendClientMessage(receiverid, COLOR_YELLOW,"The person on the other side has hanged up!");
  131. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
  132. SetPlayerSpecialAction(receiverid, SPECIAL_ACTION_STOPUSECELLPHONE);
  133. playeronphone[playerid] = 0;
  134. playeronphone[receiverid] = 0;
  135. SetPVarInt(receiverid,"receiverid", -1);
  136. SetPVarInt(playerid,"receiverid", -1);
  137. return 1;
  138. }
  139. dcmd_sms(playerid, params[]) {
  140. new giveplayerid,text;
  141. GetPlayerName(playerid, pname, sizeof(pname));
  142. if(sscanf(params, "iz", giveplayerid,text)) {
  143. SendClientMessage(playerid, COLOR_RED, "USAGE: /sms [id] [text]"); return 1;
  144. }
  145. format(str, sizeof str,"SMS: %s || Sender %s",text,pname);
  146. format(str2, sizeof str2,"SMS sended!: %s",text);
  147. SendClientMessage(playerid, COLOR_YELLOW,str2);
  148. SendClientMessage(giveplayerid, COLOR_YELLOW, str);
  149. GameTextForPlayer(playerid,"~r~-$1",3000,1);
  150. GivePlayerMoney(playerid, -1);
  151. return 1;
  152. }
  153. dcmd_cancel(playerid, cmdtext[]) {
  154. #pragma unused cmdtext
  155. if(playeronphone[playerid] == 1) {
  156. SendClientMessage(playerid, COLOR_RED,"You can't use this command when calling!"); return 1;
  157. }
  158. if(called[playerid] == 0) {
  159. SendClientMessage(playerid, COLOR_RED,"You haven't received a call!"); return 1;
  160. }
  161. new receiverid;
  162. receiverid = GetPVarInt(playerid,"receiverid");
  163. GetPlayerName(playerid, pname, sizeof (pname));
  164. format(str, sizeof str,"%s has cancelled the call!",pname);
  165. SendClientMessage(receiverid, COLOR_RED, str);
  166. SendClientMessage(playerid, COLOR_YELLOW,"You have cancelled the call.");
  167. called[playerid] = 0;
  168. called[receiverid] = 0;
  169. SetPlayerSpecialAction(receiverid, SPECIAL_ACTION_STOPUSECELLPHONE);
  170. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
  171. SetPVarInt(receiverid,"receiverid", -1);
  172. SetPVarInt(playerid,"receiverid", -1);
  173. return 1;
  174. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement