Filterscript commands not work [+ rep for answer] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Filterscript commands not work [+ rep for answer] (
/showthread.php?tid=335732)
Filterscript commands not work [+ rep for answer] -
alexharvey52 - 19.04.2012
My filterscript is loading on the server however the commands dont work , just says unknown command and I cant work out why
Here is my fs:
pawn Код:
#include <a_samp>
#define music (993)
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Music By Alex Harvey");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!IsPlayerAdmin(playerid)) return 0;
if (strcmp("/music", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, music, DIALOG_STYLE_LIST, "Music Player", "FragRadio\nPendulum - Blood Sugar\nSwedish House Mafia - Greyhound\nWill.I.AM - T.H.E\nRise Against - Savior\nStop Music", "Done", "Cancel");
return 1;
}
if(!IsPlayerAdmin(playerid)) return 0;
if (strcmp("/music bloodsugar", cmdtext, true, 10) == 0)
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayAudioStreamForPlayer(i, "http://dl.dropbox.com/u/60570065/01%20Blood%20Sugar.ogg");
}
if(!IsPlayerAdmin(playerid)) return 0;
if (strcmp("/music greyhound", cmdtext, true, 10) == 0)
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayAudioStreamForPlayer(i, "http://dl.dropbox.com/u/60570065/20%20Swedish%20House%20Mafia%20-%20Greyhound.mp3");
}
if(!IsPlayerAdmin(playerid)) return 0;
if (strcmp("/muisc willthe", cmdtext, true, 10) == 0)
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayAudioStreamForPlayer(i, "http://dl.dropbox.com/u/60570065/01%20T.H.E%20%28The%20Hardest%20Ever%29%20%5Bfeat.%20M.mp3");
}
if(!IsPlayerAdmin(playerid)) return 0;
if (strcmp("/music savior", cmdtext, true, 10) == 0)
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayAudioStreamForPlayer(i, "http://dl.dropbox.com/u/60570065/Savior.MP3");
}
if(!IsPlayerAdmin(playerid)) return 0;
if (strcmp("/music fragradio", cmdtext, true, 10) == 0)
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayAudioStreamForPlayer(i, "http://stream.fragradio.co.uk:8000/live");
}
if(!IsPlayerAdmin(playerid)) return 0;
if (strcmp("/music stop", cmdtext, true, 10) == 0)
for(new i = 0; i < MAX_PLAYERS; i++)
{
StopAudioStreamForPlayer(i);
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == music)
{
if(response)
{
switch(listitem)
{
case 0:
{
OnPlayerCommandText(playerid, "/music fragradio");
}
case 1:
{
OnPlayerCommandText(playerid, "/music bloodsugar");
}
case 2:
{
//Selected Item: " No 3"
}
case 3:
{
//Selected Item: " No 4"
}
case 4:
{
//Selected Item: " No5"
}
}
}
}
return 0;
}
Re: Filterscript commands not work [+ rep for answer] -
Thomas. - 19.04.2012
It seems that you must be logged in as a RCON admin to be able to use these commands.
Also note that you are returning 0 even if a command was successfully executed, causing the 'Unknown command' messages.
Re: Filterscript commands not work [+ rep for answer] -
alexharvey52 - 19.04.2012
Yeah forgot i had to login as rcon admin , thanks for reminding me

+rep
Re: Filterscript commands not work [+ rep for answer] -
[DOG]irinel1996 - 19.04.2012
You should use
return 1;
pawn Код:
if(!IsPlayerAdmin(playerid)) return 1;
Best regards!