Need help with this
#1

Hi, in my server when I type "# hi" it says Admin lauder: hi but then when I try to chat regularly the text don't show up, help with this please.
Here's the code
Код:
public OnPlayerText(playerid, text[])
{
//Now les't make an admin chat, it will be:  # <text>.
	if( (text[0] == '#' || text[0] == '@') && strlen(text) > 1)
	{
		new str[128];
		new szPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

		if(IsPlayerAdmin(playerid))
		{
		    format(str, 128, "{FF0000}Admin %s: {DBED15}%s", szPlayerName, text[1]);

			for(new iPlayerID; iPlayerID < MAX_PLAYERS; iPlayerID++)
			{
				if(!IsPlayerConnected(iPlayerID)) continue;
		    	if(!IsPlayerAdmin(iPlayerID)) continue;
			    SendClientMessage(iPlayerID, 0xFFFFFFAA, str);
			}
		}

		return 0;
	}
}
--------------------------------------------
Also if any one has the commands /givehealth and /givearmor can you please give me a copy of that [Thanks Everyone]
Reply
#2

"return 1;" at the end of OnPlayerText, before the last closing bracket.
Reply
#3

Put an "return 1;" before the last closing bracket. Might fix it. Test and report here again.

This forum requires that you wait 120 seconds between posts. Please try again in 22 seconds.

#Edit#
Too slow. Damn this waiting time
Reply
#4

Quote:
Originally Posted by DeathOnaStick
Посмотреть сообщение
Put an "return 1;" before the last closing bracket. Might fix it. Test and report here again.

This forum requires that you wait 120 seconds between posts. Please try again in 22 seconds.

#Edit#
Too slow. Damn this waiting time
You mean like this?
Код:
public OnPlayerText(playerid, text[])
{
//Now les't make an admin chat, it will be:  # <text>.
	if( (text[0] == '#' || text[0] == '@') && strlen(text) > 1)
	{
		new str[128];
		new szPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

		if(IsPlayerAdmin(playerid))
		{
		    format(str, 128, "{FF0000}Admin %s: {DBED15}%s", szPlayerName, text[1]);

			for(new iPlayerID; iPlayerID < MAX_PLAYERS; iPlayerID++)
			{
				if(!IsPlayerConnected(iPlayerID)) continue;
		    	if(!IsPlayerAdmin(iPlayerID)) continue;
			    SendClientMessage(iPlayerID, 0xFFFFFFAA, str);
			}
		}

		return 1;
	}
}
Reply
#5

Quote:
Originally Posted by Lauder
Посмотреть сообщение
You mean like this?
Код:
public OnPlayerText(playerid, text[])
{
//Now les't make an admin chat, it will be:  # <text>.
	if( (text[0] == '#' || text[0] == '@') && strlen(text) > 1)
	{
		new str[128];
		new szPlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

		if(IsPlayerAdmin(playerid))
		{
		    format(str, 128, "{FF0000}Admin %s: {DBED15}%s", szPlayerName, text[1]);

			for(new iPlayerID; iPlayerID < MAX_PLAYERS; iPlayerID++)
			{
				if(!IsPlayerConnected(iPlayerID)) continue;
		    	if(!IsPlayerAdmin(iPlayerID)) continue;
			    SendClientMessage(iPlayerID, 0xFFFFFFAA, str);
			}
		}

		return 1;
	}
}
No like this:
pawn Код:
public OnPlayerText(playerid, text[])
{
//Now les't make an admin chat, it will be:  # <text>.
    if( (text[0] == '#' || text[0] == '@') && strlen(text) > 1)
    {
        new str[128];
        new szPlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

        if(IsPlayerAdmin(playerid))
        {
            format(str, 128, "{FF0000}Admin %s: {DBED15}%s", szPlayerName, text[1]);

            for(new iPlayerID; iPlayerID < MAX_PLAYERS; iPlayerID++)
            {
                if(!IsPlayerConnected(iPlayerID)) continue;
                if(!IsPlayerAdmin(iPlayerID)) continue;
                SendClientMessage(iPlayerID, 0xFFFFFFAA, str);
            }
        }
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by DeathOnaStick
Посмотреть сообщение
No like this:
pawn Код:
public OnPlayerText(playerid, text[])
{
//Now les't make an admin chat, it will be:  # <text>.
    if( (text[0] == '#' || text[0] == '@') && strlen(text) > 1)
    {
        new str[128];
        new szPlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

        if(IsPlayerAdmin(playerid))
        {
            format(str, 128, "{FF0000}Admin %s: {DBED15}%s", szPlayerName, text[1]);

            for(new iPlayerID; iPlayerID < MAX_PLAYERS; iPlayerID++)
            {
                if(!IsPlayerConnected(iPlayerID)) continue;
                if(!IsPlayerAdmin(iPlayerID)) continue;
                SendClientMessage(iPlayerID, 0xFFFFFFAA, str);
            }
        }
    }
    return 1;
}
Look I got this:

Why it happened and how to fix it?
Reply
#7

Try This

Код:
public OnPlayerText(playerid, text[])
{
      if(text[0] == '#' ||text[0] == '@' && IsPlayerAdmin(playerid))
     {
	    new string[128]; GetPlayerName(playerid,string,sizeof(string));
	    format(string,sizeof(string),"<Admin Chat>: %s: %s",string,text[1]);
            for(new i = 0; i < MAX_PLAYERS; i++)
	    {
	         if(IsPlayerConnected(i) && IsPlayerAdmin(playerid)){
	         SendClientMessage(i, 0xFF00E6C8, string);
	         }
	    }
	    return 0;
     }
}
Reply
#8

pawn Код:
public OnPlayerText(playerid, text[])
{
    if( (text[0] == '#' || text[0] == '@') && strlen(text) > 1)
    {
        new str[128];
        new szPlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
        if(!IsPlayerAdmin(playerid)) return 1; //If they are not an admin, return chat normally
        format(str, 128, "{FF0000}Admin %s: {DBED15}%s", szPlayerName, text[1]);
        for(new iPlayerID; iPlayerID < MAX_PLAYERS; iPlayerID++)
        {
            if(!IsPlayerConnected(iPlayerID)) continue;
            if(!IsPlayerAdmin(iPlayerID)) continue;
            SendClientMessage(iPlayerID, 0xFFFFFFAA, str);
        }
        return 0;
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
pawn Код:
public OnPlayerText(playerid, text[])
{
    if( (text[0] == '#' || text[0] == '@') && strlen(text) > 1)
    {
        new str[128];
        new szPlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
        if(!IsPlayerAdmin(playerid)) return 1; //If they are not an admin, return chat normally
        format(str, 128, "{FF0000}Admin %s: {DBED15}%s", szPlayerName, text[1]);
        for(new iPlayerID; iPlayerID < MAX_PLAYERS; iPlayerID++)
        {
            if(!IsPlayerConnected(iPlayerID)) continue;
            if(!IsPlayerAdmin(iPlayerID)) continue;
            SendClientMessage(iPlayerID, 0xFFFFFFAA, str);
        }
        return 0;
    }
    return 1;
}
Working perfect now, thanks dude you just won free +rep XD
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)