I seem to have a little problem with passing an argument from clientside to serverside using “RunConsoleCommand”. (Maybe I just don’t get it.)
What I’m trying to do is something like:
When a player is inside a vehicle, and pressed the key IN_ATTACK.
The player runs a console command and passes on the vehicle entity so my serverside script can emit a sound.
Here is what I had in mind(simplified version),
Player = LocalPlayer()
if Player:InVehicle then vehicle = Player:GetVehicle() if Player:KeyPressed(IN_ATTACK) then Player:RunConsoleCommand("VehicleHorn", vehicle) end end
hook.Add(“KeyPressed”, “SoundThatClaxon”, VehicleClaxon)
local Pitch = 100;
local SoundLevel = 100;
vehicle:EmitSound("insert sound here", Pitch, SoundLevel)
Am I doing something like totally wrong, or?