clan 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: clan chat (
/showthread.php?tid=578917)
clan chat -
suni - 22.06.2015
hey guys i really need a clan chat system when using *(text) to clan chat. but the main problem is, i cant script it.
i need someone to help me out with it. thanks.
Re : clan chat -
KillerDVX - 23.06.2015
Clan chat ?
Please try to explain more.. or give examples..
We aren't reading your mindes brother.
Re: clan chat -
Shetch - 23.06.2015
You can create a command such as /clanchat [text] which will loop through all the players and only send the text to whoever is in the particular clan.
So for example:
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pClan] == 1)
{
SendClientMessage(i, COLOR_WHITE, text);
}
}
PlayerInfo[i][pClan] == 1
The number 1 would equal to the ID of the clan you wish to send the message to.
Re: clan chat -
suni - 23.06.2015
Yes I'll explain. I want to create a clan chat using *(text) to clan chat but i don't want a message to send from one clan to another clan. Like they are 3 clans in my server [A] [B] and [C]. If someone use *(text) in clan [A] i just want that message to all players who have [A] next to their name and not to [B] and [C]. I hope you guys understand me.
Re: clan chat -
X337 - 23.06.2015
Код:
public OnPlayerText(playerid, text[])
{
if(!strcmp(text[0], "*"))
{
if(Is Player In Gang?) // Change this with your own variable
{
for(new i = 0; i < GetPlayerPoolSize(); i++)
{
if(Player (playerid) Clan == Player (i) Clan) // Change this with your own variable
{
SendClientMessage(i, COLOR_WHITE, text[1]);
}
}
return 0;
}
}
}
Re: clan chat -
~Error - 23.06.2015
PHP код:
public OnPlayerText(playerid, text[])
{
if(!strcmp(text[0], "*"))
{
if(Is Player In Gang?) // Change this with your own variable
{
for(new i = 0; i <= GetPlayerPoolSize(); i++)
{
if(Player (playerid) Clan == Player (i) Clan) // Change this with your own variable
{
SendClientMessage(i, COLOR_WHITE, text[1]);
}
}
return 0;
}
}
}
that's correctly
Re: clan chat -
X337 - 23.06.2015
Quote:
Originally Posted by ~Error
PHP код:
public OnPlayerText(playerid, text[])
{
if(!strcmp(text[0], "*"))
{
if(Is Player In Gang?) // Change this with your own variable
{
for(new i = 0; i <= GetPlayerPoolSize(); i++)
{
if(Player (playerid) Clan == Player (i) Clan) // Change this with your own variable
{
SendClientMessage(i, COLOR_WHITE, text[1]);
}
}
return 0;
}
}
}
that's correctly
|
Hmmm, where's my fault?
Re: clan chat -
Dignity - 23.06.2015
Quote:
Originally Posted by bondowocopz
Код:
public OnPlayerText(playerid, text[])
{
if(!strcmp(text[0], "*"))
{
if(Is Player In Gang?) // Change this with your own variable
{
for(new i = 0; i < GetPlayerPoolSize(); i++)
{
if(Player (playerid) Clan == Player (i) Clan) // Change this with your own variable
{
SendClientMessage(i, COLOR_WHITE, text[1]);
}
}
return 0;
}
}
}
|
Why don't you use foreach?
Re: clan chat - justice96 - 23.06.2015
Код:
new clanid = PlayerInfo[playerid][pClan]
foreach(new i : Player)
{
if(PlayerInfo[i][pClan] == bla bla bla)
Re: clan chat -
suni - 23.06.2015
-REMOVED-