[Include] [INC]Functions
#6

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
It's quite nice, but:
pawn Код:
stock TogglePlayerMuted(playerid, toggle)
{
    if(IsPlayerConnected(playerid))
    {
        if(toggle == 0)
        {
            gmfuncs_PlayerInfo[playerid][Muted] = 0;
        }
        else if(toggle == 1)
        {
            gmfuncs_PlayerInfo[playerid][Muted] = 1;
        }
    }
    return 1;
}
This could be made like this:

pawn Код:
stock TogglePlayerMuted(playerid, toggle) //Or use bool:toggle = Change [Muted] to bool too then
    return IsPlayerConnected(playerid) ? gmfuncs_PlayerInfo[playerid][Muted] = toggle : return 0;
How does it actually work?
pawn Код:
stock TogglePlayerMuted(playerid, toggle)
{
    if(IsPlayerConnected(playerid)
    {
        gmfuncs_PlayerInfo[playerid][Muted] = toggle;
    }
    else
    {
        return 0;
    }
    return 1; //Not sure about this one here.
}
What's the reason for the check if he is connected?
Reply


Messages In This Thread
[INC]Functions - by Steve* - 01.05.2011, 14:42
Re: [INC]Functions - by Kwarde - 01.05.2011, 14:49
Re: [INC]Functions - by Steve* - 01.05.2011, 14:51
Re: [INC]Functions - by Steve* - 01.05.2011, 14:55
Re: [INC]Functions - by justsomeguy - 01.05.2011, 16:07
Re: [INC]Functions - by Zh3r0 - 01.05.2011, 16:15
Re: [INC]Functions - by Kwarde - 01.05.2011, 16:29

Forum Jump:


Users browsing this thread: 2 Guest(s)