clan chat
#1

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.
Reply
#2

Clan chat ?

Please try to explain more.. or give examples..

We aren't reading your mindes brother.
Reply
#3

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.
Reply
#4

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.
Reply
#5

Код:
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;
           }
     }
}
Reply
#6

PHP код:
public OnPlayerText(playeridtext[])
{
     if(!
strcmp(text[0], "*"))
     {
           if(
Is Player In Gang?) // Change this with your own variable
           
{
                 for(new 
0<= GetPlayerPoolSize(); i++)
                 {
                       if(
Player (playeridClan == Player (iClan// Change this with your own variable
                       
{
                             
SendClientMessage(iCOLOR_WHITEtext[1]);
                       }
                 }
                 return 
0;
           }
     }

that's correctly
Reply
#7

Quote:
Originally Posted by ~Error
Посмотреть сообщение
PHP код:
public OnPlayerText(playeridtext[])
{
     if(!
strcmp(text[0], "*"))
     {
           if(
Is Player In Gang?) // Change this with your own variable
           
{
                 for(new 
0<= GetPlayerPoolSize(); i++)
                 {
                       if(
Player (playeridClan == Player (iClan// Change this with your own variable
                       
{
                             
SendClientMessage(iCOLOR_WHITEtext[1]);
                       }
                 }
                 return 
0;
           }
     }

that's correctly
Hmmm, where's my fault?
Reply
#8

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?
Reply
#9

Код:
new clanid = PlayerInfo[playerid][pClan]

foreach(new i : Player)
{
        if(PlayerInfo[i][pClan] == bla bla bla)
Reply
#10

-REMOVED-
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)