SA-MP Forums Archive
[FUNC] ReadMyText Function - 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: [FUNC] ReadMyText Function (/showthread.php?tid=129803)



[FUNC] ReadMyText Function - Torran - 23.02.2010

[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


Re: [FUNC] ReadMyText Function - bajskorv123 - 23.02.2010

Nice work


Re: [FUNC] ReadMyText Function - Onyx09 - 23.02.2010

Good job :P


Re: [FUNC] ReadMyText Function - Torran - 23.02.2010

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


Re: [FUNC] ReadMyText Function - Torran - 23.02.2010

UPDATE: ADDED A SENDCLIENTMESSAGE AND SENDCLIENTMESSAGETOALL VERSION


Re: [FUNC] ReadMyText Function - bajskorv123 - 23.02.2010

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


Re: [FUNC] ReadMyText Function - Torran - 23.02.2010

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


Re: [FUNC] ReadMyText Function - HydraX - 23.02.2010

Very good job. I might use this.


Re: [FUNC] ReadMyText Function - Torran - 23.02.2010

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


Re: [FUNC] ReadMyText Function - Fedee! - 23.02.2010

Example for SendTeamMessage?

BTW. Nice done