/sms command not working.
#10

People please. I really need help. The problem is, that a variable is always 0. That variable is "id".

Check this out, the current command:
pawn Код:
if(strcmp("/sms", cmd, true) == 0)
    {
    if(PlayerInfo[playerid][pPhone] >= 1)
    {
        tmp = strtok(cmdtext,idx);

        if(!strlen(tmp))
        {
            SendClientMessage(playerid,COLOR_WHITE,"Usage: /sms [number] [message]");
        }
        new id;
        new gMessage[256];
        new Message[256];
        new pName[MAX_PLAYER_NAME+1];
       
        new number;
        number = PlayerInfo[playerid][pNr];

        gMessage = strrest(cmdtext,idx);

        if(!strlen(gMessage))
        {
            SendClientMessage(playerid,COLOR_WHITE,"Usage: /sms [number] [message]");
        }

        if(PlayerInfo[id][pNr] == strval(tmp))
        {
            GetPlayerName(playerid,pName,sizeof(pName));
            format(Message,sizeof(Message),"%s(%d): %s",pName,number,gMessage);
            SendClientMessage(id,COLOR_YELLOW,Message);
            PlayerPlaySound(id,1085,0.0,0.0,0.0);
        }
    }
    else
    {
    SendClientMessage(playerid, COLOR_WHITE, "You don't have a cellphone. Buy one at any 24/7 store.");
    }
    }
You see these lines?
pawn Код:
new id;

//and

if(PlayerInfo[id][pNr] == strval(tmp))
The variable "id" is always 0. I need the server to scroll through phone numbers and get the id of a player that has the phone number typed in and send the message to the player.
Reply


Messages In This Thread
/sms command not working. - by Gytis0 - 16.06.2012, 22:52
Re: /sms command not working. - by mickos - 16.06.2012, 23:14
Re: /sms command not working. - by [NWA]Hannes - 16.06.2012, 23:17
Re: /sms command not working. - by Gytis0 - 16.06.2012, 23:53
Re: /sms command not working. - by Gytis0 - 19.06.2012, 16:46
Re: /sms command not working. - by Revo - 19.06.2012, 16:53
Re: /sms command not working. - by Gytis0 - 19.06.2012, 22:04
Re: /sms command not working. - by Gytis0 - 22.06.2012, 10:07
Re: /sms command not working. - by nilanjay - 22.06.2012, 10:13
Re: /sms command not working. - by Gytis0 - 27.06.2012, 17:59

Forum Jump:


Users browsing this thread: 1 Guest(s)