CMD:sms
#1

Hi, I tried to duplicate /pm command as the /sms, but I want to eliminate playerid with "number"


PHP код:
CMD:sms(playerid,params[])
{
if(
PlayerHasItem(playerid,"iPhone"))
    {
    new 
targetid,smsstring[257],string[128],str2[256];
     if(
sscanf(params,"us[257]"targetidsmsstring)) return SendClientMessage(playerid,-1,"*"COL_GREEN" /sms [number] [message]");
    if(
pInfo[playerid][pLogged] == 1)
    {
            if(
pInfo[targetid][pPhone] == 0)
            {
                
format(string,sizeof(string),"*"COL_PMRECEIVER" [SMS] %i: %s",pInfo[playerid][number],smsstring);
                
SendClientMessage(targetid,-1,string);
                
format(str2,sizeof(str2),"*"COL_PMSEND" [SMS] %i: %s",pInfo[targetid][number], smsstring);
                
SendClientMessage(playerid,-1,str2);
            }
            else {
                
SendClientMessage(playerid,-1,"*"COL_RED" This number has phone shut");
            }
        }
        }
return 
1;

Should my code look like this?

PHP код:
CMD:sms(number,params[])
{
if(
PlayerHasItem(playerid,"iPhone"))
    {
    new 
playeridtargetid,smsstring[257],string[128],str2[256];
     if(
sscanf(params,"us[257]"targetidsmsstring)) return SendClientMessage(playerid,-1,"*"COL_GREEN" /sms [number] [message]");
    if(
pInfo[playerid][pLogged] == 1)
    {
            if(
pInfo[targetid][pPhone] == 0)
            {
                
format(string,sizeof(string),"*"COL_PMRECEIVER" [SMS] %i: %s",pInfo[targetid][number],smsstring);
                
SendClientMessage(targetid,-1,string);
                
format(str2,sizeof(str2),"*"COL_PMSEND" [SMS] %i: %s",pInfo[playerid][number], smsstring);
                
SendClientMessage(playerid,-1,str2);
            }
            else {
                
SendClientMessage(playerid,-1,"*"COL_RED" This number has phone shut");
            }
        }
        }
return 
1;

And how can I check if typed phone number exists (as pm's this player is offline)
Reply


Messages In This Thread
CMD:sms - by Zeus666 - 21.04.2018, 09:09
Re: CMD:sms - by std - 21.04.2018, 14:30
Re: CMD:sms - by JesterlJoker - 21.04.2018, 17:21
Re: CMD:sms - by Zeus666 - 21.04.2018, 17:46
Re: CMD:sms - by JesterlJoker - 21.04.2018, 17:51
Re: CMD:sms - by Zeus666 - 21.04.2018, 17:55
Re: CMD:sms - by JesterlJoker - 21.04.2018, 17:59
Re: CMD:sms - by Zeus666 - 21.04.2018, 18:11
Re: CMD:sms - by ItsRobinson - 21.04.2018, 18:15
Re: CMD:sms - by Zeus666 - 21.04.2018, 18:19

Forum Jump:


Users browsing this thread: 3 Guest(s)