This is last thread about DM
#1

Ok this is very very last last DM Thread
yeah i make all the problem is the color
i want when example

I choose Mafia Team it set my color blue
i want my color set to my color using last time

example i using Green when i was not on DM yet

How can i do that

EDITED: How can i also make Team Chat Example ! or /t How?
Reply
#2

Please help
Reply
#3

SetPlayerColor
for team chat read soem tutorials! Use loop to check teams of players and then send message

Also this is more infections for you for doubleposting. Continue like this and you'll get ban, just warning you.
Reply
#4

Shut up and stop bumping. Look into other DM scripts and then you will learn. Try do something by yourself not spamming topics and 'please, please! i gonna cry! help me!'
Reply
#5

pawn Код:
new
    pOldColour[ MAX_PLAYERS ]
;

CMD:dm( playerid, params[ ] ) // When a player joins DM
{
    // Your stuffs here...

    pOldColour[ playerid ] = GetPlayerColor( playerid );

    SetPlayerColor( playerid, 0x0000FFFF ); // Blue

    return 1;
}

CMD:leavedm( playerid, params[ ] ) // When a player leaves a deathmatch
{
    // Your stuffs here
 
    SetPlayerColor( playerid, pOldColour[ playerid ] );

    return 1;
}

// Teamchat
public OnPlayerText( playerid, text[ ] )
{
    if ( text[ 0 ] = '!' && text[ 1 ] != ' ' )
    {
        foreach (Player, i) // Loop
        {
            if ( gTeam[ playerid ] == gTeam[ i ] ) // if the team is same
            {
                new
                    szString[ 128 ],
                    pName[ 24 ]
                ;
                 
                GetPlayerName( playerid, pName, 24 );

                format( szString, 128, "TEAMCHAT [ %s ] : %s", pName, text );

                SendClientMessage( i, -1, szString );
            }
        }
    }

    return 1;
}
Reply
#6

Quote:
Originally Posted by Basicz
Посмотреть сообщение
pawn Код:
new
    pOldColour[ MAX_PLAYERS ]
;

CMD:dm( playerid, params[ ] ) // When a player joins DM
{
    // Your stuffs here...

    pOldColour[ playerid ] = GetPlayerColor( playerid );

    SetPlayerColor( playerid, 0x0000FFFF ); // Blue

    return 1;
}

CMD:leavedm( playerid, params[ ] ) // When a player leaves a deathmatch
{
    // Your stuffs here
 
    SetPlayerColor( playerid, pOldColour[ playerid ] );

    return 1;
}
Thanks dude your better than those who commend like

Use your own way

-

I'm gonna cry help me

thats suck
Reply
#7

It's all about variables, and saving them. You make a variable called something like new pTeam[MAX_PLAYERS]; and then change it to the team number on OnPlayerSpawn. If you want to save the Team ID, so the player automatically gets the same Team when he connects in again, you have to save the Team ID on OnPlayerDisconnect in his userfiles. And then just load it on OnPlayerConnect.

pawn Код:
if(strcmp(string, "/team", true) == 0 || strcmp(string, "/t", true) == 0)
{
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, COLOR_GREY, "USAGE: /(t)eam [chat]");
        return 1;
    }    
    length = strlen(cmdtext);
    while((idx < object) && (cmdtext[idx] <= ' '))
    {
        idx++;
    }
    new offset = idx;
    new result[64];
    while((idx < object) && ((idx - offset) < (sizeof(result) - 1)))
    {
        result[idx - offset] = cmdtext[idx];
        idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
        SendClientMessage(playerid, COLOR_GREY, "USAGE: /(t)eam [chat]");
         return 1;
    }
    GetPlayerName(playerid, string, sizeof(string));
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(pTeam[playerid] == pTeam[i])
        {
            format(string, sizeof(string), "%s says: %s", string, reason);
            if(pTeam[playerid] == 1)
            {
                SendClientMessage(i, COLOR_BLUE, string);
            }
            else if(pTeam[playerid] == 2)
            {
                SendClientMessage(i, COLOR_RED, string);
            }
        }
    }
}
Reply
#8

Not working
Reply
#9

Try my TeamChat, use '!<Text>' ingame, no spaces.

pawn Код:
// Teamchat
public OnPlayerText( playerid, text[ ] )
{
    if ( text[ 0 ] = '!' && text[ 1 ] != ' ' )
    {
        foreach (Player, i) // Loop
        {
            if ( gTeam[ playerid ] == gTeam[ i ] ) // if the team is same
            {
                new
                    szString[ 128 ],
                    pName[ 24 ]
                ;
                 
                GetPlayerName( playerid, pName, 24 );

                if ( text[ 0 ] == '!' )
                    text[ 0 ] = ' ';

                format( szString, 128, "TEAMCHAT [ %s ] :%s", pName, text );

                SendClientMessage( i, -1, szString );
            }
        }
    }

    return 1;
}
Remember, change 'gTeam' variable to your code's 'gTeam' variable.

Also you need foreach for my code.
Reply
#10

1 Warning


Код:
H:\GTA San Andreas\SAMP Server\gamemodes\XtremeKakashiV2.pwn(635) : warning 211: possibly unintended assignment
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)