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



OnPlayerText - problem. - Mmartin - 10.03.2011

Hello there!
In my GM i have script to send ID and "realName" to chat, when i type something. This is my code:
Код:
public OnPlayerText(playerid, text[])
	{
		new str[128];
		if(!strlen(player[playerid][realnick]))
			format(str,128,"{%s}%s (%d):{FFFFFF} %s",Colors[player[playerid][povolanie]],meno(playerid),playerid,text);
		else
		    format(str,128,"{%s}%s (%d):{FFFFFF} %s",Colors[player[playerid][povolanie]],player[playerid][realnick],playerid,text);
		SendClientMessageToAll(0xFFFFFFFF,str);
		return 0;
	}
So, it's working, but only sometimes. I was today on my server with friend.When he typed, i saw the ID, but when i tryed it, It returns 1 (i think, becouse i did not see any ID)
Does someone think, where's the problem?

(Sorry for poor english. I'm from Slovakia )


Re: OnPlayerText - problem. - willsuckformoney - 10.03.2011

Not sure but try this.

pawn Код:
public OnPlayerText(playerid, text[])
    {
        new str[128];
        if(!strlen(player[playerid][realnick]))
                {
            format(str,128,"{%s}%s (%d):{FFFFFF} %s",Colors[player[playerid][povolanie]],meno(playerid),playerid,text);
        } else {
            format(str,128,"{%s}%s (%d):{FFFFFF} %s",Colors[player[playerid][povolanie]],player[playerid][realnick],playerid,text);
        SendClientMessageToAll(0xFFFFFFFF,str);
                }
        return 0;
    }



Re: OnPlayerText - problem. - zSuYaNw - 10.03.2011

pawn Код:
public OnPlayerText(playerid, text[])
    {
        new str[128];
        if(!strlen(player[playerid][realnick]))format(str,128,"{%s}%s (%d):{FFFFFF} %s",Colors[player[playerid][povolanie]],meno(playerid),playerid,text);
        if(strlen(player[playerid][realnick]))  format(str,128,"{%s}%s (%d):{FFFFFF} %s",Colors[player[playerid][povolanie]],player[playerid][realnick],playerid,text);
        SendClientMessageToAll(0xFFFFFFFF,str);
        return 0;
    }
try


Re: OnPlayerText - problem. - Mmartin - 11.03.2011

Anyone doesn't works. Actually, i has some bug in my script. I removed color before nickname, And i changed SCMTA color to GetPlayerColor(playerid). It's interesting, but it work's!


Re: OnPlayerText - problem. - OKStyle - 11.03.2011

{%06x} and Colors[player[playerid][povolanie]] >>> 8.