Skip to content

Commit ff4b912

Browse files
authored
Merge pull request #32 from bauxiteDYS/master
Updated nt_radio.sp to use modern syntax and added volume control
2 parents b0af58f + d4f3f90 commit ff4b912

1 file changed

Lines changed: 32 additions & 47 deletions

File tree

scripting/nt_radio.sp

Lines changed: 32 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
#pragma semicolon 1
2+
#pragma newdecls required
23

34
#include <sourcemod>
45
#include <sdktools>
5-
6-
#define PLUGIN_VERSION "1.0.5"
7-
8-
new String:Playlist[][] = {
9-
"../soundtrack/101 - annul.mp3",
10-
"../soundtrack/102 - tinsoldiers.mp3",
11-
"../soundtrack/103 - beacon.mp3",
12-
"../soundtrack/104 - imbrium.mp3",
13-
"../soundtrack/105 - automata.mp3",
14-
"../soundtrack/106 - hiroden 651.mp3",
15-
"../soundtrack/109 - mechanism.mp3",
16-
"../soundtrack/110 - paperhouse.mp3",
17-
"../soundtrack/111 - footprint.mp3",
18-
"../soundtrack/112 - out.mp3",
19-
"../soundtrack/202 - scrap.mp3",
20-
"../soundtrack/207 - carapace.mp3",
21-
"../soundtrack/208 - stopgap.mp3",
22-
"../soundtrack/209 - radius.mp3",
23-
"../soundtrack/210 - rebuild.mp3"
6+
#include <neotokyo>
7+
8+
#define PLUGIN_VERSION "1.1.0"
9+
10+
char Playlist[][] = {
11+
"#../soundtrack/101 - annul.mp3",
12+
"#../soundtrack/102 - tinsoldiers.mp3",
13+
"#../soundtrack/103 - beacon.mp3",
14+
"#../soundtrack/104 - imbrium.mp3",
15+
"#../soundtrack/105 - automata.mp3",
16+
"#../soundtrack/106 - hiroden 651.mp3",
17+
"#../soundtrack/109 - mechanism.mp3",
18+
"#../soundtrack/110 - paperhouse.mp3",
19+
"#../soundtrack/111 - footprint.mp3",
20+
"#../soundtrack/112 - out.mp3",
21+
"#../soundtrack/202 - scrap.mp3",
22+
"#../soundtrack/207 - carapace.mp3",
23+
"#../soundtrack/208 - stopgap.mp3",
24+
"#../soundtrack/209 - radius.mp3",
25+
"#../soundtrack/210 - rebuild.mp3"
2426
};
2527

26-
new bool:RadioEnabled[MAXPLAYERS+1];
28+
bool RadioEnabled[NEO_MAXPLAYERS+1];
2729

28-
public Plugin:myinfo =
30+
public Plugin myinfo =
2931
{
3032
name = "NEOTOKYO° Radio",
3133
author = "Soft as HELL",
@@ -34,7 +36,7 @@ public Plugin:myinfo =
3436
url = ""
3537
};
3638

37-
public OnPluginStart()
39+
public void OnPluginStart()
3840
{
3941
CreateConVar("sm_ntradio_version", PLUGIN_VERSION, "NEOTOKYO° Radio Version", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
4042

@@ -44,26 +46,26 @@ public OnPluginStart()
4446
RegConsoleCmd("sm_radiooff", Cmd_Radio);
4547
}
4648

47-
public OnClientPutInServer(client)
49+
public void OnClientPutInServer(int client)
4850
{
4951
RadioEnabled[client] = false;
5052
}
5153

52-
public OnClientDisconnect(client)
54+
public void OnClientDisconnect(int client)
5355
{
5456
RadioEnabled[client] = false;
5557
}
5658

57-
public Play(client) {
59+
void Play(int client) {
5860
if(!IsValidClient(client))
5961
return;
6062

61-
new Song = GetRandomInt(0, sizeof(Playlist)-1);
63+
int Song = GetRandomInt(0, sizeof(Playlist)-1);
6264

63-
ClientCommand(client, "play \"%s\"", String:Playlist[Song][0]);
65+
ClientCommand(client, "play \"%s\"", Playlist[Song][0]);
6466
}
6567

66-
public Action:Cmd_Radio(client, args)
68+
public Action Cmd_Radio(int client, int args)
6769
{
6870
RadioEnabled[client] = !RadioEnabled[client];
6971

@@ -79,27 +81,10 @@ public Action:Cmd_Radio(client, args)
7981
return Plugin_Handled;
8082
}
8183

82-
public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast){
83-
for(new i = 1; i <= MaxClients; i++)
84+
public Action Event_RoundStart(Event event, const char[] name, bool dontBroadcast){
85+
for(int i = 1; i <= MaxClients; i++)
8486
if(IsValidClient(i) && RadioEnabled[i])
8587
Play(i);
8688

8789
return Plugin_Continue;
8890
}
89-
90-
bool:IsValidClient(client){
91-
92-
if (client == 0)
93-
return false;
94-
95-
if (!IsClientConnected(client))
96-
return false;
97-
98-
if (IsFakeClient(client))
99-
return false;
100-
101-
if (!IsClientInGame(client))
102-
return false;
103-
104-
return true;
105-
}

0 commit comments

Comments
 (0)