Adding sounds to countdown?
#1

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;
}
Reply
#2

anyone?

EDIT: Sorry for bump
Reply
#3

Seriously?

Look where you game text's are for 3, 2, 1, go and add some PlayerPlaySound's or whatever they are called.

Lazy.
Reply
#4

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. ..
Reply
#5

Because the Timer function has no PLAYERID.
Reply
#6

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.
Reply
#7

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;
}
Reply
#8

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..
Reply
#9

That will do the sound for everyone.
Reply
#10

I think thats what he wants, otherwise why display the gametext for everyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)