Are there any team chats out there? - 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)
+--- Thread: Are there any team chats out there? (
/showthread.php?tid=482035)
Are there any team chats out there? -
Dylan_Madigan69 - 19.12.2013
Im looking for a code that allows players to talk to their team memebers automatically. Such as, depending on ther class/team, they can send out a message that is only seen by that players team, and he can see other messages sent by team members.
Re: Are there any team chats out there? -
Excelize - 19.12.2013
Here you go.
Код:
#include <a_samp>
#include <zcmd>
#include <foreach>
#include <sscanf>
forward TeamChat(playerid,string[]);
public TeamChat(playerid,string[])
{
foreach(Player,i)
{
if(GetPlayerTeam(i) == GetPlayerTeam(playerid))
{
SendClientMessage(i,-1,string);
}
}
return 1;
}
CMD:t(playerid,params[])
{
new text[128],pName[MAX_PLAYER_NAME],formatted[156];
if(sscanf(params,"s[128]",text)) return SendClientMessage(playerid,-1,"Usage: /t [teamchat text]");
GetPlayerName(playerid,pName,sizeof(pName));
format(formatted,sizeof(formatted),"[Team Chat]: %s(%d): %s",pName,playerid,text);
TeamChat(playerid,formatted);
return 1;
}
Re: Are there any team chats out there? -
Dylan_Madigan69 - 19.12.2013
Okay. Now how would i make it where you talk to your team by default, and you have to do something like /s to talk to the entire server?
Edit:
Also, that code did not work. It always says to enter a message when i use that command, though I did. I just set this up in an FS so it would not do anything to my gamemode script.