Stream problem - /radio [0-20] - 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: Stream problem - /radio [0-20] (
/showthread.php?tid=601067)
Stream problem - /radio [0-20] -
Saddin - 16.02.2016
When i type /radio 1, it plays two streams 1 and 2.
When i type /radio 1 again, it plays 3 and 4 stream.
When i spam that command, there is more and more streams to play at one time
Код:
YCMD:radio(playerid, params[], help) //Komanda za radio
{
#pragma unused help
new x_nr[128];
new hID;
hID = GetPlayerVehicleID(playerid);
if(IsPlayerConnected(playerid) && gPlayerLogged[playerid] == 0) return LOGINGRESKA
if(PlayerInfo[playerid][pSpawn] == 5) return AREAGRESKA
//if(IsBike(hID)) return BIKEGRESKARADIO
if(IsPlayerInVehicle(playerid, hID))
{
if(sscanf(params, "{u}", x_nr)) return SCM(playerid, C_KORISTENJE, "[UPUTA]: /radio [0-20]");
if(strcmp(x_nr, "0", true) == 0)
{
StopAudioStreamForPlayer(playerid);
PlayerRadio[playerid]=0;
new stringgh[512];
format(stringgh, sizeof(stringgh), "RADIO: ~w~%d", PlayerRadio[playerid]);
PlayerTextDrawSetString(playerid, Brzinomjer[4][playerid], stringgh);
}
if(strcmp(x_nr, "1", true) == 0)
{
PlayAudioStreamForPlayer(playerid, "http://80.237.157.49:8070/");
PlayerRadio[playerid]=1;
new stringgh[512];
format(stringgh, sizeof(stringgh), "RADIO: ~w~%d", PlayerRadio[playerid]);
PlayerTextDrawSetString(playerid, Brzinomjer[4][playerid], stringgh);
}
if(strcmp(x_nr, "2", true) == 0)
{
PlayAudioStreamForPlayer(playerid, "http://80.237.157.49:8070/");
PlayerRadio[playerid] = 1;
new string[120];
format(string, sizeof(string), "RADIO: ~w~%d", PlayerRadio[playerid]);
PlayerTextDrawSetString(playerid, Brzinomjer[4][playerid], string);
}
}
return 1;
}
Re: Stream problem - /radio [0-20] -
Jefff - 16.02.2016
pawn Код:
YCMD:radio(playerid, params[], help) //Komanda za radio
{
#pragma unused help
if(gPlayerLogged[playerid] == 0) return LOGINGRESKA
if(PlayerInfo[playerid][pSpawn] == 5) return AREAGRESKA
//if(IsBike(hID)) return BIKEGRESKARADIO
if(GetPlayerVehicleID(playerid) > 0)
{
new x_nr;
if(sscanf(params, "i", x_nr)) SCM(playerid, C_KORISTENJE, "[UPUTA]: /radio [0-20]");
else if(!(-1 < x_nr < 21)) SCM(playerid, C_KORISTENJE, "[0-20]");
else
{
new string[120];
PlayerRadio[playerid] = x_nr;
format(string, sizeof(string), "RADIO: ~w~%d", PlayerRadio[playerid]);
PlayerTextDrawSetString(playerid, Brzinomjer[4][playerid], string);
switch(x_nr)
{
case 0: StopAudioStreamForPlayer(playerid);
case 1: PlayAudioStreamForPlayer(playerid, "http://80.237.157.49:8070/");
case 2: PlayAudioStreamForPlayer(playerid, "http://80.237.157.49:8070/");
}
}
}
return 1;
}