[Pedido] SetPlayerColor
#6

Quote:
Originally Posted by Schocc
Посмотреть сообщение
Quase la mais o certo nгo й setar mais Sim Aumentar o valor da variavel
pawn Код:
public UpdateColor( playerid )
{
    switch( pCor[ playerid ] )
    {
        case 0: SetPlayerColor( playerid,   cor 1   ),   pCor[ playerid ]++;
        case 1:
        {
            SetPlayerColor( playerid,   cor 2   ),       pCor[ playerid ] = 0;
        }
    }
    pCor[ playerid ]++;
    return 1;
}
Nгo, nгo й o certo.
O ideal seria um timer (pelo amor de deus. nгo usem OnPlayerUpdate pra isso) e aumentando e diminuindo a variбvel.

Ex:
pawn Код:
new gPlayerBlink[MAX_PLAYERS];
enum {
    PLAYER_BLINK_OFF,
    PLAYER_BLINK_FIRST,
    PLAYER_BLINK_SECOND
    // ...
}

new const
    blinkColors[] = {
        0xFFFFFFFF,
        0xFFFFFFFF,
        0xA3A3A3FF
    }
;
forward BlinkProcess();

// OnGameModeInit
// SetTimer BlinkProcess, 1000

public BlinkProcess() {
    for(new i, k = GetMaxPlayers(); i < k; i++) {
        if(IsPlayerConnected(playerid)) {
            if(gPlayerBlink[playerid]) {
                if(gPlayerBlink[playerid] == 2) { // 2 sendo a ъltima cor de piscar
                    gPlayerBlink[playerid] = 1; // sendo 1 a primeira cor
                    SetPlayerColor(playerid, blinkColors[gPlayerBlink[playerid]]);
                    continue;
                }
                gPlayerBlink[playerid]++;
                SetPlayerColor(playerid, blinkColors[gPlayerBlink[playerid]]);
            }
        }
    }
    return 1;
}

stock SetPlayerBlinking(playerid) {
    gPlayerBlink[playerid] = PLAYER_BLINK_SECOND;
    return 1;
}
stock DisablePlayerBlinking(playerid) {
    gPlayerBlink[playerid] = PLAYER_BLINK_OFF;
    SetPlayerColor(playerid, blinkColors[0]);
    return 1;
}
Reply


Messages In This Thread
SetPlayerColor - by hbzi - 02.12.2012, 09:43
Re: SetPlayerColor - by @Riichard - 02.12.2012, 09:45
Re: SetPlayerColor - by Schocc - 02.12.2012, 09:50
Re: SetPlayerColor - by hbzi - 02.12.2012, 09:58
Re: SetPlayerColor - by Schocc - 02.12.2012, 10:40
Re: SetPlayerColor - by steki. - 02.12.2012, 11:03

Forum Jump:


Users browsing this thread: 1 Guest(s)