Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Cellphone System V1 from Redstreets RPG. I have edited it so everyone can use it.
- //I have worked on it for 1/2 days, so please give me credits for it and DON'T remove them.
- //._________________________________________.
- //|Including Functions: |
- //| Simply call players by using /call [id]|
- //| SMS function /sms [id] |
- //| Using cellphone animations (Yay!) |
- //| Simply cancel calls by using /cancel |
- //.-----------------------------------------.
- //Earlier things that i released:
- //- Simple Bank System V1: http://forum.sa-mp.com/showthread.php?t=139268&highlight=sean5874
- //If you wanna see more cool scripts, visit 217.18.71.36:7777 (RedStreets RPG)
- //And for now, enjoy this script!
- //------------------------------------------------------------------------------
- #define FILTERSCRIPT
- #include <a_samp>
- #include <dcmd>
- #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
- #define COLOR_RED 0xFF0000AA
- #define COLOR_YELLOW 0xFFFF00AA
- new gname[MAX_PLAYER_NAME];
- new pname[MAX_PLAYER_NAME];
- new playeronphone[MAX_PLAYERS];
- new called[MAX_PLAYERS];
- new str[128];
- new str2[128];
- forward SendPhoneMessage(playerid,text[]);
- forward SendChat(text[]);
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n._________________________________________.");
- print("|Cell Phone System V1 from RedStreets RPG.|");
- print("|Made by sean5874 aka Danny. |");
- print(".-----------------------------------------.\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #endif
- public OnPlayerConnect(playerid)
- {
- SetPVarInt(playerid,"receiverid", -1);
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- if(playeronphone[playerid] == 1) {
- new receiverid;
- receiverid = GetPVarInt(playerid, "receiverid");
- GetPlayerName(playerid, pname, sizeof(pname));
- format(str2, sizeof str2,"%s (cellphone): %s",pname,text);
- SendClientMessage(playerid, COLOR_YELLOW, str2);
- SendClientMessage(receiverid, COLOR_YELLOW, str2);
- return 0;
- } else {
- return 1;
- }
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(call,4,cmdtext);
- dcmd(p,1,cmdtext);
- dcmd(h,1,cmdtext);
- dcmd(sms, 3, cmdtext);
- dcmd(cancel, 6, cmdtext);
- return 0;
- }
- dcmd_call(playerid, params[]) {
- new giveplayerid;
- if(sscanf(params, "i", giveplayerid)) {
- SendClientMessage(playerid, COLOR_RED, "USAGE: /call [id]"); return 1;
- }
- if(!IsPlayerConnected(giveplayerid)) {
- SendClientMessage(playerid, COLOR_RED,"You receive a busy tone..."); return 1;
- }
- //if(playerid == giveplayerid) {
- // SendClientMessage(playerid, COLOR_RED, "You can't call yourself!"); return 1;
- //}
- GetPlayerName(giveplayerid, gname, sizeof(gname));
- GetPlayerName(playerid, pname, sizeof(pname));
- SetPVarInt(playerid, "receiverid", giveplayerid);
- SetPVarInt(giveplayerid, "receiverid", playerid);
- format(str, sizeof str,"You are calling %s.. Connecting...",gname);
- SendClientMessage(playerid, COLOR_YELLOW, str);
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
- format(str2, sizeof str2,"Your cellphone starts to ring. Use /p to pickup. Caller: %s",pname);
- SendClientMessage(giveplayerid, COLOR_YELLOW, str2);
- called[giveplayerid] = 1;
- return true;
- }
- dcmd_p(playerid,params[]) {
- #pragma unused params
- if(called[playerid] == 0) {
- SendClientMessage(playerid, COLOR_RED,"Nobody has called you yet!"); return 1;
- }
- new receiverid = GetPVarInt(playerid,"receiverid");
- playeronphone[playerid] = 1;
- playeronphone[receiverid] = 1;
- called[playerid] = 0;
- SendClientMessage(receiverid,COLOR_YELLOW,"Someone is picking up your call..");
- SendClientMessage(playerid,COLOR_YELLOW,"You have picked up the call.");
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
- return true;
- }
- dcmd_h(playerid, params[]) {
- #pragma unused params
- new receiverid;
- receiverid = GetPVarInt(playerid, "receiverid");
- if(playeronphone[playerid] == 0) {
- SendClientMessage(playerid, COLOR_RED,"You are not on the phone!"); return 1;
- }
- SendClientMessage(playerid, COLOR_YELLOW,"You have hanged up the phone.");
- SendClientMessage(receiverid, COLOR_YELLOW,"The person on the other side has hanged up!");
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
- SetPlayerSpecialAction(receiverid, SPECIAL_ACTION_STOPUSECELLPHONE);
- playeronphone[playerid] = 0;
- playeronphone[receiverid] = 0;
- SetPVarInt(receiverid,"receiverid", -1);
- SetPVarInt(playerid,"receiverid", -1);
- return 1;
- }
- dcmd_sms(playerid, params[]) {
- new giveplayerid,text;
- GetPlayerName(playerid, pname, sizeof(pname));
- if(sscanf(params, "iz", giveplayerid,text)) {
- SendClientMessage(playerid, COLOR_RED, "USAGE: /sms [id] [text]"); return 1;
- }
- format(str, sizeof str,"SMS: %s || Sender %s",text,pname);
- format(str2, sizeof str2,"SMS sended!: %s",text);
- SendClientMessage(playerid, COLOR_YELLOW,str2);
- SendClientMessage(giveplayerid, COLOR_YELLOW, str);
- GameTextForPlayer(playerid,"~r~-$1",3000,1);
- GivePlayerMoney(playerid, -1);
- return 1;
- }
- dcmd_cancel(playerid, cmdtext[]) {
- #pragma unused cmdtext
- if(playeronphone[playerid] == 1) {
- SendClientMessage(playerid, COLOR_RED,"You can't use this command when calling!"); return 1;
- }
- if(called[playerid] == 0) {
- SendClientMessage(playerid, COLOR_RED,"You haven't received a call!"); return 1;
- }
- new receiverid;
- receiverid = GetPVarInt(playerid,"receiverid");
- GetPlayerName(playerid, pname, sizeof (pname));
- format(str, sizeof str,"%s has cancelled the call!",pname);
- SendClientMessage(receiverid, COLOR_RED, str);
- SendClientMessage(playerid, COLOR_YELLOW,"You have cancelled the call.");
- called[playerid] = 0;
- called[receiverid] = 0;
- SetPlayerSpecialAction(receiverid, SPECIAL_ACTION_STOPUSECELLPHONE);
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
- SetPVarInt(receiverid,"receiverid", -1);
- SetPVarInt(playerid,"receiverid", -1);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement