[FUNC] ReadMyText Function
#1

[FUNC] ReadMyText Function

I have seen alot of people asking about teamchats and whatever,
I found a SendTeamMessage function but i couldnt find one of these,
So i decided to release one

SENDCLIENTMESSAGE VERSION
pawn Код:
stock ReadMyText(playerid,color,format2[],output[])
{
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s (%s): %s", format2, name, output);
SendClientMessage(playerid, color, string);
}
SENDCLIENTMESSAGETOALL VERSION
pawn Код:
stock EveryoneReadMyText(playerid,color,format2[],output[])
{
new string[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s (%s): %s", format2, name, output);
SendClientMessageToAll(color, string);
}
Add that outside a callback

Usage:
Код:
ReadMyText(playerid,color,format2[],output[])
Example: ZCMD/DCMD
Код:
ReadMyText(playerid,0xFF0000AA,"Police Radio",params)
Example: CMDTEXT
Код:
ReadMyText(playerid,0xFF0000AA,"Police Radio",cmdtext)
Playerid = playerid
Color = color
Format2[] = Type of radio/teamchat ( Example: If you put Team Chat, Ingame it will show as Team Chat (PLAYERNAME): TEXTHERE )
Output[] = params for dcmd and zcmd, cmdtext for normal onplayercommandtext thing

Ingame format:

FORMAT2[] (PLAYERNAME): TEXT

I suggest using this function also: NOT MADE BY ME

pawn Код:
stock SendTeamMessage(teamid,color,message[])
{
#if defined foreach
foreach(i) {
#else
for(new i=0; i<GetMaxPlayers(); i++) if(IsPlayerConnected(i)) {
#endif
if(GetPlayerTeam(i)==teamid) SendClientMessage(i,color,message);
}
}
Example:
pawn Код:
SendTeamMessage(TEAM_GROVE, COLOR_ORANGE, "SendTeamMessage example");
And on my function replace SendClientMessage with SendTeamMessage and playerid with teamid
Any questions or bugs? Just ask me!

Credits:
Torran - Idea and making the base
[NWA]Hannes - Helping me fix errors
Gamestar. - SendTeamMessage function
Reply
#2

Nice work
Reply
#3

Good job :P
Reply
#4

Quote:
Originally Posted by [NWA
Hannes ]
Nice work
Quote:
Originally Posted by [GM
LeGenDy ]
Good job :P
Thankyou
Reply
#5

UPDATE: ADDED A SENDCLIENTMESSAGE AND SENDCLIENTMESSAGETOALL VERSION
Reply
#6

I'm happy that you put my name in credits
Im skilled but unfamous
Reply
#7

Quote:
Originally Posted by [NWA
Hannes ]
I'm happy that you put my name in credits
Im skilled but unfamous
No problem
Reply
#8

Very good job. I might use this.
Reply
#9

Quote:
Originally Posted by HydraX
Very good job. I might use this.
Thankyou, I dont know why i made a SentClientMessage version,
I guess you could use it if you wanted to test something xd
Reply
#10

Example for SendTeamMessage?

BTW. Nice done
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)