SA-MP Forums Archive
Need help with /sms - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help with /sms (/showthread.php?tid=242565)



Need help with /sms - GBLTeam - 20.03.2011

So i want to add AdmimMessage when he type /sms number text that message which he send to other man to be posted on admins...

Something like this, but idk where to add i tryed but nothing.
pawn Код:
format(string, sizeof(string), "%s",  result);
            SendAdminMessage(COLOR_RED,string);
pawn Код:
if(strcmp(cmd, "/txt", true) == 0 || strcmp(cmd, "/t", true) == 0 || strcmp(cmd, "/sms", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new playercash;
            playercash = GetPlayerMoney(playerid);
            if (playercash < 2)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Nemate dovoljno novca na racunu!");
                return 1;
            }
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "  You are not logged!");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Use: (/t)ext [phonenumber] [text chat]");
                return 1;
            }
            if(PlayerInfo[playerid][pPnumber] == 0)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "  You dont have a phone...");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s get phone.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            new phonenumb = strval(tmp);
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Use: (/t)ext [phonenumber] [text chat]");
                return 1;
            }
            if(phonenumb == 555)
            {
                if ((strcmp("yes", result, true, strlen(result)) == 0) && (strlen(result) == strlen("yes")))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "SMS Message sended.");
                    if (gTeam[playerid] == 2 || gTeam[playerid] == 1)
                    {
                        SendClientMessage(playerid, COLOR_YELLOW, "SMS: What are talking, Sender: MOLE (555)");
                        RingTone[playerid] = 20;
                        return 1;
                    }
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_YELLOW, "SMS: Have a nice day, Sender: MOLE (555)");
                    RingTone[playerid] = 20;
                    return 1;
                }
            }
            foreach (Player, i)
            {
                    if(PlayerInfo[i][pPnumber] == phonenumb && phonenumb != 0)
                    {
                        giveplayerid = i;
                        Mobile[playerid] = giveplayerid; //caller connecting
                        if(IsPlayerConnected(giveplayerid))
                        {
                            if(giveplayerid != INVALID_PLAYER_ID)
                            {
                                if(PhoneOnline[giveplayerid] > 0)
                                {
                                    SendClientMessage(playerid, COLOR_GREY, "   Player is offline!");
                                    return 1;
                                }
                                format(string, sizeof(string), "SMS: %s, Salje: %s (%d)", result,sendername,PlayerInfo[playerid][pPnumber]);
                                GetPlayerName(giveplayerid, sendername, sizeof(sendername));
                                //format(string, sizeof(string), "* %s's phone beeps.", sendername);
                                RingTone[giveplayerid] =20;
                                SendClientMessage(playerid, COLOR_WHITE, "Message sended");
                                SendClientMessage(giveplayerid, COLOR_YELLOW, string);
                                SendClientMessage(playerid,  COLOR_YELLOW, string);
                                format(string, sizeof(string), "~r~$-%d", txtcost);
                                GameTextForPlayer(playerid, string, 5000, 1);
                                SafeGivePlayerMoney(playerid,-txtcost);
                                SBizzInfo[2][sbTill] += txtcost;
                                ExtortionSBiz(2, txtcost);
                                PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                                Mobile[playerid] = 255;
                                return 1;
                        }
                    }
                }
            }
            SendClientMessage(playerid, COLOR_GRAD2, "  Message failed...");
        }
        return 1;
    }



Re: Need help with /sms - Jochemd - 20.03.2011

When you send, just loop through everyone and check if 'i' is admin. If yes, send message to.

So just at the same position as where you send the SMS.


Re: Need help with /sms - GBLTeam - 20.03.2011

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
When you send, just loop through everyone and check if 'i' is admin. If yes, send message to.

So just at the same position as where you send the SMS.
Can you add that and give me example?


Re: Need help with /sms - Ihsan-Cingisiz - 20.03.2011

Quote:
Originally Posted by GBLTeam
Посмотреть сообщение
Can you add that and give me example?
Код:
for(new i=0; i<MAX_PLAYERS; 1++)
{
     if(IsPlayerAdmin(i))
     {
          SendClientMessage(i, 0xFFFFFFFF, str);
     }
}
Here you go.


Re: Need help with /sms - Jochemd - 20.03.2011

pawn Код:
for(new i=0; i<MAX_PLAYERS; 1++)
{
     if(IsPlayerConnected(i))
     {
          if(IsPlayerAdmin(i))
          {
               SendClientMessage(i, 0xFFFFFFFF, str);
          }
     }
}
Always check if he is connected


Re: Need help with /sms - bigcomfycouch - 20.03.2011

Certainly IsPlayerAdmin won't return 1 if the player is not connected?