Erro at OnPlayerText
#1

[pwn] if(PlayerInfo[playerid][pAccountMailSendText] == 1 && PlayerInfo[playerid][pAccountMailConnect] == 1 && PlayerInfo[playerid][pAccountMailSendTextLine] == 0)
{
// new nstring[256];
new idx;
new length = strlen(text);
while ((idx < length) && (text[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = text[idx];
idx++;
}
result[idx - offset] = EOS;
PlayerInfo[playerid][pAccountMailSendTextLine] = 1;
PlayerInfo[playerid][pMailSendTextLine1] = result;
return 1;
}[/pwn]

I get an Error:

must be assigned to an array

PlayerInfo[layerid][pMailSendTextLine1] = result;

Whats wrong? I want to get, what the player is writen at this time at OnPlayerText.
Reply
#2

You are assigning a string to an integer.

Also, to get the chat which a player has written, just use the symbol 'text'
Reply
#3

Like this?

PlayerInfo[playerid][pMailSendTextLine1] = text;
Reply
#4

Or what, pls explain.
Reply
#5

pawn Код:
enum YourEnum
{
    pMailSendTextLine1[128],
    other stuff...
};

new PlayerInfo[MAX_PLAYERS][YourEnum];

public OnPlayerText(playerid, text)
{
  PlayerInfo[playerid][pMailSendTextLine1] = text;
  return 1;
}
Reply
#6

array sizes do not match, or destination array is too small

same line.
Reply
#7

I have fixxed, it so,

PlayerInfo[playerid][pMaiLSendTextLine2] = text[idx];
Reply
#8

Use the "Modify" button next time.
Reply
#9

tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /emails [playerid/PartOfName] [text]");
return 1;
}
new Ereceiver;
Ereceiver = ReturnUser(tmp);
if(Ereceiver != INVALID_PLAYER_ID)
{
PlayerInfo[playerid][pAccountMailSendTextCreate] = 1;
PlayerInfo[playerid][pMailReceiver] = Ereceiver;

is this right to save the ID of the "receiver"?
Yes, if the ID left it wont work, but if the two (playerid, ereceiver are online.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)