Making New Chat -
Amel_PAtomAXx - 09.08.2011
Hi
This is my first tutorial
Make New chat:
This is really easy
First put this at the top of your script:
then add this above OnGameModeInit()
now put this OnGameModeInit()
pawn Код:
public OnGameModeInit()
{
NewChat = 1; // this will active new chat
return 1;
}
now go to OnPlayerText and add this:
pawn Код:
public OnPlayerText(playerid,text[])
{
if(NewChat == 1) // if chat is actived
{
new pName[MAX_PLAYER_NAME],str[128];
GetPlayerName(playerid,pName,sizeof(pName)); // getting player name
format(str,sizeof(str),"** %s (%d) :(( %s ))",pName,playerid,text); // i hope you know how to use this 'format'
SendClientMessageToAll(0xFFFFFFFF,str); // sends message to all players , you can change colors
return 0;
}
return 1;
}
Ok and thats all , new chat is done.
you can make a chat versions like this :
pawn Код:
format(str,sizeof(str),"%s says : %s ",pName,text); // in this format chat will be like this example '' Patomaxx says : Whats up''
pawn Код:
format(str,sizeof(str),"%s (( %s )) ",text,pName); // example ''Whats up (( Patomaxx ))''
pawn Код:
format(str,sizeof(str),"** (%d) Says: %s ",playerid,text); // example ''(16) Says: Whats up''
Also you can edit colors to make it better:
pawn Код:
format(str,sizeof(str),"{ffffff} %s Says : {ff0000}%s",pName,text); // Player name will be white color and his text will be red color
This
{ff0000} are hex colors which you can find
here
Re: Making New Chat -
Jack- - 09.08.2011
How do you make it so that you need a character to make it? so its like !Talk here
Other than that its a great tut dude
Re: Making New Chat -
ylleron - 09.08.2011
try use your own stock to get player name. its better that creating new 2 lines
![Cheesy](images/smilies/biggrin.png)
btw tut is nice
Re: Making New Chat -
Jack- - 09.08.2011
How do you make it so that you have to be set to the chat to see the chat ?
Re: Making New Chat -
Mean - 09.08.2011
Quote:
Originally Posted by ylleron
try use your own stock to get player name. its better that creating new 2 lines ![Cheesy](images/smilies/biggrin.png) btw tut is nice ![Wink](images/smilies/wink.png)
|
No it's not, only thing that is better is less typing, which is lazy in my opinion.
Re: Making New Chat -
Amel_PAtomAXx - 09.08.2011
Quote:
Originally Posted by Jack-
How do you make it so that you have to be set to the chat to see the chat ?
|
what do you mean ??
Re: Making New Chat -
Toreno - 09.08.2011
Quote:
Originally Posted by Mean
No it's not, only thing that is better is less typing, which is lazy in my opinion.
|
Yes, it is. How does a stock which returns the player his name is not better than writing it each time when you have this stock using one variable of MAX_PLAYER_NAME. Better and faster, it has nothing to do with lazy... it's just better.
By the way, this tutorial is nice but you could have explained better since newbies will always get this wrong.
Thank you.
Re: Making New Chat -
Mean - 10.08.2011
Quote:
Originally Posted by Toreno
Yes, it is. How does a stock which returns the player his name is not better than writing it each time when you have this stock using one variable of MAX_PLAYER_NAME. Better and faster, it has nothing to do with lazy... it's just better.
By the way, this tutorial is nice but you could have explained better since newbies will always get this wrong.
Thank you.
|
No it's not better as it has no speed difference. It is not faster at all, in fact calling a stock each time might be slower, but I've never tried it.
It's just shorter, storing player name into a variable on connect is the best and the most efficient.
Re: Making New Chat -
[HiC]TheKiller - 10.08.2011
Quote:
Originally Posted by Mean
No it's not better as it has no speed difference. It is not faster at all, in fact calling a stock each time might be slower, but I've never tried it.
It's just shorter, storing player name into a variable on connect is the best and the most efficient.
|
I was bored, so I thought I might test that. Calling the stock is about 1/6th slower than just doing it normal. I did a test with a 10000000 (One million) loop and the results were
Код:
Stock 596, Normal: 441
For the test that I used, check
HERE.
Re: Making New Chat -
Mean - 10.08.2011
Told ya!