meta data for this page
Vehicles/VehicleScripts/NetworkEvents/EventPlaySingleSound.lua
This file contains an event that triggers a single sound event in VehicleMotor.
25 EventPlaySingleSound = EventPlaySingleSound or ExtensionOf(BaseEvent); 26 27 InitVanillaEvent(EventPlaySingleSound, "EventPlaySingleSound"); 28 29 function EventPlaySingleSound:sendData(entity, soundType, soundId) 30 -- only send sounds on server, because server is the only on, that calculates the sound trigger events 31 if g_isServer then 32 streamWriteEntityId(entity); 33 streamWriteInt8(soundType); 34 streamWriteInt8(soundId); 35 end; 36 end; 37 38 function EventPlaySingleSound:receiveData(connection) 39 -- only client can recieve those sound events 40 if g_isClient then 41 local entity = streamReadEntityId(); 42 local soundType = streamReadInt8(); 43 local soundId = streamReadInt8(); 44 45 if entity ~= nil then 46 entity:playSingleEventSound(soundType, soundId, true); 47 end; 48 49 self:broadcastEvent(connection, soundType, soundId); 50 end; 51 end;
Copyright
All contents of this page may be used for modding use for Winter Resort Simulator - Season 2 only. Any use exceeding this regulation is not permitted.
Copyright (C) HR Innoways, 2021. All Rights Reserved.