SA-MP Forums Archive
Stopping player text? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Stopping player text? (/showthread.php?tid=102884)



Stopping player text? - gemadon - 17.10.2009

Okay, when a player types something, I want it to come out as "Kenji_Jackson Says: Whatever"

When I try, it displays both . . "Kenji_Jackson: Whatever and Kenji_Jackson Says: Whatever"

I tried returning 0, but then I get an error , it cannot reach the code .

How do I make it so it does not show player text?


Re: Stopping player text? - Peter_Corneile - 17.10.2009

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[256];
    GetPlayerName(playerid,sendername,sizeof(sendername));
    format(string, sizeof(string), "%s says: %s", sendername, text);
    GameTextForAll(string,3000,1);
    return 0;
   
}
And i dont think it is possible to remove chat in SAMP (correct me if i am wrong)


Re: Stopping player text? - Karlip - 17.10.2009

Quote:
Originally Posted by ►Peter Corneile◄ [hugu-hosting.co.uk
]
pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[256];
    GetPlayerName(playerid,sendername,sizeof(sendername));
    format(string, sizeof(string), "%s says: %s", sendername, text);
    GameTextForAll(string,3000,1);
    return 0;
   
}
Thanks for the errors you gave him?

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[256];
new sendername[MAX_PLAYERS];

    GetPlayerName(playerid,sendername,sizeof(sendername));
    format(string, sizeof(string), "%s says: %s", sendername, text);
    SendClientMessageToAlll(COLOR HERE,string);
    return 0;
   
}



Re: Stopping player text? - dice7 - 17.10.2009

returning 0 in OnPlayerText prevents the text from getting shown


Re: Stopping player text? - Sergei - 17.10.2009

You original problem was only that you did 'return 0' before end of your code. Return means that function is terminated at that time, so nothing after that is being executed; that's why you got a warning for unreachable code.


Re: Stopping player text? - gemadon - 18.10.2009

Quote:
Originally Posted by Karlip
Quote:
Originally Posted by ►Peter Corneile◄ [hugu-hosting.co.uk
]
pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[256];
    GetPlayerName(playerid,sendername,sizeof(sendername));
    format(string, sizeof(string), "%s says: %s", sendername, text);
    GameTextForAll(string,3000,1);
    return 0;
   
}
Thanks for the errors you gave him?

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[256];
new sendername[MAX_PLAYERS];

    GetPlayerName(playerid,sendername,sizeof(sendername));
    format(string, sizeof(string), "%s says: %s", sendername, text);
    SendClientMessageToAlll(COLOR HERE,string);
    return 0;
   
}
Yes, I know how to make the "%s Says: %s" But the thing is, it still shows "Kenji_Rivera: Hi" Then under that "Kenji_Rivera Says: Hi"

Its showing two texts, how do I delete the one that automatically comes up?


Re: Stopping player text? - Sergei - 18.10.2009

Quote:
Originally Posted by gemadon
Yes, I know how to make the "%s Says: %s" But the thing is, it still shows "Kenji_Rivera: Hi" Then under that "Kenji_Rivera Says: Hi"

Its showing two texts, how do I delete the one that automatically comes up?
https://sampwiki.blast.hk/wiki/OnPlayerText
Quote:

Returns 0 - Don't display the text the player typed.
Returns 1 - Display the text the player typed.




Re: Stopping player text? - gemadon - 18.10.2009

Quote:
Originally Posted by $ЂЯĢ
Quote:
Originally Posted by gemadon
Yes, I know how to make the "%s Says: %s" But the thing is, it still shows "Kenji_Rivera: Hi" Then under that "Kenji_Rivera Says: Hi"

Its showing two texts, how do I delete the one that automatically comes up?
https://sampwiki.blast.hk/wiki/OnPlayerText
Quote:

Returns 0 - Don't display the text the player typed.
Returns 1 - Display the text the player typed.

I put:

Код:
public OnPlayerText(playerid, text[])
{
	new string[256];
	new str[256];
	new sendername[MAX_PLAYERS];
	{
	return 1;
	GetPlayerName(playerid,sendername,sizeof(sendername));
	format(string, sizeof(string), "%s Says: %s", GetPlayerNameEx(playerid), text);
	ProxDetector(20.0, playerid, str, COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
	return 0;
	}
Yet I get:

Код:
C:\DOCUME~1\Jermaine\MYDOCU~1\RC-10\GAMEMO~1\ORP.pwn(1303) : warning 225: unreachable code
C:\DOCUME~1\Jermaine\MYDOCU~1\RC-10\GAMEMO~1\ORP.pwn(1308) : warning 225: unreachable code
C:\DOCUME~1\Jermaine\MYDOCU~1\RC-10\GAMEMO~1\ORP.pwn(368) : warning 204: symbol is assigned a value that is never used: "GCEnter"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.



Re: Stopping player text? - Donny_k - 19.10.2009

Wrong :

pawn Код:
function
{ //open the function scope
  { //opens a scope from nothing
  return //exit
  return //exit
} //close the previously opened scope ( the nothing one )
Right :

pawn Код:
function
{ //open the function scope
  return //exit
}//close the function scope



Re: Stopping player text? - gemadon - 19.10.2009

Quote:
Originally Posted by Donny
Wrong :

pawn Код:
function
{ //open the function scope
  { //opens a scope from nothing
  return //exit
  return //exit
} //close the previously opened scope ( the nothing one )
Right :

pawn Код:
function
{ //open the function scope
  return //exit
}//close the function scope
Still, doing that, it does not work, I get the same warnings . =|