Stopping player text?
#1

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?
Reply
#2

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)
Reply
#3

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;
   
}
Reply
#4

returning 0 in OnPlayerText prevents the text from getting shown
Reply
#5

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.
Reply
#6

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?
Reply
#7

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.

Reply
#8

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.
Reply
#9

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
Reply
#10

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 . =|
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)