Message problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Message problem (
/showthread.php?tid=435637)
Message problem -
lsreskjn - 07.05.2013
Код:
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:
Re: Message problem -
RevolutionaryGaming - 07.05.2013
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.
Re: Message problem -
mineralo - 07.05.2013
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
}
Re: Message problem -
Red_Dragon. - 07.05.2013
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;
}