[Tips Needed]Scripting teamchat with teamcolors, "/tpm" or just "@" ||+1rep||
#3

pawn Код:
new team[MAX_PLAYERS];

public OnPlayerRequestClass(playerid, classid)
{
    if(classid == 0)
    {
        SetPlayerPos(playerid, 2495.0413,-1685.2115,13.5115);
        SetPlayerCameraPos(playerid, 2495.0134,-1681.1893,13.3387);
        SetPlayerCameraLookAt(playerid, 2495.0413,-1685.2115,13.5115);
        GameTextForPlayer(playerid, "~g~Grove", 5000, 5);
        SetPlayerColor(playerid, 0x2D964DFF);
        SetPlayerFacingAngle(playerid, 360.000);
        ApplyAnimation(playerid, "RAPPING", "Laugh_01", 4.0, 0, 0, 0, 0, 0);
        SetPlayerVirtualWorld(playerid, 0);
        SetPlayerInterior(playerid, 0);
        team[playerid] = 1;
    }
    else if(classid == 1)
    {
        SetPlayerPos(playerid, 369.2329,1916.1652,18.3985);
        SetPlayerCameraPos(playerid, 365.9307,1912.9822,17.6406);
        SetPlayerCameraLookAt(playerid, 369.2329,1916.1652,18.3985);
        GameTextForPlayer(playerid, "Army", 5000, 4);
        SetPlayerColor(playerid, 0xC4840EFF);
        SetPlayerFacingAngle(playerid, 110.000);
        ApplyAnimation(playerid, "GHANDS", "gsign5LH", 4.0, 0, 0, 0, 0, 0);
        SetPlayerVirtualWorld(playerid, 0);
        SetPlayerInterior(playerid, 0);
        team[playerid] = 2;
    }
    return 1;
}
We firstly need to make a variable to tell us which team they are in

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '@')
    {
        new Pname[24], string[150];
        GetPlayerName(playerid, Pname, 24);
        format(string, sizeof(string), "|GANG CHAT| %s(%d): %s", Pname, playerid, text[1]);
        for(new i; i<MAX_PLAYERS; i++)
        {
            if(!IsPlayerConnected(i)) continue;
            if(team[playerid] == team[i]) SendClientMessage(i, -1, string);
        }
        return 0;
    }
    return 1;
}
That just sends a message to the team members.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)