Author Topic: Weapon Spawner + AFK + Godmode by LeeXian99  (Read 216 times)

greentarch

  • Global Moderator
  • Newbie
  • ********
  • Posts: 16
  • Reputation: 0
    • View Profile
Re: Weapon Spawner + AFK + Godmode by LeeXian99
« on: April 22, 2013, 10:43:22 pm »
This is a good example if you want to practice ternary operators - e.g :
Code: [Select]
new
    bool: g_pGod[ MAX_PLAYERS ];

CMD:god( playerid, params[ ] )
{
    g_pGod[ playerid ] = !g_pGod[ playerid ]; // This is why I love booleans :3

    SetPlayerHealth(
        playerid,
        ( g_pGod[ playerid ] ) ? ( Float: 0x7F800000 ) : ( -1.0 )
    );

    SendClientMessage(
        playerid,
        -1,
        ( g_pGod[ playerid ] ) ? ( "Godmode turned on!" ) : ( "Godmode turned off!" )
    );

    return true;
}