Jump to content

pomoc Pomoc PlaySystem


LafreSK

Recommended Posts

Ahoj lidi mam takovej problem..........všetko ide ale tak ako by som chcel....chcem aby mi hralo automaticky radio bez toho aby to musel nekdo zapnut(vysvetlenie radšej ukažte kod pochopím lepšie!)

ale pre moj ciel to bude asi chcet zmenit celý kod :/

 

ešte som na pawno nič nevkladal tak snaď pochopite

predem diky za radu :)

 

 

#include <a_samp>
#include <a_players>
 
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext,"/stopradioall",true)==0) return StopAudioStreamForPlayer(playerid);
if(!strcmp(cmdtext, "/gentleman", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul global playback hudbu : Gentleman",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 0;
}
if(!strcmp(cmdtext, "/balada", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul global playback hudbu : Balada Boa",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 0;
}
if(!strcmp(cmdtext, "/bara", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : Bara Bara Bara",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 0;
}
if(!strcmp(cmdtext, "/thrift", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : Thrift Shop",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 0;
}
if(!strcmp(cmdtext, "/gangnam", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul global hudbu : Gangnam Style",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 0;
}
if(!strcmp(cmdtext, "/whistle", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : Whistle",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 0;
}
if(!strcmp(cmdtext, "/wild", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : Wild Ones",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 0;
}
if(!strcmp(cmdtext, "/danza", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : Danza Kudro",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 0;
}
if(!strcmp(cmdtext, "/ilove", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : International Love",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 0;
}
if(!strcmp(cmdtext, "/scream", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : Scream And Shout",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 0;
}
if(!strcmp(cmdtext, "/alors", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : Alos On Dance",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 0;
}
if(!strcmp(cmdtext, "/wolf", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : She Wolf",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 0;
}
return 0;
}
 
stock GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
Link to comment
Share on other sites

CHYBA ?

//EDIT : TAK ? JA TO MAM BEZ CHYB. :)

#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext,"/stopradioall",true)==0)
{
StopAudioStreamForPlayer(playerid);
return 1;
}
if(!strcmp(cmdtext, "/gentleman", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
PlayAudioStreamForPlayer(i,"http://k002.kiwi6.co...-_gentleman.mp3");
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul global playback hudbu : Gentleman",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 1;
}
if(!strcmp(cmdtext, "/balada", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
PlayAudioStreamForPlayer(i,"http://k002.kiwi6.co...re_tch_tch_.mp3");
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul global playback hudbu : Balada Boa",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 1;
}
if(!strcmp(cmdtext, "/bara", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
PlayAudioStreamForPlayer(i,"http://k002.kiwi6.co...ere_2012_hd.mp3");
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : Bara Bara Bara",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 1;
}
if(!strcmp(cmdtext, "/thrift", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
PlayAudioStreamForPlayer(i,"http://k002.kiwi6.co...wanz_lyrics.mp3");
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : Thrift Shop",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 1;
}
if(!strcmp(cmdtext, "/gangnam", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
PlayAudioStreamForPlayer(i,"http://k007.kiwi6.co...e_-----_m_v.mp3");
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul global hudbu : Gangnam Style",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 1;
}
if(!strcmp(cmdtext, "/whistle", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
PlayAudioStreamForPlayer(i,"http://k002.kiwi6.co...cial_video_.mp3");
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : Whistle",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 1;
}
if(!strcmp(cmdtext, "/wild", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
PlayAudioStreamForPlayer(i,"http://k002.kiwi6.co..._official_v.mp3");
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : Wild Ones",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 1;
}
if(!strcmp(cmdtext, "/danza", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
PlayAudioStreamForPlayer(i,"http://k007.kiwi6.co...ft._lucenzo.mp3");
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : Danza Kudro",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 1;
}
if(!strcmp(cmdtext, "/ilove", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
PlayAudioStreamForPlayer(i,"http://k007.kiwi6.co...tional_love.mp3");
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : International Love",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 1;
}
if(!strcmp(cmdtext, "/scream", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
PlayAudioStreamForPlayer(i,"http://k002.kiwi6.co...t_ft._britn.mp3");
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : Scream And Shout",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 1;
}
if(!strcmp(cmdtext, "/alors", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
PlayAudioStreamForPlayer(i,"http://k007.kiwi6.co...rs_on_danse.mp3");
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : Alos On Dance",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 1;
}
if(!strcmp(cmdtext, "/wolf", true))
{
new string[256];
for(new i; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
PlayAudioStreamForPlayer(i,"http://k007.kiwi6.co...ing_to_piec.mp3");
format(string,sizeof(string),"{FF0000} AudioStream : Administrator %s zapnul hudbu : She Wolf",GetName(playerid));
SendClientMessageToAll(0xFFFF00C8,string);
return 1;
}
return 0;
}

stock GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
Link to comment
Share on other sites

Pokud chces aby hralo automaticky ,tak si nejdriv musis uvedomit co to vlastne znamena. tzn kdy to ma hrat.

Jinak muzes prehravat pouze jednu skladbu a ne vsechny najednou

Link to comment
Share on other sites

Pokud mluvis o randomu, tak potom by kazdymu hraci hral jinej song...

Nekdo my poradil "nastav si to ako tipy"

ale splnilo by to ciel???

aby to admin nebo hrač nemusel puštat??

S pawnom som začiatočnik nejaké veci som spravil ale toto vubec ma nic nenapadá preto to išlo semka :)

Link to comment
Share on other sites

Malo by to fungovat tak že by sa automatický hrač prihlasil na server

a hrali by pesničky bez žiadneho prikazu!!!

2.) alebo že by admin napis napr:/play a hralo by to neustale pokial by to nevypol alebo sa nerestartoval sevrer

ktorá možnosť znie realnejšie??

Link to comment
Share on other sites

enum pisnicky
{
	nazev[32],
	link[256],
	delka
}
new Pisnicky[][pisnicky] = {//seznam pisnicek v play listu v tomto poradi: {"nazev","link na skladku",delka_v_milisekundach}
	{"Gentleman","http://k002.kiwi6.com/hotlink/l1245bz226/psy_-_gentleman.mp3",3140},
	{"Balada Boa","http://k002.kiwi6.co...re_tch_tch_.mp3",3270}//posledni radek nema carku na konci !
};

public OnGameModeInit()
{
	NextSong(0);//pri startu modu spusti song
	return 1;
}
forward NextSong(id);
public NextSong(id)
{
	new string[144];
	format(string,sizeof(string),"Právě hraje: %s",Pisnicky[id][nazev]);
        SendClientMessageToAll(0xFFFF00C8,string);
	for(new i;i<MAX_PLAYERS;i++)
	{
		if(IsPlayerConnected(i)) PlayAudioStreamForPlayer(i,Pisnicky[id][link]);//spusti aktualni song z play listu
	}
	new song = id+1;//skok na dalsi skladbu
	if(song >= sizeof(Pisnicky)) song = 0;//pokud se prehrava posledni skladba jde to zase odznova
	SetTimerEx("NextSong",Pisnicky[id][delka],0,"i",song);//pusti se timer, ktery spusti dalsi pisnicku, az ta co se ted zapla skonci
	return 1;
}

Ma to jeden nedostatek, kvuli synchronizaci pisnicek nezacne hrat hudba hned jak se hrac pripoji, ale jakmile se zapne dalsi song z play listu

Jo a u kazde pisnicky si musis zjistit jak je dlouha

 

Napsal jsem to tedka "na kolene" tak pripadny chyby si oprav :)

Link to comment
Share on other sites

Skusim predovšetkom diky Atomasi

 

mal si tam chybu napisal si enum pisniky

 

Chyba: malo byt pisnicky ale to je v pohode aspon viem ze dokazem najst chybu .)

 

ale zatim diky


ešte jedna otazka ako zistim presný čas milisecundách v pisničke??

Link to comment
Share on other sites

diky ale ukazuje že to hraje dialog ale pritom hudba nikde???

skusim dat par vecí preč a ked to nepude nwm


stale do okola každých 5 seucnd ukazuje hudbu a nič nehraje

 

napr: Hraje Balada Boa

a ten link

a strašne rychlo to prehadzuje a nič nejde

Link to comment
Share on other sites

#include <a_samp>

 

#pragma tabsize 0

 

#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

 

 

enum pisnicky

{

nazev[32],

link[256],

delka

}

new Pisnicky[][pisnicky] = {//seznam pisnicek z play listu v tomto poradi: {"nazev","link na skladku",delka_v_milisekundach}

{"Gentleman","http://k002.kiwi6.co...-_gentleman.mp3",3140},

{"Bara Bare","http://k002.kiwi6.co...ere_2012_hd.mp3",3410},

    {"Trift Shop","http://k002.kiwi6.co...wanz_lyrics.mp3",3520},

{"Gangnam style","http://k007.kiwi6.co...e_-----_m_v.mp3",5030},

{"Whistle","http://k002.kiwi6.co...cial_video_.mp3",3550},

{"J.J.Wild","http://k002.kiwi6.co..._official_v.mp3",4470},

    {"Don omar","http://k007.kiwi6.co...ft._lucenzo.mp3",3190},

    {"international love","http://k007.kiwi6.co...tional_love.mp3",3470},

    {"Scream And Shout","http://k002.kiwi6.co...t_ft._britn.mp3",4550},

    {"She Wolf","http://k007.kiwi6.co...ing_to_piec.mp3",3110},

    {"Alos On Dance","http://k007.kiwi6.co...rs_on_danse.mp3",4290},

{"Balada Boa","http://k002.kiwi6.co...re_tch_tch_.mp3",3270}//posledni radek nema carku na konci !

};

 

public OnGameModeInit()

{

NextSong(0);//pri startu modu spusti song

return 1;

}

forward NextSong(id);

public NextSong(id)

{

new string[144];

format(string,sizeof(string),"Právě hraje: %s",Pisnicky[id][nazev]);

for(new i;i<MAX_PLAYERS;i++)

{

if(IsPlayerConnected(i))

{

PlayAudioStreamForPlayer(i,Pisnicky[id][link]);//spusti aktualni song z play listu

SendClientMessageToAll(0xFFFF00C8,string);

}

}

new song = id+1;

if(song >= sizeof(Pisnicky)) song = 0;//pokud se prehrava posledni skladba jde to zase odznova

SetTimerEx("NextSong",Pisnicky[id][delka],0,"i",song);//pusti se timer, ktery spusti dalsi pisnicku, az ta co se ted zapla skonci

return 1;

}
Link to comment
Share on other sites

Ja teda nevim ale kdyz kliknu na nejaky z tech odkazu co jsi tady postnul tak mi to otevre tohle tema, zato kdyz kliknu na nejaky z odkazu co jsou v prvnim prispevku tak to zacne normalne hrat...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...