ayuda como poner un sonido al final de cada ronda
#1

Si me preguntava como poner un sonido al final de cada rona, mapa de mi server ayuda

aqui dejo un gm que uso expliquenme donde puedo poner el sonido para cuando acaba un ronda los jugadores puedan oirla (todos los jugadores la oigan)

Код:
#include <a_samp>
//==============================================================================
#undef MAX_PLAYERS
#define MAX_PLAYERS 50
//==============================================================================
static gTeam[MAX_PLAYERS];
//===============================[Teams]========================================
#define TEAM_CT 1
#define TEAM_TT 2
//============================[Forwards]========================================
forward SendCounterMessage(color, string[]);
forward SendTerrorMessage(color, string[]);
forward SetPlayerSpawn(playerid);
forward DMTimer(playerid);
forward TextClear(playerid);
//==============================================================================
new TeamWarning[MAX_PLAYERS];
//==============================[Textdraws]=====================================
new Text:scoretext;
new Text:Time;
new Text:teamtext;
//==============================[Others]========================================
new ctscore;
new ttscore;
new DMTime;
new realchat = 1;
new dmtimer;
new CTcount;
new TTcount;
//==============================================================================
main()
{
}
//==============================================================================
public OnGameModeInit()
{
	DMTime = 350;
	ctscore=0;
    ttscore=0;
    CTcount = 0;
    TTcount = 0;
    SendRconCommand("mapname Tuneles 2");
    SendRconCommand("reloadfs admin");
//=================================[Objects]===========================
//===================================[Score]====================================
    scoretext = TextDrawCreate(244, 428, " ");
    TextDrawFont(Text:scoretext, 1);
    TextDrawLetterSize(Text:scoretext, 0.599999,2.100000);
    TextDrawColor(Text:scoretext, 0xffffffff);
    TextDrawBackgroundColor(Text:scoretext, 0x000000ff);
    TextDrawSetOutline(Text:scoretext, 1);
	TextDrawSetProportional(Text:scoretext, 2);
    TextDrawSetShadow(Text:scoretext, 1);
//=================================[Time]=======================================
    Time = TextDrawCreate(555.0,25.0, " ");
    TextDrawSetShadow(Text:Time, 0);
    TextDrawSetOutline(Text:Time, 1);
    TextDrawLetterSize(Text:Time,0.5,1.5);
//=========================[Team Balance Textdraw]==============================
    teamtext = TextDrawCreate(25, 145, "This team is full, please choose another one!");
    TextDrawAlignment(teamtext, 1);
    TextDrawFont(teamtext, 1);
    TextDrawLetterSize(teamtext, 0.39, 2.3);
    TextDrawColor(teamtext, 0xFFFFFFFF);
    TextDrawSetShadow(teamtext, 1);
    TextDrawSetProportional(teamtext, 1);
    TextDrawSetOutline(teamtext, 1);
    TextDrawUseBox(teamtext, 1);
    TextDrawTextSize(teamtext, 200, 210);
    TextDrawBoxColor(teamtext, 0x000000FF);
//=============================[Timers]=========================================
    dmtimer = SetTimer("DMTimer", 888,1);
	return 1;
}
//==============================================================================
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerClass(playerid, classid);
	SetPlayerInterior(playerid, 11);
	SetPlayerPos(playerid, 508.8771,-87.8426,998.9683);
    SetPlayerFacingAngle(playerid, 1);
    SetPlayerCameraPos(playerid, 508.8771,-83.6699,998.9609);
    SetPlayerCameraLookAt(playerid, 508.8771,-87.8426,998.9683);
	switch (classid)
	{
	    case 0..3: GameTextForPlayer(playerid, "~r~Bandas", 2000, 3);
	    case 4..7: GameTextForPlayer(playerid, "~b~Policias", 2000, 3);
    }
	return 1;
}
//==============================================================================
SetPlayerClass(playerid, classid)
{
    switch(classid)
    {
       case 0..3: { gTeam[playerid] = TEAM_TT; SetPlayerTeam(playerid, TEAM_TT); }
       case 4..7: { gTeam[playerid] = TEAM_CT; SetPlayerTeam(playerid, TEAM_CT); }
    }
}
//==============================================================================
public OnPlayerRequestSpawn(playerid)
{
    if(gTeam[playerid] == TEAM_CT && CTcount > TTcount)
	{
	    TextDrawShowForPlayer(playerid, teamtext);
        SetTimerEx("TextClear", 3000, false, "i", playerid);
	    return 0;
	}
	else if(gTeam[playerid] == TEAM_TT && TTcount > CTcount)
	{
	    TextDrawShowForPlayer(playerid, teamtext);
        SetTimerEx("TextClear", 3000, false, "i", playerid);
	    return 0;
	}
	return 1;
}
//==============================================================================
public OnPlayerConnect(playerid)
{
	TeamWarning[playerid] = 0;
}
//==============================================================================
public OnPlayerDisconnect(playerid, reason)
{
    if(gTeam[playerid] == TEAM_CT) CTcount --;
    else if(gTeam[playerid] == TEAM_TT) TTcount --;
	return 1;
}
//==============================================================================
public OnPlayerSpawn(playerid)
{
	SetPlayerSpawn(playerid);
	TextDrawHideForPlayer(playerid, teamtext);
	return 1;
}
//==============================================================================
public OnPlayerDeath(playerid, killerid, reason)
{
    new string[128];
	if(gTeam[killerid] == TEAM_CT) ctscore++;
    if(gTeam[killerid] == TEAM_TT ) ttscore++;
	if(gTeam[killerid] == gTeam[playerid])
	{
	    TeamWarning[killerid] ++;
	    SendClientMessage(killerid, 0xa9c4e4ff, "Don't team kill or you will get kicked.");
	    if(TeamWarning[killerid] >= 3)
	    {
	        format(string, sizeof(string), "AdmCmd: %s was kicked, reason: Excessive Team Killing.", PlayerName(killerid));
			SendClientMessageToAll(0xFF6347AA, string);
			Kick(killerid);
	    }
	}
    return 1;
}
//==============================================================================
public OnPlayerText(playerid, text[])
{
    new string[128];
    if(text[0] == '!')
	{
		format(string, sizeof(string), "[TEAM] %s [%d]: %s.", PlayerName(playerid),playerid, text[1]);
		if(gTeam[playerid] == TEAM_CT) SendCounterMessage(0xF97804FF, string);
		else if(gTeam[playerid] == TEAM_TT) SendTerrorMessage(0xF97804FF, string);
		return 0;
	}
    if(realchat)
	{
	    format(string, sizeof(string), "(%d): %s.", playerid, text[0]);
	    SendPlayerMessageToAll(playerid, string);
	    return 0;
	}
	return 1;
}
//==============================================================================
strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}
	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
//==============================================================================
public OnPlayerCommandText(playerid, cmdtext[])
{

    PlayerPlaySound(playerid, 1186, 0.0,0.0,0.0);

	new cmd[128];
    new idx;
    cmd = strtok(cmdtext, idx);
	if(strcmp(cmd, "/nextmap", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
		    for(new i = 0; i < MAX_PLAYERS; i++)
	        {
			    TogglePlayerControllable(i, 0);
			}
			SendRconCommand("changemode cs2");
		}
		return 1;
 }
	return 0;
}
//==============================================================================
stock right(source[], len)
{
	new retval[MAX_STRING], srclen;
	srclen = strlen(source);
	strmid(retval, source, srclen - len, srclen, MAX_STRING);
	return retval;
}

stock strvalEx( const string[] )
{
	if( strlen( string ) >= 50 ) return 0;
	return strval(string);
}
//==============================================================================
public SetPlayerSpawn(playerid)
{
	if(IsPlayerConnected(playerid))
	{
	    if(gTeam[playerid] == TEAM_CT)
    	{
    	    SetPlayerPos(playerid, 2581.2603,-1916.8545,8.2730);
    	    SetPlayerFacingAngle(playerid, 360.0);
    		SetPlayerInterior(playerid, 0);
            SetPlayerColor(playerid,0x2641FEAA);
            TogglePlayerControllable(playerid, 1);
            SetPlayerTeam(playerid, TEAM_CT);
            CTcount ++;
            return 1;
	    }
    	if(gTeam[playerid] == TEAM_TT)
    	{
    	    SetPlayerPos(playerid, 2581.6724,-1773.2089,6.0465);
    	    SetPlayerFacingAngle(playerid, 360.0);
    		SetPlayerInterior(playerid, 0);
    		SetPlayerColor(playerid,0xE60000FF);
    		TogglePlayerControllable(playerid, 1);
    		SetPlayerTeam(playerid, TEAM_TT);
    		TTcount ++;
    		return 1;
	    }
	}
	return 1;
}
//==============================================================================
public DMTimer()
{
    DMTime --;
    new tmp[256];
    format(tmp, sizeof tmp, "%s", TimeConvert(DMTime));
    TextDrawSetString(Text:Time, tmp);
    TextDrawShowForAll(Text:Time);
    format(tmp, sizeof(tmp), "~b~Policias: ~w~%d ~r~Bandas: ~w~%d", ctscore, ttscore);
	TextDrawSetString(Text:scoretext, tmp);
	TextDrawShowForAll(Text:scoretext);
    if (DMTime == 0)
    {
        if(ctscore > ttscore) { GameTextForAll("~w~ The round is over, ~b~Policias ~w~win.", 3000, 5); }
        else if(ttscore > ctscore) { GameTextForAll("~w~ The round is over, ~r~Bandas ~w~win.", 3000, 5); }
        else if(ctscore == ttscore) { GameTextForAll("~y~ The round is over, ~y~Draw.", 3000, 5); }
		SendRconCommand("changemode cs2");
		KillTimer(dmtimer);
        GameTextForAll("~w~Server:~r~ Loading Next map",5000,4);
	 }
    return 1;
}
//==============================================================================
TimeConvert(seconds)
{
    new tmp[256];
    new minutes = floatround(seconds/60);
    seconds -= minutes*60;
    format(tmp, sizeof(tmp), "%d:%02d", minutes, seconds);
    return tmp;
}
//==============================================================================
stock PlayerName(playerid)
{
      new name[255];
      GetPlayerName(playerid, name, 255);
      return name;
}
//==============================================================================
public SendCounterMessage(color, string[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
		    if(gTeam[i] == TEAM_CT)
		    {
				SendClientMessage(i, color, string);
			}
		}
	}
}
//==============================================================================
public SendTerrorMessage(color, string[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
		    if(gTeam[i] == TEAM_TT)
		    {
				SendClientMessage(i, color, string);
			}
		}
	}
}
//==============================================================================
public TextClear(playerid)
{
    TextDrawHideForPlayer(playerid, teamtext);
    return 1;
}
Reply
#2

Deberнas aсadir el cуdigo en el timer: "DMTimer()", dentro del condicional "if (DMTime == 0)".

Para que les suene a todos deberнas usar un bucle o la funciуn "foreach".
Reply
#3

Quote:
Originally Posted by OwlCity
Посмотреть сообщение
Deberнas aсadir el cуdigo en el timer: "DMTimer()", dentro del condicional "if (DMTime == 0)".

Para que les suene a todos deberнas usar un bucle o la funciуn "foreach".
Pero como dime please
Reply
#4

Quote:

aqui dejo un gm que uso expliquenme donde puedo poner el sonido para cuando acaba un ronda los jugadores puedan oirla (todos los jugadores la oigan)

Explicado estб, si querнas que te lo hicieran deberнas haberlo publicado en la secciуn de pedidos.

pawn Код:
public DMTimer()
{
    DMTime --;
    new tmp[256];
    format(tmp, sizeof tmp, "%s", TimeConvert(DMTime));
    TextDrawSetString(Text:Time, tmp);
    TextDrawShowForAll(Text:Time);
    format(tmp, sizeof(tmp), "~b~Policias: ~w~%d ~r~Bandas: ~w~%d", ctscore, ttscore);
    TextDrawSetString(Text:scoretext, tmp);
    TextDrawShowForAll(Text:scoretext);
    if (DMTime == 0)
    {
        if(ctscore > ttscore) { GameTextForAll("~w~ The round is over, ~b~Policias ~w~win.", 3000, 5); }
        else if(ttscore > ctscore) { GameTextForAll("~w~ The round is over, ~r~Bandas ~w~win.", 3000, 5); }
        else if(ctscore == ttscore) { GameTextForAll("~y~ The round is over, ~y~Draw.", 3000, 5); }
        SendRconCommand("changemode cs2");
        for(new a=0; a<MAX_PLAYERS;a++)
        {
            if(IsPlayerConnected(a))
                PlayerPlaySound(a, soundid, 0.0, 0.0, 0.0);
           
        }
        KillTimer(dmtimer);
        GameTextForAll("~w~Server:~r~ Loading Next map",5000,4);
     }
    return 1;
}
Reply
#5

Listo ya esta en pedidos
Reply
#6

Pero si te he dado una soluciуn no lo pongas en pedidos...
Reply
#7

a perdon no la abia visto xD

EDIT:
men me sirvio eres re bueno me sirvio a hora como hago q se pare la musica sigel el siguiente mapa y sige la musica
ayuda



Bueno el sonido de eleji si sale lo malo es que cuando entran ami server personas al final de cada ronda disen q no ollen nada porfavor ayuda
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)