[Help]Team Chat - 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: [Help]Team Chat (
/showthread.php?tid=458222)
[Help]Team Chat -
qazwsx - 15.08.2013
Guys, can anyone help me on how to making team chat?
so when the player typed @text, it will be send to all member of teams.
please help
Re: [Help]Team Chat -
Vanter - 15.08.2013
omg, please! SEARCH!!
Re: [Help]Team Chat -
qazwsx - 15.08.2013
Quote:
Originally Posted by Vanter
omg, please! SEARCH!!
|
how do you mean?
Re: [Help]Team Chat -
IceBilizard - 15.08.2013
simple team chat try if works
pawn Код:
forward TeamChat(playerid,string[]);
public TeamChat(playerid,string[])
{
foreach(Player,i)
{
if(GetPlayerTeam(i) == GetPlayerTeam(playerid))
{
SendClientMessage(i,-1,string);
}
}
return 1;
}
CMD:tc(playerid,params[])
{
new text[128],pName[MAX_PLAYER_NAME],formatted[156];
if(sscanf(params,"s[128]",text)) return SendClientMessage(playerid,-1,"Usage: /tc [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: [Help]Team Chat -
qazwsx - 16.08.2013
Quote:
Originally Posted by IceBilizard
simple team chat try if works
pawn Код:
forward TeamChat(playerid,string[]);
public TeamChat(playerid,string[]) { foreach(Player,i) { if(GetPlayerTeam(i) == GetPlayerTeam(playerid)) { SendClientMessage(i,-1,string); } } return 1; }
CMD:tc(playerid,params[]) { new text[128],pName[MAX_PLAYER_NAME],formatted[156]; if(sscanf(params,"s[128]",text)) return SendClientMessage(playerid,-1,"Usage: /tc [teamchat text]"); GetPlayerName(playerid,pName,sizeof(pName)); format(formatted,sizeof(formatted),"[Team Chat]: %s(%d): %s",pName,playerid,text); TeamChat(playerid,formatted); return 1; }
|
Getting an error
This is my error:
pawn Код:
E:\Rockstar Games\GTA San Andreas\samp03x_svr_R1-2_win32_3\gamemodes\dsgm.pwn(155) : error 021: symbol already defined: "i"
E:\Rockstar Games\GTA San Andreas\samp03x_svr_R1-2_win32_3\gamemodes\dsgm.pwn(155) : warning 204: symbol is assigned a value that is never used: "i"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
And i gave a little edit on your code:
pawn Код:
public TeamChat(playerid,string[])
{
for(new i=0, i<MAX_PLAYERS, i++)
{
if(GetPlayerTeam(i) == gTeam[playerid])
{
SendClientMessage(i, -1, string);
}
}
return 1;
}
Re: [Help]Team Chat -
PrinceKumar - 16.08.2013
Compiler is saying it is already defined symbol i so use another like d p t or whatever else u want , if you want that player type @ msg for team chat that create your code under onplayertext.
Re : [Help]Team Chat -
Matnix - 16.08.2013
I don't really understand, you don't need to pay to search you know? Why you're don't use search buttons before posting, anyways I'll give you one... for me it's more simple then use
/tc texte.
pawn Код:
// gang_chat system___
if(text[0] == '!') // !TEXT private gang.
{
for(new i; i < MAX_PLAYERS; i++)
{
if(gTeam[playerid] == gTeam[i])
{
format(string,sizeof(string),"[New Gang Message] (%s) said : %s", Name,text[1]);
SendClientMessage(i,0x7fff00FF,string);
}
}
return 0;
} // matnix help.
I don't give you all of the codes, now you have to get players name and his text. Good luck.
Re: [Help]Team Chat -
qazwsx - 16.08.2013
Quote:
Originally Posted by PrinceKumar
Compiler is saying it is already defined symbol i so use another like d p t or whatever else u want , if you want that player type @ msg for team chat that create your code under onplayertext.
|
I used "d", but still showing same error
Re: Re : [Help]Team Chat -
qazwsx - 16.08.2013
Quote:
Originally Posted by Matnix
I don't really understand, you don't need to pay to search you know? Why you're don't use search buttons before posting, anyways I'll give you one... for me it's more simple then use /tc texte.
pawn Код:
// gang_chat system___ if(text[0] == '!') // !TEXT private gang. { for(new i; i < MAX_PLAYERS; i++) { if(gTeam[playerid] == gTeam[i]) { format(string,sizeof(string),"[New Gang Message] (%s) said : %s", Name,text[1]); SendClientMessage(i,0x7fff00FF,string); } } return 0; } // matnix help.
I don't give you all of the codes, now you have to get players name and his text. Good luck.
|
Thanks, i think this one is work