Message problem
#1

Код:
public OnPlayerText(playerid, text[])
{
	if (strfind(text, "Ako sa mas??") != -1)
	SendPlayerMessageToAll(playerid, "Mбm sa skvelo, a ty?");
	return 1;
}
This my code, what it does? if player type Ako sa mas?? the server will respond Mбm sa skvelo, a ty?..

The problem is..when player type the sentence, the server message is first and i dont know why

heres the screen:

Reply
#2

I believe if you return 0 the original text will not be sent. Change return 1; to return 0;

I'm sorry if this isn't what you were asking for, but I'm having trouble understanding you.
Reply
#3

the message its sends before player wrote, there are 2 ways to fix it, or timer or own send of message
timer
pawn Код:
public OnPlayerText(playerid, text[])
{
    if (strfind(text, "Ako sa mas??") != -1)
    SetTimerEx("Mess",500,false,"i",playerid);//0.5 sencod, if not enough increase it
    return 1;
}
forward Mess(id);
public Mess(id)
{
SendPlayerMessageToAll(playerid, "Mбm sa skvelo, a ty?");
return 1;
}
or own send
pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[256],name[25];
    GetPlayerName(playerid,name,25);
    format(string,256,"%s: %s",name,text);
    SendClientMessageToAll(GetPlayerColor(playerid),string);
    if (strfind(text, "Ako sa mas??") != -1)
    SendPlayerMessageToAll(playerid, "Mбm sa skvelo, a ty?");
    return 0;//if is zero then player message won't send as defaul
}
Reply
#4

Try this one
pawn Код:
public OnPlayerText(playerid, text[])
{
    if (strfind(text, "Ako sa mas??") != -1)
    SendPlayerMessageToAll(playerid, "Mбm sa skvelo, a ty?");
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)