Message is only sending to ID 0
#4

I hate this kind of layout :/ It's so easy to lose your bearings in it. Try this one instead, I restructured it.

pawn Код:
CMD:sms(playerid, params[])
{
    if(PlayerInfo[playerid][Phone] != phone_yes)
        return SendClientMessage(playerid, COLOR_GREY, "You don't have a phone!");
       
    if(phoneon[playerid] == false)
        return SendClientMessage(playerid, COLOR_GREY, "You have your phone turned off!");
       
    new
        text[128], //<-----  NIET VERGETEN OM STRING SIZE TO DOEN VOOR EEN TEXT OF %S INPUT!!!
        pnumber;
       
    if(sscanf(params, "is[128]", pnumber, text)) //String size for text.. NIET VERGETEN ANDERS CRASHED ALLES
        return SendClientMessage(playerid, COLOR_GREY, "USAGE: /sms [Phone Number] [SMS text]");
       
    if(PlayerInfo[playerid][PhoneNumber] == pnumber)
        return SendClientMessage(playerid, COLOR_GREY, "You cannot send a message to yourself!");
       
    foreach(Player, i)
    {
        if(PlayerInfo[i][Phone] != phone_yes)
            continue;

        if(PlayerInfo[i][PhoneNumber] != pnumber)
            continue;

        if(!phoneon[i])
            return SendClientMessage(playerid, COLOR_GREY, "This player has his/her phone turned off!");

        new string[144];

        format(string, sizeof(string), "[SMS]%i: %s.", PlayerInfo[playerid][PhoneNumber], text);
        SendClientMessage(i, TEAM_RADIO_COLOR, string);

        format(string, sizeof(string), "You just sent a text message to %i", pnumber);
        SendClientMessage(playerid, TEAM_RADIO_COLOR, string);
       
        PlayerPlaySound(i,1085,0.0,0.0,0.0);
        return 1;
    }
   
    SendClientMessage(playerid, COLOR_GREY, "No such number!");
    return 1;
}
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: 1 Guest(s)