[Include] Dynamic Radio in Vehicles
#1

Hello,

Today I release another script I made, the "Dynamic Radio in Vehicles". This script is designed to easily add real existing radio stations to the game. It simply replaces the old radio.

pawn Код:
stock AddRadioStation(name[NAME_SIZE], link[LINK_SIZE])
// name: The name of the radio station (which will show ingame when changing stations).
// link: The link to the audio stream.
You can install this by putting...

pawn Код:
#include "DynamicRadioStations"
... at the top of your gamemode or filterscript (filterscript since R2)

Using it ingame
There are three new buttons added in SA-MP 0.3d, and we will use two of them: Y and N.
Y -> Station Next
N -> Station Back

You can also choose different styles for the textdraw (since R5)
pawn Код:
#define USE_TEXTDRAW_SET [ID]
For those who are interested in how te styles look; I uploaded a picture of them.
ID 0: http://i.imgur.com/zqqCi.png
ID 1: http://i.imgur.com/hIsYh.png
ID 2: http://i.imgur.com/vSjoj.png

I can only say, check it out!

Credits
Jochemd - Creating this script (not too hard)
****** - y_hooks
Jakku - I asked him for help when the hooks didn't work well.

Changelog
Код:
R7
- The textdraw is now per-player instead of per-vehicle, which saves A LOT of textdraws. Note: I did not use PlayerTextDraws, but a loop with normal textdraws.
R6
- Added GetRadioStationsString() which returns all names of the stations (NAME1\nNAME2\nNAME3). This allows you to create command like /setstation (see example) and /allstations.
- Bugfix in SetRadioStation.
R5
- Fixed a bug: People were able to switch radio stations on foot.
- Changed the hooks OnGameModeInit and OnFilterScriptInit to stocks to save script space.
- Added GetVehicleRadioStation(vehicleid) and SetVehicleRadioStation(vehicleid, stationid) (useful if you want to make a 'favourites' script, for example).
- Rewrote almost whole code in another style.
- Added several textdraw styles. You can now choose one you prefer using a define! Credits to Jakku for creating some styles
- The radio stations are now synced per vehicle. When a passenger changes the radio station, the driver sees it and the same goes for when the driver changes it.
R4
- Fixed bug: When you spawn, server crashes. Update strongly recommended!
R3
- Fixed bug: Array sizes do not match (error 47).
- Fixed bug: Music doesn't stop when you exit the vehicle.
- Fixed bug: "symbol" has been truncated to "size". I have just shrinked the hooks.
R2: 
- Now you can use this in an filterscript as well!
- Fixed a bug where the last one wouldn't be called because the cell assignment starts from 0. Thanks to CyNiC!
Download
http://pastebin.com/5yKug2wj (R7)
Example for GetRadioStationsString() http://pastebin.com/raw.php?i=m45qNVeR (note: copy it to your PAWN editor for a better reading experience with syntax highlighting.)

Please note this is not a filterscript, but an include! You have to use "AddRadioStation" in your gamemode/filterscript!
Reply


Messages In This Thread
Dynamic Radio in Vehicles (R6) - by Jochemd - 05.01.2012, 15:34
Re: Dynamic Radio in Vehicles - by caribe88 - 05.01.2012, 15:40
Re: Dynamic Radio in Vehicles - by X3nZ - 05.01.2012, 15:51
Re: Dynamic Radio in Vehicles - by CyNiC - 05.01.2012, 15:55
Re: Dynamic Radio in Vehicles - by Jochemd - 05.01.2012, 16:01
Re: Dynamic Radio in Vehicles - by [GTA-PR]Temper - 06.01.2012, 12:05
Re: Dynamic Radio in Vehicles - by Michael@Belgium - 06.01.2012, 18:37
Re: Dynamic Radio in Vehicles - by Jochemd - 07.01.2012, 07:51
Re: Dynamic Radio in Vehicles - by robintjeh - 08.01.2012, 20:08
Re: Dynamic Radio in Vehicles - by Hugo1984 - 08.01.2012, 20:56

Forum Jump:


Users browsing this thread: 1 Guest(s)