Permalink
Browse files

Implement hit sounds, toggleable with the `/hs` command

  • Loading branch information...
RussellLVP committed Oct 8, 2016
1 parent 48f6aeb commit 23e2ced233da64eb42375430d357038fde8040fa
@@ -1179,6 +1179,20 @@ ShowHelp:
return 1; return 1;
} }
lvp_hs(playerId, params[]) {
if (PlayerSettings(playerId)->isPlayerHitSoundEnabled()) {
SendClientMessage(playerId, Color::Success, "You have disabled your hit sound.");
PlayerSettings(playerId)->setPlayerHitSoundEnabled(false);
} else {
SendClientMessage(playerId, Color::Success, "You have enabled your hit sound.");
PlayerSettings(playerId)->setPlayerHitSoundEnabled(true);
}
return 1;
#pragma unused params
}
lvp_reactiontest(playerId, params[]) { lvp_reactiontest(playerId, params[]) {
CReaction__OnCommand(playerId); CReaction__OnCommand(playerId);
@@ -16,7 +16,8 @@ enum _: PlayerSettingKey {
EarningsToBankAccountDisabledSettingKey = 3, EarningsToBankAccountDisabledSettingKey = 3,
AdminVehicleAccessDisabledSettingKey = 4, AdminVehicleAccessDisabledSettingKey = 4,
AllVirtualWorldChatEnabledSettingKey = 5, AllVirtualWorldChatEnabledSettingKey = 5,
PlayerInfoEnabledSettingKey = 6 PlayerInfoEnabledSettingKey = 6,
PlayerHitSoundEnabledSettingKey = 7
}; };
// Assert that we don't put more than 32 items in the PlayerSettingKey enum. // Assert that we don't put more than 32 items in the PlayerSettingKey enum.
@@ -213,5 +214,13 @@ class PlayerSettings <playerId (MAX_PLAYERS)> {
this->toggleSetting(PlayerInfoEnabledSettingKey, !!enabled); this->toggleSetting(PlayerInfoEnabledSettingKey, !!enabled);
} }
public bool: isPlayerHitSoundEnabled() {
return this->hasSetting(PlayerHitSoundEnabledSettingKey);
}
public setPlayerHitSoundEnabled(bool: enabled) {
this->toggleSetting(PlayerHitSoundEnabledSettingKey, !!enabled);
}
// TODO: Implement other settings. // TODO: Implement other settings.
}; };
@@ -242,6 +242,10 @@ public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
// Deal noteworthy more damage for sniper headshots. // Deal noteworthy more damage for sniper headshots.
if (!ShipManager->isPlayerWalkingOnShip(playerid) && weaponid == WEAPON_SNIPER && bodypart == BODY_PART_HEAD) if (!ShipManager->isPlayerWalkingOnShip(playerid) && weaponid == WEAPON_SNIPER && bodypart == BODY_PART_HEAD)
DamageManager(issuerid)->dealHeadShot(playerid); DamageManager(issuerid)->dealHeadShot(playerid);
// Play the hitsound if the player enabled it.
if (PlayerSettings(issuerid)->isPlayerHitSoundEnabled())
PlayerPlaySound(issuerid, 17802, 0, 0, 0);
} }
return 1; return 1;
@@ -578,6 +578,8 @@ public OnPlayerCommandText(playerid, cmdtext[]) {
lvp_command(set, 3, AdministratorLevel); lvp_command(set, 3, AdministratorLevel);
lvp_command(fixminigames, 12, AdministratorLevel); lvp_command(fixminigames, 12, AdministratorLevel);
lvp_command(hs, 2, PlayerLevel);
// ---------------------------- // ----------------------------
if(!strcmp(cmdtext, "/waterfight", true)) if(!strcmp(cmdtext, "/waterfight", true))

0 comments on commit 23e2ced

Please sign in to comment.