OnPlayerText
#1

So this is my code for OnPlayerText and whenever I do a text in game it works but it also sends the defualt code undernearth, script;

Код:
public OnPlayerText(playerid, text[])
{
		new textv2[128], name[MAX_PLAYER_NAME];
	    GetPlayerName(playerid, name, sizeof (name));
        if(PlayerMuted[playerid] == 1) {
                GameTextForPlayer(playerid,"~n~~r~ERROR:~n~~y~You are muted!", 1000, 1);
                return 0;
        }
        else
        {
			format(textv2, sizeof (textv2), "%s[%d]: %s", name, playerid, text);
			SendPlayerMessageToAll(playerid, textv2);
			return 1;
		}
  		return 1;
}
Reply
#2

Just do this
pawn Код:
public OnPlayerText(playerid, text[])
{
    new textv2[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof (name));
    if(PlayerMuted[playerid] == 1) {
    GameTextForPlayer(playerid,"~n~~r~ERROR:~n~~y~You are muted!", 1000, 1);
    return 0;
}
return 1;
}
Reply
#3

What about this? I still get the same sort of problem, the words just come AFTER your name not UNDER, like this;

Код:
 
Now - Socan: Socan[0]:Test

Before -Socan:Socan[0]:Test
          Socan:Test
Heres the code so far;
Код:
public OnPlayerText(playerid, text[])
{
		new textv2[128], name[MAX_PLAYER_NAME];
	    GetPlayerName(playerid, name, sizeof (name));
        if(PlayerMuted[playerid] == 1) {
                GameTextForPlayer(playerid,"~n~~r~ERROR:~n~~y~You are muted!", 1000, 1);
                return 0;
        }
       
      	format(textv2, sizeof (textv2), "%s[%d]: %s", name, playerid, text);
		SendPlayerMessageToAll(playerid, textv2);

		return 0;

  		
}
Reply
#4

use my code
pawn Код:
public OnPlayerText(playerid, text[])
{
        new textv2[128], name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof (name));
                if(PlayerMuted[playerid] == 1)
                 {
                           GameTextForPlayer(playerid,"~n~~r~ERROR:~n~~y~You are muted!", 1000, 1);
                            return 0;
                 }
       
                format(textv2, sizeof (textv2), "[%d]: %s", name, playerid, text);
        SendPlayerMessageToAll(playerid, textv2);

        return 0;

       
}
return 1;
}
Reply
#5

This?

Код:
public OnPlayerText(playerid, text[])
{
	new textv2[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof (name));
    if(PlayerMuted[playerid] == 1)
    {
  		GameTextForPlayer(playerid,"~n~~r~ERROR:~n~~y~You are muted!", 1000, 1);
  		return 0;
    }
	else
	{
 		format(textv2, sizeof (textv2), "[%d]: %s", name, playerid, text);
 		SendPlayerMessageToAll(playerid, textv2);
		return 0;
	}
	return 1;
}
Im getting this errors;
Код:
C:\Users\School\Desktop\Team DeathMatch\gamemodes\afp.pwn(242) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply
#6

pawn Код:
public OnPlayerText(playerid, text[])
{
    new textv2[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof (name));
    if(PlayerMuted[playerid] == 1)
    {
        GameTextForPlayer(playerid,"~n~~r~ERROR:~n~~y~You are muted!", 1000, 1);
        return 0;
    }
    format(textv2, sizeof (textv2), "[%d]: %s", name, playerid, text);
    SendPlayerMessageToAll(playerid, textv2);
    return 0;
}
Reply
#7

Try this:

PHP код:
public OnPlayerText(playeridtext[])
{
        new 
textv2[128], name[MAX_PLAYER_NAME];
        
GetPlayerName(playeridnamesizeof (name));
        if(
PlayerMuted[playerid] == 1) {
                
GameTextForPlayer(playerid,"~n~~r~ERROR:~n~~y~You are muted!"10001);
                return 
0;
        }else{
            
format(textv2sizeof (textv2), "%s[%d]: %s"nameplayeridtext);
            
SendPlayerMessageToAll(playeridtextv2);
            return 
0;
       }
          return 
0;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)