How to make a team chat?
#4

Ill give you the one i used to use before i started linking with MySQL, just change the command of Clan accordingly:

Top of your code:
Код:
enum PlayerData{
    InClan
};
Clan Command
Код:
CMD:c(playerid, params[])
{
    format(userfile, 256, "/CLAN/%s.ini", GetName(playerid));

    PlayerInfo[playerid][InClan] = dini_Int(userfile, "InClan");

    if(PlayerInfo[playerid][InClan] < 1) return false;
    if(!strlen(params)) return SendClientMessage(playerid,RED,"Usage: /c [text]");

    new name[24],string[256];

    GetPlayerName(playerid,name,sizeof(name));

    format(string,sizeof(string),"Clan Chat: %s (ID: %d): %s",name,playerid,params);

    SendClanMsg(LIGHTBLUE, string);

    return 1;
}
Stocks goes anywhere in your code
Код:
stock SendClanMsg(color,string[]){
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
            if(IsPlayerConnected(i) == 1 && PlayerInfo[i][InClan] > 0)
            {
                    SendClientMessage(i, color, string);
            }
    }
    return 1;
}
Also if you want a SetClan Member command for rcon admin:
Код:
CMD:setclanmember(playerid, params[])
{
    new player1, string[128], string2[128];

    sscanf(params,"d",player1);

    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "You must be RCON admin to set people to the clan!");
    if(sscanf(params,"u",player1)) return SendClientMessage(playerid,RED,"Usage: /setclanmember [PlayerID/PartOfName]");

    format(userfile, 128, "/CLAN/%s.ini", GetName(player1));

    if(dini_Int(userfile, "InClan")==1) return SendClientMessage(playerid,RED,"That player is already in a clan!");
    if(!IsPlayerConnected(player1) || player1 == INVALID_PLAYER_ID) return SendClientMessage(playerid,RED,"Invalid ID");

    format(string, sizeof(string), "You are now in the clan!");
    format(string2, sizeof(string2), "%s (ID: %d) is now in the clan!", GetName(player1), player1);

    if(!dini_Exists(userfile))
    {
            SendClientMessage(player1, GREEN, string);
            SendClientMessage(playerid, GREEN, string2);
            dini_Create(userfile);
            dini_IntSet(userfile, "InClan",1);
    }
    return 1;
}
Hope this helps, change it accordingly
Reply


Messages In This Thread
How to make a team chat? - by rangerxxll - 11.03.2012, 21:36
Re: How to make a team chat? - by AstonDA-G - 11.03.2012, 21:39
Re: How to make a team chat? - by rangerxxll - 11.03.2012, 21:49
Re: How to make a team chat? - by kvsolga - 11.03.2012, 21:55
Re: How to make a team chat? - by AstonDA-G - 11.03.2012, 21:58
Re: How to make a team chat? - by [ABK]Antonio - 11.03.2012, 21:59
Re: How to make a team chat? - by rangerxxll - 11.03.2012, 22:00
Re: How to make a team chat? - by [ABK]Antonio - 11.03.2012, 22:03
Re: How to make a team chat? - by kvsolga - 11.03.2012, 22:07

Forum Jump:


Users browsing this thread: 1 Guest(s)