Players::callInDimension: Difference between revisions
(Insert first informations about this function) |
m (Replaced HTML with template) |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
This function call added client-side event for any players in a specific dimension. | This function call added client-side event for any players in a specific dimension. | ||
==Syntax== | ==Syntax== | ||
< | <pre> | ||
player.callInDimension(Number dimension, String eventName [, ...args]); | player.callInDimension(Number dimension, String eventName [, ...args]); | ||
</ | </pre> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''dimension:''' The dimension in which the event will be sent. | *'''dimension:''' The dimension in which the event will be sent. | ||
| Line 15: | Line 14: | ||
That's example will call event added on client side for player inside the dimension ID 2 and disable regeneration health. | That's example will call event added on client side for player inside the dimension ID 2 and disable regeneration health. | ||
{{ClientsideCode| | |||
<pre> | |||
< | |||
let disableRegeneration = () => { | let disableRegeneration = () => { | ||
mp.game.player.setHealthRechargeMultiplier(0); //Disable regeneration | mp.game.player.setHealthRechargeMultiplier(0); //Disable regeneration | ||
| Line 24: | Line 22: | ||
mp.events.add('disablePlayerRegeneration', disableRegeneration); | mp.events.add('disablePlayerRegeneration', disableRegeneration); | ||
</ | </pre> | ||
}} | |||
{{ServersideCode| | |||
<pre> | |||
< | |||
mp.players.callInDimension(2, "disablePlayerRegeneration"); | mp.players.callInDimension(2, "disablePlayerRegeneration"); | ||
</ | </pre> | ||
}} | |||
==See Also== | ==See Also== | ||
{{Player_block}} | {{Player_block}} | ||
Latest revision as of 12:27, 26 October 2018
This function call added client-side event for any players in a specific dimension.
Syntax
player.callInDimension(Number dimension, String eventName [, ...args]);
Required Arguments
- dimension: The dimension in which the event will be sent.
- eventName: Event name, what will be called.
- args: Any arguments, what should be sended to client. Supports entities, strings, numbers and booleans. (Objects and Arrays should be packed to JSON format.)
Example
That's example will call event added on client side for player inside the dimension ID 2 and disable regeneration health.
Client-Side
let disableRegeneration = () => {
mp.game.player.setHealthRechargeMultiplier(0); //Disable regeneration
mp.gui.chat.push("Regeneration disabled"); //Output text to default chatbox
};
mp.events.add('disablePlayerRegeneration', disableRegeneration);
Server-Side
mp.players.callInDimension(2, "disablePlayerRegeneration");
See Also
- Functions
- Player::ban
- Player::call
- Player::callProc
- Player::callToStreamed
- Player::callUnreliable
- Player::cancelPendingRpc
- Player::clearDecorations
- Player::getClothes
- Player::getDecoration
- Player::getFaceFeature
- Player::getHeadBlend
- Player::getHeadOverlay
- Player::getProp
- Player::getWeaponAmmo
- Player::giveWeapon
- Player::hasPendingRpc
- Player::invoke
- Player::isStreamed
- Player::isStreamedFor
- Player::kick
- Player::kickSilent
- Player::notify
- Player::outputChatBox
- Player::playAnimation
- Player::playScenario
- Player::putIntoVehicle
- Player::removeFromVehicle
- Player::removeObject
- Player::removeWeapon
- Player::removeAllWeapons
- Player::resetWeapon
- Player::setClothes
- Player::setCustomization
- Player::setDecoration
- Player::setFaceFeature
- Player::setHairColor
- Player::setHeadBlend
- Player::setHeadOverlay
- Player::setProp
- Player::setWeaponAmmo
- Player::spawn
- Player::stopAnimation
- Player::updateHeadBlend
- Player::enableVoiceTo
- Player::disableVoiceTo
- Weapons::clear
- Entity::destroy
- Entity::dist
- Entity::distSquared
- Entity::getVariable
- Entity::setVariable
- Entity::setVariables
- Properties
- Player::action
- Player::aimTarget
- Player::allWeapons
- Player::armour
- Player::eyeColor
- Player::faceFeatures
- Player::hairColor
- Player::hairHighlightColor
- Player::heading
- Player::health
- Player::rgscId
- Player::ip
- Player::serial
- Player::isAiming
- Player::isClimbing
- Player::isEnteringVehicle
- Player::isInCover
- Player::isInMelee
- Player::isJumping
- Player::isLeavingVehicle
- Player::isOnLadder
- Player::isReloading
- Player::name
- Player::packetLoss
- Player::ping
- Player::seat
- Player::socialClub
- Player::streamedPlayers
- Player::vehicle
- Player::voiceListeners
- Player::disableOutgoingSync
- Player::weapon
- Player::weaponAmmo
- Player::weapons
- Entity::alpha
- Entity::data
- Entity::dimension
- Entity::id
- Entity::model
- Entity::position
- Entity::type