- Версия MoonLoader
- .027.0-preview
lua:
require "moonloader"
local sampev = require "lib.samp.events"
local isEnabled = true -- Default to enabled
local soundId = 0
function main()
while not isSampAvailable() do wait(0) end -- Wait for SA-MP to become available
sampAddChatMessage("{3498DB}Checkshamal by V", -1)
sampRegisterChatCommand("checkshamal", toggleShamalCheck)
soundId = loadAudioStream("shamal.mp3")
end
function toggleShamalCheck()
isEnabled = not isEnabled
if isEnabled then
sampAddChatMessage("{2471A3}Checkshamal{FFFFFF} has been {0FFF00}Enabled", -1)
else
sampAddChatMessage("{2471A3}Checkshamal{FFFFFF} has been {FF0000}Disabled", -1)
end
end
function checkShamal()
if isEnabled then
local vehicles = sampGetVehiclePool()
for i = 1, #vehicles do
local modelId = sampGetVehicleModel(vehicles[i])
if modelId == 519 then -- Model ID of Shamal vehicle
playAudioStream(soundId)
return
end
end
end
end
sampAddChatMessage("{FF0000}Script loaded successfully! Use /checkshamal to toggle Shamal vehicle check.", -1)
main()
code supposed to play a sound when vehicle shamal is in player streamzone the code works but it doesn't play sound anyone can help me out with this?