SA-MP Forums Archive
samp /pm command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: samp /pm command (/showthread.php?tid=534216)



samp /pm command - TheNerka - 28.08.2014

hello, anyone have /pm command?

need: /pm <phone_number> <text>

example /pm 18454844 <hello>

my phone number enum:

PlayerData[playerid][Numeris]


Re: samp /pm command - Abagail - 28.08.2014

You want to /pm people by phone number? You mean SMS, or am I just lost... ?


Re: samp /pm command - TheNerka - 28.08.2014

yes sms /sms <phone_number> <text>


Re: samp /pm command - TheNerka - 29.08.2014

bump


Re: samp /pm command - Ox1gEN - 29.08.2014

You first have to work on a phone system that generates phone numbers for each player and saves it.
Then you create a variable to check if a player has a phone by fetching it from your library.
And if the player has a phone it'll call a certain number and if the number that the player entered is incorrect just respond to the player by saying that the phone number is invalid/incorrect.


Re: samp /pm command - TheNerka - 29.08.2014

i have phone number system with random numbers


Re: samp /pm command - AroseKhanNiazi - 29.08.2014

lol the random numbers we can't do anything about it


Re: samp /pm command - Ox1gEN - 29.08.2014

Well it is supposed to look something like this:

Код:
CMD:sms(playerid, params[])
{
	new string[128], text[128], number[50];
	if(sscanf(params, "ss[50]", number, text)) return SendClientMessage(playerid, -1, "USAGE: /SMS [Number] [Text]");
	else
	{	
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(!strcmp(number, pInfo[i][Number]))
			{
				format(string, sizeof(string), "SMS Sent to %s: %s", GetName(i), text);
				SendClientMessage(playerid, -1, string);

				format(string, sizeof(string), "SMS From %s: %s", GetName(playerid), text);
				SendClientMessage(i, -1, string);
			}
			else
			{
				SendClientMessage(playerid, -1, "**BEEP** It seems that number doesn't exist **BEEP**");
			}
		}

	}
	return 1;
}
It wasn't tested because I don't have a phone system on my script therefore it is UNTESTED anyways, MAKE SURE to replace if(!strcmp(number, pInfo[i][Number])) with YOUR variable that is used to fetch the targets number.

I hope this works and helped you.


Re: samp /pm command - TheNerka - 29.08.2014

Quote:
Originally Posted by Ox1gEN
Посмотреть сообщение
Well it is supposed to look something like this:

Код:
CMD:sms(playerid, params[])
{
	new string[128], text[128], number[50];
	if(sscanf(params, "ss[50]", number, text)) return SendClientMessage(playerid, -1, "USAGE: /SMS [Number] [Text]");
	else
	{	
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(!strcmp(number, pInfo[i][Number]))
			{
				format(string, sizeof(string), "SMS Sent to %s: %s", GetName(i), text);
				SendClientMessage(playerid, -1, string);

				format(string, sizeof(string), "SMS From %s: %s", GetName(playerid), text);
				SendClientMessage(i, -1, string);
			}
			else
			{
				SendClientMessage(playerid, -1, "**BEEP** It seems that number doesn't exist **BEEP**");
			}
		}

	}
	return 1;
}
It wasn't tested because I don't have a phone system on my script therefore it is UNTESTED anyways, MAKE SURE to replace if(!strcmp(number, pInfo[i][Number])) with YOUR variable that is used to fetch the targets number.

I hope this works and helped you.
error 017: undefined symbol "GetName"
error 017: undefined symbol "GetName"

Idk how to script stock GetName(i)


Re: samp /pm command - Thogy - 29.08.2014

pawn Код:
CMD:sms(playerid, params[])
{
    new text[128], number;
    if(sscanf(params, "iz", number, text)) return SendClientMessage(playerid, -1, "USAGE: /SMS [Number] [Text]");
    else
    {  
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(!strcmp(number, PlayerData[i][Numeris]))
            {
                                new string[128];
                format(string, sizeof(string), "SMS Sent to %s: %s", GetName(i), text);
                SendClientMessage(playerid, -1, string);

                format(string, sizeof(string), "SMS From %s: %s", GetName(playerid), text);
                SendClientMessage(i, -1, string);
            }
            else
            {
                SendClientMessage(playerid, -1, "**BEEP** It seems that number doesn't exist **BEEP**");
            }
        }

    }
    return 1;
}

stock GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
return name;
}