Adding sounds to countdown? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Adding sounds to countdown? (
/showthread.php?tid=152148)
Adding sounds to countdown? -
Jay. - 02.06.2010
Hey guys i've made a countdown system but i wanna no how to add sounds to them..
If you can help please reply thanks
Heres the code
Код:
#define FILTERSCRIPT
#include <a_samp>
new counter;
new countTimer;
forward timer();
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
counter = 0;
return 1;
}
public OnFilterScriptExit()
{
counter = 0;
return 1;
}
#else
main()
{
print("\n------------------------------------------");
print(" Countdown");
print("------------------------------------------\n");
}
#endif
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/countdown", true) || !strcmp(cmdtext, "/countdown", true))
{
if(counter != 0)
return SendClientMessage(playerid,0x004BFFFF, "ERROR: /countdown is already in use, Try again in a few minutes.");
countTimer = SetTimer("timer", 1000, true);
return true;
}
return 0;
}
public timer()
{
counter++;
if(counter == 1)
GameTextForAll("3", 500, 3);
else if(counter == 2)
GameTextForAll("2", 500, 3);
else if(counter == 3)
GameTextForAll("1", 500, 3);
else if(counter == 4)
{
GameTextForAll("GO GO GO!!", 500, 2000);
counter = 0;
KillTimer(countTimer);
}
return true;
}
Re: Adding sounds to countdown? -
Jay. - 02.06.2010
anyone?
EDIT: Sorry for bump
Re: Adding sounds to countdown? -
Sir_Brock - 02.06.2010
Seriously?
Look where you game text's are for 3, 2, 1, go and add some PlayerPlaySound's or whatever they are called.
Lazy.
Re: Adding sounds to countdown? -
Jay. - 02.06.2010
Quote:
Originally Posted by [NoV
Austin ]
Seriously?
Look where you game text's are for 3, 2, 1, go and add some PlayerPlaySound's or whatever they are called.
Lazy.
|
Erm dude i've tryed that but i get errors. ..
Re: Adding sounds to countdown? -
Sir_Brock - 02.06.2010
Because the Timer function has no PLAYERID.
Re: Adding sounds to countdown? -
Jay. - 02.06.2010
Quote:
Originally Posted by [NoV
Austin ]
Because the Timer function has no PLAYERID.
|
can u give me a example of adding Sounds to them cuz i'm trying but i get errors.
Re: Adding sounds to countdown? -
Killa_ - 02.06.2010
Try sumin like this.
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
new Counter;
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
Counter = 0;
return 1;
}
public OnFilterScriptExit()
{
Counter = 0;
return 1;
}
#else
main()
{
print("\n------------------------------------------");
print(" Countdown");
print("------------------------------------------\n");
}
#endif
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/countdown", true))
{
if(Counter != 0) return SendClientMessage(playerid,0x004BFFFF, "ERROR: /countdown is already in use, Try again in a few seconds.");
Counter = 3;
Timer();
return 1;
}
return 0;
}
forward Timer();
public Timer()
{
new String[64];
if(Counter == 0)
{
for(new i = 0; i < GetMaxPlayers(); i++)PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
GameTextForAll("~g~~h~Go Go Go !!", 1250, 5);
return 1;
}
format(String,sizeof(String),"~r~~h~%d",Counter);
GameTextForAll(String, 1250, 5);
for(new i = 0; i < GetMaxPlayers(); i++)PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
Counter--;
SetTimer("Timer", 1000, false);
return 0;
}
Re: Adding sounds to countdown? -
Jay. - 02.06.2010
Quote:
Originally Posted by Killa_
Try sumin like this.
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
new Counter;
#if defined FILTERSCRIPT
public OnFilterScriptInit() { Counter = 0; return 1; }
public OnFilterScriptExit() { Counter = 0; return 1; } #else
main() { print("\n------------------------------------------"); print(" Countdown"); print("------------------------------------------\n"); }
#endif
public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp(cmdtext, "/countdown", true)) { if(Counter != 0) return SendClientMessage(playerid,0x004BFFFF, "ERROR: /countdown is already in use, Try again in a few seconds."); Counter = 3; Timer(); return 1; } return 0; }
forward Timer(); public Timer() { new String[64]; if(Counter == 0) { for(new i = 0; i < GetMaxPlayers(); i++)PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0); GameTextForAll("~g~~h~Go Go Go !!", 1250, 5); return 1; } format(String,sizeof(String),"~r~~h~%d",Counter); GameTextForAll(String, 1250, 5); for(new i = 0; i < GetMaxPlayers(); i++)PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0); Counter--; SetTimer("Timer", 1000, false); return 0; }
|
Thanks killa_
It works..
Re: Adding sounds to countdown? -
Sir_Brock - 02.06.2010
That will do the sound for everyone.
Re: Adding sounds to countdown? -
Killa_ - 03.06.2010
I think thats what he wants, otherwise why display the gametext for everyone?