Global chat - adding team - 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: Global chat - adding team (
/showthread.php?tid=97895)
Global chat - adding team -
Striker_Moe - 17.09.2009
Okay guys
Код:
if(!strcmp(cmd, "/g", true))
{
if(!globalchat)
return SendClientMessage(playerid,RED,"Global chat is not currently enabled.");
while(cmdtext[idx] == 32) idx++;
if(cmdtext[idx] == EOS)
return SendClientMessage(playerid,RED,"Usage: /g [text]");
new string[128];
GetPlayerName(playerid,string,MAX_PLAYER_NAME);
format(string,128,"[Global Chat]-%s: %s",string,cmdtext[idx]);
return SendClientMessageToAll(COLOR_GREEN,string);
}
This is my code for now. Iґve been thinking about improoving it, which Iґd like to do now. I want the playerґs team displayed instead of "Global Chat".
Teams are like this (I want to use the playerґs color for it)
Germany == 0xAFAFAFAA
USA == 0x15005EFF
China == 0x90FF87FF
Russia == 0xB8860BAA
How can this be done?
Re: Global chat - adding team -
Striker_Moe - 17.09.2009
I DID IT MYSELF! I DID IT!
Код:
if(!strcmp(cmd, "/g", true))
{
if(!globalchat)
return SendClientMessage(playerid,RED,"Global chat is not currently enabled.");
while(cmdtext[idx] == 32) idx++;
if(cmdtext[idx] == EOS)
return SendClientMessage(playerid,RED,"Usage: /g [text]");
new string[128];
GetPlayerName(playerid,string,MAX_PLAYER_NAME);
if(GetPlayerColor(playerid) == 0xAFAFAFAA)
{
format(string,128,"[Germany]-%s: %s",string,cmdtext[idx]);
SendClientMessageToAll(COLOR_GREEN,string);
return 1;
}
if(GetPlayerColor(playerid) == 0x15005EFF)
{
format(string,128,"[USA]-%s: %s",string,cmdtext[idx]);
SendClientMessageToAll(COLOR_GREEN,string);
return 1;
}
if(GetPlayerColor(playerid) == 0x90FF87FF)
{
format(string,128,"[Russia]-%s: %s",string,cmdtext[idx]);
SendClientMessageToAll(COLOR_GREEN,string);
return 1;
}
if(GetPlayerColor(playerid) == 0xB8860BAA)
{
format(string,128,"[China]-%s: %s",string,cmdtext[idx]);
SendClientMessageToAll(COLOR_GREEN,string);
return 1;
}
return 0;
}