Message is only sending to ID 0
#8

pawn Код:
CMD:sms(playerid, params[])
{
    if(PlayerInfo[playerid][Phone] == phone_yes)
    {
        if(phoneon[playerid] == false) return SendClientMessage(playerid, COLOR_GREY, "You have your phone turned off!");
        new text[128], pnumber;
        if(sscanf(params, "is[128]", pnumber, text)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /sms [Phone Number] [SMS text]");
       
        new pID, count=0; //Lets create a variable to store who has the phone number
        foreach(Player, i)
        {
            if(PlayerInfo[i][Phone] == phone_yes)
            {
                if(PlayerInfo[i][PhoneNumber] == pnumber)
                {
                    i = pID; //We check who has it, then we save them into pID
                    count++;
                }
            }
        }
        if(count == 0) return SendClientMessage(playerid, COLOR_GREY, "Phone number not found!");
        if(pID != playerid) //Check if the one who has it is the same person who typed the command
        {
            if(phoneon[pID] == false) return SendClientMessage(playerid, COLOR_GREY, "This player has their phone turned off!"); //their = possesive him/her
            new string[265], pnumber2;
            pnumber2 = PlayerInfo[playerid][PhoneNumber];
           
            format(string, sizeof(string), "[SMS]%i: %s.", pnumber2, text);
            SendClientMessage(pID, TEAM_RADIO_COLOR, string);
           
            format(string, sizeof(string), "You've sent a text message to %i", pnumber); //We can format the same string twice instead of creating a new one
            SendClientMessage(playerid, TEAM_RADIO_COLOR, string2);
           
            PlayerPlaySound(pID,1085,0.0,0.0,0.0);
            return 1;
        }
    }
    else return SendClientMessage(playerid, COLOR_GREY, "You don't have a phone!");
   
    return 1;
}
Hmm, maybe this one will work
Reply


Messages In This Thread
Message is only sending to ID 0 - by milanosie - 20.01.2012, 09:58
Re: Message is only sending to ID 0 - by Unte99 - 20.01.2012, 10:38
Re: Message is only sending to ID 0 - by milanosie - 20.01.2012, 10:49
Re: Message is only sending to ID 0 - by Vince - 20.01.2012, 10:49
Re: Message is only sending to ID 0 - by milanosie - 20.01.2012, 10:53
Re: Message is only sending to ID 0 - by milanosie - 20.01.2012, 13:05
Re: Message is only sending to ID 0 - by milanosie - 20.01.2012, 15:19
Re: Message is only sending to ID 0 - by [ABK]Antonio - 20.01.2012, 16:09
Re: Message is only sending to ID 0 - by Eric - 20.01.2012, 16:13
Re: Message is only sending to ID 0 - by Michael@Belgium - 20.01.2012, 16:24

Forum Jump:


Users browsing this thread: 4 Guest(s)