void CSDKPlayer::CheatImpulseCommands( int iImpulse ) { if ( iImpulse != 101 ) { BaseClass::CheatImpulseCommands( iImpulse ); return ; } gEvilImpulse101 = true; EquipSuit(); GiveNamedItem( "weapon_mp5" ); GiveNamedItem( "weapon_grenade" ); GiveNamedItem( "weapon_shotgun" ); // Give the player everything! GiveAmmo( 90, AMMO_BULLETS ); GiveAmmo( 3, AMMO_GRENADE ); if ( GetHealth() < 100 ) { TakeHealth( 25, DMG_GENERIC ); } gEvilImpulse101 = false; }
void CJaS_Marine_Jack::Spawn() { CASW_Marine_Resource *pResource = dynamic_cast<CASW_Marine_Resource *>( CreateEntityByName( "asw_marine_resource" ) ); pResource->SetProfileIndex( 6 ); pResource->SetMarineEntity( this ); SetMarineResource( pResource ); pResource->Spawn(); m_pProfileOverride = pResource->GetProfile(); SelectModelFromProfile(); SetModelFromProfile(); CBaseCombatWeapon *pWeapon = dynamic_cast<CBaseCombatWeapon *>( CreateEntityByName( "asw_weapon_sniper_rifle" ) ); if ( pWeapon ) { pWeapon->Spawn(); pWeapon->GiveDefaultAmmo(); pWeapon->m_iClip1 = 9999; GiveAmmo(9999, pWeapon->GetPrimaryAmmoType()); Weapon_Equip_In_Index( pWeapon, 0 ); Weapon_Switch( pWeapon ); } m_bConstantSlowHeal = true; m_hSquadFormation = static_cast<CASW_SquadFormation *>( CreateEntityByName( "asw_squadformation" ) ); m_hSquadFormation->Leader( this ); SetRenderColor( 0x99, 0x40, 0x40 ); BaseClass::Spawn(); }
void CK98Ammo::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { if (!pActivator) return; if (!pActivator->IsPlayer()) return; CBasePlayer *pPlayer = ToBasePlayer(pActivator); if (!pPlayer) return; if (GiveAmmo(pPlayer, SIZE_AMMO_K98, "K98")) { m_OnUse.FireOutput(this, this); EmitSound("Ammo.Pickup2"); UTIL_Remove(this); } }
BOOL CWeaponBox::PackAmmo( int iszName, int iCount ) { int iMaxCarry; if ( FStringNull( iszName ) ) { // error here Msg( "NULL String in PackAmmo!\n" ); return FALSE; } iMaxCarry = MaxAmmoCarry( iszName ); if ( iMaxCarry != -1 && iCount > 0 ) { GiveAmmo( iCount, (char *)STRING( iszName ), iMaxCarry ); return TRUE; } return FALSE; }
//========================================================= // CWeaponBox - PackAmmo //========================================================= BOOL CWeaponBox::PackAmmo( int iszName, int iCount ) { int iMaxCarry; if ( FStringNull( iszName ) ) { // error here ALERT ( at_console, "NULL String in PackAmmo!\n" ); return FALSE; } iMaxCarry = MaxAmmoCarry( iszName ); if ( iMaxCarry != -1 && iCount > 0 ) { //ALERT ( at_console, "Packed %d rounds of %s\n", iCount, STRING(iszName) ); GiveAmmo( iCount, (char *)STRING( iszName ), iMaxCarry ); return TRUE; } return FALSE; }
void keyboard_handler(int keycode, int press) { UpdateKeys(keycode, press); if (RSJ) { #if 0 if (press == 0) { int i; for (i = 0; i < CheatCount; i++) { char *key = XKeysymToString(keycode); if (key == NULL) break; if (strlen(key) != 1) break; if (CheatCodes[i].code[CheatIndex] == toupper(key[0])) { CheatIndex++; if (CheatCodes[i].code[CheatIndex] == 0) { PlaySound(SND_BONUS); switch (i) { case 0: case 4: GiveKey(0); GiveKey(1); gamestate.godmode = TRUE; break; case 1: gamestate.godmode^=TRUE; break; case 2: gamestate.machinegun = TRUE; gamestate.chaingun = TRUE; gamestate.flamethrower = TRUE; gamestate.missile = TRUE; GiveAmmo(gamestate.maxammo); GiveGas(99); GiveMissile(99); break; case 3: gamestate.maxammo = 999; GiveAmmo(999); break; case 5: GiveKey(0); GiveKey(1); break; case 6: playstate=EX_WARPED; nextmap = gamestate.mapon+1; if (MapListPtr->MaxMap<=nextmap) nextmap = 0; break; case 7: ShowPush ^= TRUE; break; } CheatIndex = 0; } break; } } if (i == CheatCount) CheatIndex = 0; } #endif joystick1 = 0; #if 0 if (press == 0) { switch(keycode) { case XK_1: gamestate.pendingweapon = WP_KNIFE; break; case XK_2: if (gamestate.ammo) { gamestate.pendingweapon = WP_PISTOL; } break; case XK_3: if (gamestate.ammo && gamestate.machinegun) { gamestate.pendingweapon = WP_MACHINEGUN; } break; case XK_4: if (gamestate.ammo && gamestate.chaingun) { gamestate.pendingweapon = WP_CHAINGUN; } break; case XK_5: if (gamestate.gas && gamestate.flamethrower) { gamestate.pendingweapon = WP_FLAMETHROWER; } break; case XK_6: if (gamestate.missiles && gamestate.missile) { gamestate.pendingweapon = WP_MISSILE; } break; case XK_period: case XK_slash: joystick1 = JOYPAD_START; break; case XK_Escape: Quit(NULL); /* fast way out */ } } #endif if (keys[SC_CURSORUPLEFT]) joystick1 |= (JOYPAD_UP|JOYPAD_LFT); if (keys[SC_CURSORUP]) joystick1 |= JOYPAD_UP; if (keys[SC_CURSORUPRIGHT]) joystick1 |= (JOYPAD_UP|JOYPAD_RGT); if (keys[SC_CURSORRIGHT]) joystick1 |= JOYPAD_RGT; if (keys[SC_CURSORDOWNRIGHT]) joystick1 |= (JOYPAD_DN|JOYPAD_RGT); if (keys[SC_CURSORDOWN]) joystick1 |= JOYPAD_DN; if (keys[SC_CURSORDOWNLEFT]) joystick1 |= (JOYPAD_DN|JOYPAD_LFT); if (keys[SC_CURSORLEFT]) joystick1 |= JOYPAD_LFT; if (keys[SC_CURSORBLOCKLEFT]) joystick1 |= JOYPAD_LFT; if (keys[SC_CURSORBLOCKRIGHT]) joystick1 |= JOYPAD_RGT; if (keys[SC_CURSORBLOCKUP]) joystick1 |= JOYPAD_UP; if (keys[SC_CURSORBLOCKDOWN]) joystick1 |= JOYPAD_DN; if (keys[SC_KEYPADENTER]) joystick1 |= JOYPAD_A; if (keys[SC_ENTER]) joystick1 |= JOYPAD_A; if (keys[SC_SPACE]) joystick1 |= JOYPAD_A; if (keys[SC_LEFTALT]) joystick1 |= JOYPAD_TR; if (keys[SC_RIGHTALT]) joystick1 |= JOYPAD_TR; if (keys[SC_LEFTCONTROL]) joystick1 |= JOYPAD_B; if (keys[SC_RIGHTCONTROL]) joystick1 |= JOYPAD_B; if (keys[SC_LEFTSHIFT]) joystick1 |= (JOYPAD_X|JOYPAD_Y); if (keys[SC_RIGHTSHIFT]) joystick1 |= (JOYPAD_X|JOYPAD_Y); } if ((joystick1 & (JOYPAD_LFT|JOYPAD_RGT)) == (JOYPAD_LFT|JOYPAD_RGT)) joystick1 &= ~(JOYPAD_LFT|JOYPAD_RGT); if ((joystick1 & (JOYPAD_UP|JOYPAD_DN)) == (JOYPAD_UP|JOYPAD_DN)) joystick1 &= ~(JOYPAD_UP|JOYPAD_DN); if (joystick1 & JOYPAD_TR) { if (joystick1 & JOYPAD_LFT) { joystick1 = (joystick1 & ~(JOYPAD_TR|JOYPAD_LFT)) | JOYPAD_TL; } else if (joystick1 & JOYPAD_RGT) { joystick1 = joystick1 & ~JOYPAD_RGT; } else { joystick1 &= ~JOYPAD_TR; } } }
void CHL1_Player::CheatImpulseCommands( int iImpulse ) { switch( iImpulse ) { case 101: gEvilImpulse101 = true; GiveNamedItem( "item_suit" ); GiveNamedItem( "weapon_physgun" ); GiveNamedItem( "weapon_crowbar" ); GiveNamedItem( "weapon_glock" ); GiveNamedItem( "weapon_357" ); GiveNamedItem( "weapon_shotgun" ); GiveNamedItem( "weapon_mp5" ); GiveNamedItem( "weapon_satchel" ); GiveNamedItem( "weapon_rpg" ); GiveNamedItem( "weapon_crossbow" ); GiveNamedItem( "weapon_egon" ); GiveNamedItem( "weapon_tripmine" ); GiveNamedItem( "weapon_gauss" ); GiveNamedItem( "weapon_handgrenade" ); GiveNamedItem( "weapon_snark" ); GiveNamedItem( "weapon_hornetgun" ); GiveAmmo( 250, "9mmRound" ); GiveAmmo( 36, "357Round" ); GiveAmmo( 125, "Buckshot" ); GiveAmmo( 10, "MP5_grenade" ); GiveAmmo( 5, "RPG_Rocket" ); GiveAmmo( 50, "XBowBolt" ); GiveAmmo( 100, "Uranium" ); GiveAmmo( 10, "Grenade" ); GiveAmmo( 8, "Hornet" ); GiveAmmo( 15, "Snark" ); GiveAmmo( 5, "TripMine" ); GiveAmmo( 5, "Satchel" ); gEvilImpulse101 = false; break; case 0: default: BaseClass::CheatImpulseCommands( iImpulse ); } }