Initial commit — Southwest Roleplay FiveM

This commit is contained in:
jack
2026-06-20 13:05:34 +00:00
commit 3857de3d85
397 changed files with 30322 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
import { phoneSystem } from '../../../features/phone';
type PhoneCommandGuardOptions = {
on?: boolean;
unlocked?: boolean;
};
export const PhoneCommandGuard = (options?: PhoneCommandGuardOptions): CommandGuard => {
return (player: PlayerMp) => {
if (!options) {
return true;
}
if (!player.character?.phone || !player.character.phone.item) {
return `You must have a phone.`;
}
if (options.on !== undefined) {
if (options.on === true && !phoneSystem.isPhoneOn(player.character.phone.item)) {
return `Your phone must be turned on.`;
} else if (options.on === false && phoneSystem.isPhoneOn(player.character.phone.item)) {
return `Your phone must be turned off.`;
}
}
if (options.unlocked !== undefined) {
if (options.unlocked === true && !phoneSystem.isPlayerPhoneLocked(player as PlayerMpLoggedIn)) {
return `Your phone must be locked.`;
} else if (options.unlocked === false && phoneSystem.isPlayerPhoneLocked(player as PlayerMpLoggedIn)) {
return `Your phone must be unlocked.`;
}
}
return true;
};
};