SMS System
#1

Hey guys. I was wondering how I could make an SMS system with dialogs. When the player enters a number in the first dialog and a second dialog is displayed, how do I take both the number and the SMS text from both dialog responses?
Thanks!
Reply
#2

Here


PHP код:
CMD:sms(playeridparams[])
{
    if(
gPlayerLogged[playerid] == 0)
    {
        
SendClientMessage(playeridCOLOR_GREY"   You haven't logged in yet!");
        return 
1;
    }
    if(
GetPVarInt(playerid"Injured") != 0||GetPVarInt(playerid"Hospital")!=0)
    {
        
SendClientMessage (playeridCOLOR_GRAD2"You can't do this at this time.");
        return 
1;
    }
    if(
PlayerTied[playerid] != || PlayerCuffed[playerid] != 0)
    {
        
SendClientMessage(playerid,COLOR_GREY,"You can't use your phone whilist restrained.");
        return 
1;
    }
    new 
string[128], phonenumbtext[100];
    if(
sscanf(params"ds[100]"phonenumbtext)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: (/t)ext [phonenumber] [text chat]");
    
//if(AntiAdv(playerid, params)) return 1;
    
if(PlayerInfo[playerid][pNumber] == 0)
    {
        
SendClientMessage(playeridCOLOR_GRAD2"  You don't have a cell phone...");
        return 
1;
    }
    if(
PlayerInfo[playerid][pJailTime] > 0)
    {
        
SendClientMessage(playerid,COLOR_GREY,"   You can't use your phone while in jail or prison!");
        return 
1;
    }
    if(
PhoneOnline[playerid] > 0)
    {
        
SendClientMessage(playeridCOLOR_GREY"Your phone is off.");
        return 
1;
    }
    
/*if(PlayerInfo[playerid][pPhoneCredits] < 3)
                return SendClientMessage(playerid, COLOR_YELLOW, "Check Operator...");*/
    
if(Spectating[playerid]==0)
    {
        if(
PlayerInfo[playerid][pMask] == 1) {  format(stringsizeof(string), "* Stranger's takes out a cellphone"); }
        else { 
format(stringsizeof(string), "* %s takes out a cellphone."GetPlayerNameEx(playerid)); }
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    if(
phonenumb == 555)
    {
        
SendClientMessage(playeridCOLOR_GREY"The number you have dialed has not been recognized.");
        return 
1;
    }
    foreach(
Playeri)
    {
        if(
PlayerInfo[i][pNumber] == phonenumb && phonenumb != 0)
        {
            new 
giveplayerid i;
            if(
Mobile[giveplayerid] != INVALID_PLAYER_ID)
            {
                
SendClientMessage(playeridCOLOR_GREY"That player's phone is busy (on a call).");
                return 
1;
            }
            
Mobile[playerid] = giveplayerid//caller connecting
            
if(IsPlayerConnected(giveplayerid)) {
                if(
giveplayerid != INVALID_PLAYER_ID) {
                    if(
PhoneOnline[giveplayerid] > 0) {
                        
SendClientMessage(playeridCOLOR_GREY"That player's phone is switched off.");
                        
Mobile[playerid] = INVALID_PLAYER_ID;
                        return 
1;
                    }
                    if(
PhonePrivacy[playerid] == 1) {
                        
format(stringsizeof(string), "SMS: %s, Sender: Unknown."text,GetPlayerNameEx(playerid),PlayerInfo[playerid][pNumber]);
                    } else {
                        
format(stringsizeof(string), "SMS: %s, Sender: %s (%d)"text,GetPlayerNameEx(playerid),PlayerInfo[playerid][pNumber]);
                    }
                    
SendClientMessage(giveplayeridCOLOR_YELLOWstring);
                    
SendClientMessage(playeridCOLOR_YELLOWstring);
                    
//SendClientMessage(playerid, COLOR_WHITE, "Text Message Delivered");
                    
LastSMS[giveplayerid] = PlayerInfo[playerid][pNumber];
                    
format(stringsizeof(string), "~r~-$2");
                    
GameTextForPlayer(playeridstring50001);
                    
GivePlayerCash(playerid, -2);
                    
//PlayerInfo[playerid][pPhoneCredits] -= 3;
                    
PlayerPlaySound(playerid10520.00.00.0);
                    
Mobile[playerid] = INVALID_PLAYER_ID;
                    return 
1;
                }
            }
        }
    }
    
SendClientMessage(playeridCOLOR_GRAD2"  Message delivery failed...");
    return 
1;


PHP код:
CMD:call(playeridparams[])
{
    new 
string[128], phonenumb;
    if(
sscanf(params"d"phonenumb)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /call [number]");
    
phonenumb strval(params);
    if(
PlayerInfo[playerid][pJailTime] > 0)
    {
        
SendClientMessage(playerid,COLOR_GREY,"You can't use your phone while in jail.");
        return 
1;
    }
    if(
PlayerTied[playerid] != || PlayerCuffed[playerid] != 0)
    {
        
SendClientMessage(playerid,COLOR_GREY,"You can't use your phone whilist restrained.");
        return 
1;
    }
    if(
PlayerInfo[playerid][pNumber] == 0)
    {
        
SendClientMessage(playeridCOLOR_GRAD2"You don't have a cell phone.");
        return 
1;
    }
    if(
PhoneOnline[playerid] > 0)
    {
        
SendClientMessage(playeridCOLOR_GREY"Your phone is off.");
        return 
1;
    }
    
/*if(PlayerInfo[playerid][pPhoneCredits] < 5)
        return SendClientMessage(playerid, COLOR_YELLOW, "Check Operator...");*/
    
if(PlayerInfo[playerid][pMask] == 1) { format(stringsizeof(string), "*Stranger takes out a cellphone."); }
    else { 
format(stringsizeof(string), "* %s takes out a cellphone."GetPlayerNameEx(playerid)); }
    
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    if(
phonenumb == 911)
    {
        if(
PlayerInfo[playerid][pJailed] == || PlayerInfo[playerid][pJailed] == 4)
        {
            
SendClientMessage(playeridCOLOR_WHITE"Can't use this whilst prison!");
            return 
1;
        }
        
SendClientMessage(playeridCOLOR_WHITE"HINT: You now use T to talk on your cellphone, type /hangup to hang up.");
        
SendClientMessage(playeridCOLOR_ALLDEPT"EMERGENCY: Which service do you require, police or paramedic?");
        
Mobile[playerid] = 911;
        
SetPlayerSpecialAction(playeridSPECIAL_ACTION_USECELLPHONE);
        
SetPlayerAttachedObject(playerid93306);
        return 
1;
    }
    if(
phonenumb == PlayerInfo[playerid][pNumber])
    {
        
SendClientMessage(playeridCOLOR_GRAD2"  You just get a busy tone...");
        return 
1;
    }
    if(
Mobile[playerid] != INVALID_PLAYER_ID)
    {
        
SendClientMessage(playeridCOLOR_GRAD2"You're already in a call...");
        return 
1;
    }
    foreach(
Playeri)
    {
        if(
PlayerInfo[i][pNumber] == phonenumb && phonenumb != 0)
        {
            new 
giveplayerid i;
            
Mobile[playerid] = giveplayerid//caller connecting
            
if(IsPlayerConnected(giveplayerid))
            {
                if(
giveplayerid != INVALID_PLAYER_ID)
                {
                    if(
PhoneOnline[giveplayerid] > 0)
                    {
                        
SendClientMessage(playeridCOLOR_GREY"That player's phone is switched off.");
                        
Mobile[playerid] = INVALID_PLAYER_ID;
                        return 
1;
                    }
                    if(
Mobile[giveplayerid] != INVALID_PLAYER_ID)
                    {
                        
SendClientMessage(playeridCOLOR_GRAD2"You just get a busy tone...");
                        
Mobile[playerid] = INVALID_PLAYER_ID;
                        return 
1;
                    }
                    if(
Spectating[giveplayerid]!=0)
                    {
                        
SendClientMessage(playeridCOLOR_GRAD2"You just get a busy tone...");
                        
Mobile[playerid] = INVALID_PLAYER_ID;
                        return 
1;
                    }
                    if(
Mobile[giveplayerid] == INVALID_PLAYER_ID)
                    {
                        
format(stringsizeof(string), "Your mobile is ringing - type /p to answer it. [Caller ID: %s]"GetPlayerNameEx(playerid));
                        
SendClientMessage(giveplayeridCOLOR_YELLOWstring);
                        if(
PlayerInfo[giveplayerid][pMask] == 1) { format(stringsizeof(string), "* Stranger's phone begins to ring."); }
                        else { 
format(stringsizeof(string), "* %s's phone begins to ring."GetPlayerNameEx(i)); }
                        
SendClientMessage(playeridCOLOR_WHITE"HINT: You now use T to talk on your cellphone, type /hangup to hang up.");
                        
ProxDetector(30.0istringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        
CellTime[playerid] = 1;
                        
SetPlayerSpecialAction(playeridSPECIAL_ACTION_USECELLPHONE);
                        
SetPlayerAttachedObject(playerid93306);
                        return 
1;
                    }
                }
            }
        }
    }
    
SendClientMessage(playeridCOLOR_GRAD2"Your call can't be completed as dialed, please check the number and try again.");
    return 
1;

And...


PHP код:
CMD:h(playerid,params[])
{
    new 
string[128];
    if(
GetPVarInt(playerid"Injured") != 0||PlayerCuffed[playerid]!=0||GetPVarInt(playerid"Hospital")!=0)
    {
        
SendClientMessage (playeridCOLOR_GRAD2"You can't do this at this time.");
        return 
1;
    }
    new 
caller Mobile[playerid];
    if((
IsPlayerConnected(caller) && caller != INVALID_PLAYER_ID)|| caller == 911 || caller == 912 || caller == 913 || caller == 914)
    {
        if(
caller 500)
        {
            
SendClientMessage(caller,  COLOR_GRAD2"   They hung up.");
            if(
PlayerInfo[playerid][pMask] == 1) {  format(stringsizeof(string), "* Stranger's puts away their cellphone."); }
            else { 
format(stringsizeof(string), "* %s puts away their cellphone."GetPlayerNameEx(caller)); }
            
ProxDetector(30.0callerstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
CellTime[caller] = 0;
            
Mobile[caller] = INVALID_PLAYER_ID;
        }
        
CellTime[playerid] = 0;
        
SendClientMessage(playerid,  COLOR_GRAD2"   You hung up.");
        if(
PlayerInfo[playerid][pMask] == 1) {  format(stringsizeof(string), "* Stranger's puts away their cellphone"); }
            else { 
format(stringsizeof(string), "* %s puts away their cellphone"GetPlayerNameEx(playerid)); }
        
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        
Mobile[playerid] = INVALID_PLAYER_ID;
        
CellTime[playerid] = 0;
        
SetPlayerSpecialAction(callerSPECIAL_ACTION_STOPUSECELLPHONE);
        
RemovePlayerAttachedObject(caller9);
        
SetPlayerSpecialAction(playeridSPECIAL_ACTION_STOPUSECELLPHONE);
        
RemovePlayerAttachedObject(playerid9);
        return 
1;
    }
    
SendClientMessage(playerid,  COLOR_GRAD2"   Your phone is in your pocket.");
    return 
1;
}
CMD:number(playeridparams[]) {
    if(
PlayerInfo[playerid][pPhoneBook] == 1) {
        new
            
iTarget;
        if(
sscanf(params"u"iTarget)) {
            
SendClientMessage(playeridCOLOR_WHITE"USAGE: /number [playerid/partofname]");
        }
        else if(
IsPlayerConnected(iTarget)) {
            new
                
szNumber[16 MAX_PLAYER_NAME];
            
format(szNumbersizeof(szNumber), "* %s (%i)"GetPlayerNameEx(iTarget), PlayerInfo[iTarget][pNumber]);
            
SendClientMessage(playeridCOLOR_GRAD1szNumber);
        }
        else 
SendClientMessage(playeridCOLOR_GRAD1"Invalid player specified.");
    }
    else 
SendClientMessage(playeridCOLOR_GRAD1"You don't have a phone book.");
    return 
1;

Reply
#3

I mean with dialogs, not just commands.
Reply
#4

Quote:
Originally Posted by Gazzy
Посмотреть сообщение
I mean with dialogs, not just commands.
Create it yourself, this is not a request section and you should be thankful that the guy gave you the code, you should use it as a reference to create your dialogs.
Reply
#5

Quote:
Originally Posted by Gazzy
Посмотреть сообщение
Hey guys. I was wondering how I could make an SMS system with dialogs.
Does it look like I requested the code from anyone? I wanted someone to tell me how to make it. If you're not going to be helpful don't bother replying to threads in the "Scripting Help" section of the forums.
Reply
#6

Quote:
Originally Posted by DarkLored
Посмотреть сообщение
Create it yourself, this is not a request section and you should be thankful that the guy gave you the code, you should use it as a reference to create your dialogs.
Quote:
Originally Posted by Gazzy
Посмотреть сообщение
Does it look like I requested the code from anyone? I wanted someone to tell me how to make it. If you're not going to be helpful don't bother replying to threads in the "Scripting Help" section of the forums.
You should atleast show us some respect because we are trying to help you , I agree of what @DarkLored said because we cant just guess your idea and create it for you.

((I repped you DarkLored))
Reply
#7

I actually agree with @Gazzy He never requested a code/cmd lol, he just asked how to create a SMS DIALOG.
Reply
#8

http://lmgtfy.com/?q=SAMP+SMS+system
http://lmgtfy.com/?q=samp+create+dialog

Reply
#9

Quote:
Originally Posted by Gazzy
Посмотреть сообщение
Does it look like I requested the code from anyone? I wanted someone to tell me how to make it. If you're not going to be helpful don't bother replying to threads in the "Scripting Help" section of the forums.
Okay let me be of some use and explain how it works.

You need to create an INPUT dialog and check if the number that was used matches an existing number, then show the player another Input dialog which he will be able to message the other player's phone. All of this must be linked to some sort of saving system to identify and match the numbers of different players.

You're job is to provide some code to begin with and we are not supposed to be the ones to provide it for you, just because you didn't say 'I want you to make this code for me' does not mean there's no indirect way to ask for one, so if you want to properly use this section at least try to create it first and if you have any problems compiling it share it with us and we'll help you. Please do some research before asking questions.
Reply
#10

He never requested a code.... he just asked how to create a SMS DIALOG
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)