String problem
#1

So I'm making a voicemail, so whenever a player calls somebody the other player can leave a message. Then the other player can do /voicemail to check what somebody left.
But there's one problem: when I leave a message and do /voicemail the message doesn't show.

Code:

Under OnPlayerText

Код:
   	if(IsInVoicemail[playerid] == true)
	{
	    new msg[100];
		new pID = CalledABy[playerid];
	    format(msg,sizeof(msg),"(Cellphone) %s says: %s", GetName(playerid), text);
	    ProxDetector(5.0, playerid, msg, COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
	    format(msg,sizeof(msg),"%s", text);
	    Msg1Written[pID] = 1;
		Msg1[pID] = msg;
	}
CMD:

pawn Код:
CMD:voicemail(playerid)
{
    if(PlayerInfo[playerid][pPhone] <= 0) return SendClientMessage(playerid, COLOR_GRAD2, "You don't have a phone!");
    {
        new pID = CalledBy[playerid];
        new string[150];
        format(string,sizeof(string),"You have %d unread messages.", Msg1Written[playerid]);
        SendClientMessage(playerid, COLOR_GREEN, "Welcome to your voicemail!");
        SendClientMessage(playerid, COLOR_YELLOW, string);
       
        if(Msg1Written[playerid] == 1)
        {
            new str[150];
            SendClientMessage(playerid, COLOR_YELLOW, "___MESSAGE 1___");
            format(str,sizeof(str),"Sender (Number): %d",GetPlayerNumber(pID));
            SendClientMessage(playerid, COLOR_YELLOW, str);
            format(str,sizeof(str),Msg1[playerid]);
            SendClientMessage(playerid, COLOR_YELLOW, str);
        }
    }
    return 1;
}
I've tried to replace this:

pawn Код:
format(str,sizeof(str),Msg1[playerid]);
with this:

pawn Код:
format(str,sizeof(str),"%s", Msg1[playerid]);
Didn't work. I've also tried this:

pawn Код:
SendClientMessage(playerid, COLOR_YELLOW, Msg1[playerinfo]);
But that didn't work either. Any help?
Reply
#2

Whats your line to get players mail?
Reply
#3

I don't really know what you mean, but I guess you need this:

The line that should send the voicemail message:

pawn Код:
format(str,sizeof(str),Msg1[playerid]);
            SendClientMessage(playerid, COLOR_YELLOW, str);
And here is what Msg1[playerid] stores:

pawn Код:
format(msg,sizeof(msg),"%s", text);
        Msg1[pID] = msg;
Reply
#4

Can somebody help me out here?
Reply
#5

have you tried strmid(Msg1[pID],msg,0,strlen(msg),255); ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)