One life per round.
#1

Hello i want make TDM server wich will spawn the player and if died, he can only spectate his team players and he wonґt spawn till the next round start, i have the rounds createds...
Reply
#2

This isn't "Make it for me" This is scripting help
Reply
#3

Quote:
Originally Posted by Micko123
Посмотреть сообщение
This isn't "Make it for me" This is scripting help
I just donґt know how to start...
Reply
#4

First of all, I do not know how did you create your rounds (you said, that you had created them) - when does it start and end? Secondly, if you want to spectate other player when you die, just simply use this function:
https://sampwiki.blast.hk/wiki/PlayerSpectatePlayer

In order to stop spectating, just set
TogglePlayerSpectating(playerid, 0);

There is much more work with your script. If you want only to spectate your teammates, you have to create other variables, such as team[playerid]; and use them in loop. For example:

Get all player in the server:
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++) {

and then simply check, if the player is in that team.
Reply
#5

I am not professional at this, thats why i post here...
Код:
forward Segundo(playerid);
public Segundo(playerid)
{
	new timestr[32];
	SegundosRestantes--;
	if(SegundosRestantes <= 0)
	{
		if(MinutosRestantes <= 0)
		{
  			KillTimer(TiempoRonda);
	 		SegundosRestantes = 0;
			MinutosRestantes = 0;
 	    	CongelarTodos();
 	    	//aqui pongo el puntaje de la partida
            ContadorTop();
 	    	DialogTop(playerid);
 	    	//
			TiempoDelMapa = SetTimer("CambiarMapa",10000,false);
			for(new i = 0; i < MAX_PLAYERS; i++)
			if (Iniciado[i] == 1)
            {
                if (Spawneado[i] == 1)
				{
            	DatosUsuario[i][MapasJugados]++;
            	}
			}
			if(BajasPolicias == BajasTerroristas) //Cuando es un empate
			{
                if (Iniciado[playerid] == 1)
                {
				    if (Spawneado[playerid] == 1)
            	    {
                 	for(new i = 0; i < MAX_PLAYERS; i++)
			    	DatosUsuario[i][MapasEmpatados]++;
  	            }
			}
			GameTextForAll("~n~~n~~n~~n~~n~~n~~n~~n~~y~ Empate",10000,3);
			for(new i = 0; i < MAX_PLAYERS; i++)
			if (Iniciado[playerid] == 1)
                {
		    	if (Spawneado[playerid] == 1)
                {
				GivePlayerMoney(i, 500);
				GivePlayerScore(i, 5);
				PlayAudioStreamForPlayer(i, "http://k003.kiwi6.com/hotlink/g6i270t9a2/Good_job_team_Get_ready_for_the_next_round.mp3");
				SendClientMessage(i, Amarillo, "{FFF940}[Empate] {FFFFFF}Esforzaros para la prуxima vez, es hora de cobrar [5 puntos | 500$]");
				}
			  }
			}
			if(BajasPolicias > BajasTerroristas) //Cuando los Policias ganan
            {
			GameTextForAll("~n~~n~~n~~n~~n~~n~~n~~n~~b~ Los Policias han ganado",10000,3);
			for(new i = 0; i < MAX_PLAYERS; i++)
			PlayAudioStreamForPlayer(i, "http://main.get4mobile.net/ringtone/ringtone/_HrWoiI52-_kl9Gr7IdzHg/1459210248/3100d8174fb3fc2f5ffd45e5bdba8496/unknown_artist-counter_terrorists_win.mp3");
            for(new i = 0; i < MAX_PLAYERS; i++)
			if(gTeam[i] == Policias) //Mensaje para Policias cuando ganan
         	{
                if (Iniciado[playerid] == 1)
                {
         		    if (Spawneado[playerid] == 1)
           	        {
         	    	DatosUsuario[i][MapasGanados]++;
         	    	SendClientMessage(i, Verde, "[Victoria] {FFFFFF}Buen trabajo, es hora de cobrar [10 puntos | 2500$]");
        	    	GivePlayerMoney(i, 2500);
        	    	GivePlayerScore(i, 10);
        	    	}
        		}
         	}
            for(new i = 0; i < MAX_PLAYERS; i++)
         	if(gTeam[i] == Terroristas) //Mensaje para Terroristas cuando pierden
         	{
                if (Iniciado[playerid] == 1)
                {
   		            if (Spawneado[playerid] == 1)
                 	{
         	     	DatosUsuario[i][MapasPerdidos]++;
       		        SendClientMessage(i, Rojo, "[Derrota] {FFFFFF}ЎHabйis fracasado, esforzaros para la prуxima vez!");
				    }
				  }
               }
			}
			if(BajasPolicias < BajasTerroristas) //Cuando los Terroristas ganan
			{
			GameTextForAll("~n~~n~~n~~n~~n~~n~~n~~n~~r~ Los Terroristas han ganado",10000,3);
			for(new i = 0; i < MAX_PLAYERS; i++)
			PlayAudioStreamForPlayer(i, "http://soundfxcenter.com/video-games/counter-strike/8d82b5_Counter_Strike_Terrorists_Win_Sound_Effect.mp3");
			for(new i = 0; i < MAX_PLAYERS; i++)
			if(gTeam[i] == Terroristas) //Mensaje para Terroristas cuando ganan
         	{
                if (Iniciado[playerid] == 1)
                {
         		    if (Spawneado[playerid] == 1)
            	    {
         		    DatosUsuario[i][MapasGanados]++;
                	SendClientMessage(i, Verde, "[Victoria] {FFFFFF}Buen trabajo, es hora de cobrar [10 puntos | 2500$]");
        	    	GivePlayerMoney(i, 2500);
        	    	GivePlayerScore(i, 10);
        	    	}
         		}
         	}
         	for(new i = 0; i < MAX_PLAYERS; i++)
         	if(gTeam[i] == Policias) //Mensaje para Terroristas cuando pierden
         	{
                if (Iniciado[playerid] == 1)
                {
         	    	if (Spawneado[playerid] == 1)
                	{
                	SendClientMessage(i, Rojo, "[Derrota] {FFFFFF}ЎHabйis fracasado, esforzaros para la prуxima vez!");
                	DatosUsuario[i][MapasPerdidos]++;
                	}
            	 }
       	      }
           }
		}
		else
  		{
	    	SegundosRestantes = 59;
			MinutosRestantes--;
		}
	}
	format(timestr,sizeof(timestr),"~w~      %02d:%02d",MinutosRestantes,SegundosRestantes);
	TextDrawSetString(Tiempo_restante,timestr);
	return 1;
}
forward CambiarMapa(playerid);
public CambiarMapa(playerid)
{
	KillTimer(TiempoDelMapa);
	KillTimer(TiempoRonda);
	SegundosRestantes = 0;
 	BajasPolicias=0;
  	BajasTerroristas=0;
   	ActualizarPuntuaje();
	if(Mapa == 0)
	{
	    Mapa = 1;
	    MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Jefferson Motel");
		SendRconCommand("mapname Jefferson Motel");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 2/23]");
		print("[Informaciуn] Mapa cambiado a Jeffersons Motel. [Mapa 2/23]");
	}
	else if(Mapa == 1)
	{
		Mapa = 2;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Compound");
		SendRconCommand("mapname Compund");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 3/23]");
		print("[Informaciуn] Mapa cambiado a Compound. [Mapa 3/23]");
	}
	else if(Mapa == 2)
	{
		Mapa = 3;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Canal");
		SendRconCommand("mapname Canal");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 4/23]");
		print("[Informaciуn] Mapa cambiado a Canal. [Mapa 4/23]");
	}
	else if(Mapa == 3)
	{
	    Mapa = 4;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Crack Factory");
		SendRconCommand("mapname Crack Factory");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 5/23]");
		print("[Informaciуn] Mapa cambiado a Crack Factory. [Mapa 5/23]");
	}
	else if(Mapa == 4)
	{
 		Mapa = 5;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Medieval Village");
		SendRconCommand("mapname Medieval Village");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 6/23]");
		print("[Informaciуn] Mapa cambiado a Medieval Village. [Mapa 6/23]");
	}
    else if(Mapa == 5)
	{
		Mapa = 6;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Italy");
		SendRconCommand("mapname Italy");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 7/23]");
		print("[Informaciуn] Mapa cambiado a Italy. [Mapa 7/23]");
	}
	else if(Mapa == 6)
	{
		Mapa = 7;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Maddog Mansion");
		SendRconCommand("mapname Maddog Mansion");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 8/23]");
		print("[Informaciуn] Mapa cambiado a Maddog Mansion. [Mapa 8/23]");
	}
	else if(Mapa == 7)
	{
		Mapa = 8;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Las Venturas PD");
		SendRconCommand("mapname LVPD");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 9/23]");
		print("[Informaciуn] Mapa cambiado a LVPD. [Mapa 9/23]");
	}
	else if(Mapa == 8)
	{
		Mapa = 9;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Liberty City");
		SendRconCommand("mapname Liberty City");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 10/23]");
        print("[Informaciуn] Mapa cambiado a Liberty City. [Mapa 10/23]");
	}
	else if(Mapa == 9)
	{
		Mapa = 10;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Meat Factory");
		SendRconCommand("mapname Meat Factory");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 11/23]");
		print("[Informaciуn] Mapa cambiado a Meat Factory. [Mapa 11/23]");
	}
	else if(Mapa == 10)
	{
		Mapa = 11;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Planning Department");
		SendRconCommand("mapname Planning dept");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 12/23]");
		print("[Informaciуn] Mapa cambiado a Planning dept. [Mapa 12/23]");
	}
	else if(Mapa == 11)
	{
		Mapa = 12;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: San Fierro PD");
		SendRconCommand("mapname SFPD");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 13/23]");
		print("[Informaciуn] Mapa cambiado a SFPD. [Mapa 13/23]");
	}
	else if(Mapa == 12)
	{
		Mapa = 13;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Aircraft");
		SendRconCommand("mapname Aircraft");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 14/23]");
		print("[Informaciуn] Mapa cambiado a Aircraft. [Mapa 14/23]");
	}
	else if(Mapa == 13)
	{
		Mapa = 14;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Area 51");
		SendRconCommand("mapname Area 51");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 15/23]");
		print("[Informaciуn] Mapa cambiado a Area 51. [Mapa 15/23]");
	}
	else if(Mapa == 14)
	{
		Mapa = 15;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Catigula's basement");
		SendRconCommand("mapname Catigula's basement");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 16/23]");
		print("[Informaciуn] Mapa cambiado a Catigula's basement. [Mapa 16/23]");
	}
	else if(Mapa == 15)
	{
		Mapa = 16;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Castle");
		SendRconCommand("mapname Farm");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 17/23]");
		print("[Informaciуn] Mapa cambiado a Farm. [Mapa 17/23]");
	}
	else if(Mapa == 16)
	{
		Mapa = 17;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Military Fuels");
		SendRconCommand("mapname Military Fuels");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 18/23]");
		print("[Informaciуn] Mapa cambiado a Farm. [Mapa 18/23]");
	}
	else if(Mapa == 17)
	{
		Mapa = 18;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Ocean Docks");
		SendRconCommand("mapname Ocean Docks");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 19/23]");
		print("[Informaciуn] Mapa cambiado a Ocean Docks. [Mapa 19/23]");
	}
	else if(Mapa == 18)
	{
		Mapa = 19;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: The Farm");
		SendRconCommand("mapname The Farm");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 20/23]");
		print("[Informaciуn] Mapa cambiado a The Farm. [Mapa 20/23]");
	}
	else if(Mapa == 19)
	{
		Mapa = 20;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Las Barrancas");
		SendRconCommand("mapname Las Barrancas");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 21/23]");
		print("[Informaciуn] Mapa cambiado a Las Barrancas. [Mapa 21/23]");
	}
	else if(Mapa == 20)
	{
		Mapa = 21;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: El Quebrados");
		SendRconCommand("mapname El Quebrados");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 22/23]");
		print("[Informaciуn] Mapa cambiado a El Quebrados. [Mapa 22/23]");
	}
	else if(Mapa == 21)
	{
		Mapa = 22;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Cargo");
		SendRconCommand("mapname Cargo");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 23/23]");
		print("[Informaciуn] Mapa cambiado a Cargo.");
	}
	else if(Mapa == 22)
	{
		Mapa = 0;
 		MinutosRestantes = Tiempo_Ronda;
        TiempoRonda = SetTimer("Segundo",1000,true);
        if (Spawneado[playerid] == 1)
        {
        ReaparecerLosJugadores();
		}
        DescongelarTodos();
		TextDrawSetString(MapaActual,"Mapa: Farm");
		SendRconCommand("mapname Farm");
		SendRconCommand("hostname [0.3.7] Batalla de Contrabando TDM [Mapa 1/23]");
		print("Todos los mapas han sido jugados,");
		print("reiniciando mapas de nuevo.");
		print("[Informaciуn] Mapa cambiado a Farm. [Mapa 1/23]");
	}
    DescongelarTodos();
}
Here is the Funcion when map finish and start new ones...
Reply
#6

I will not create script for you - i just can help you.

Like i said above, if player dies, use the function TogglePlayerSpectating, then get all player in the server, check for team that he depends on and spectate random teammate, but before that create variable such as team[playerid];
You can also spectate other person by clicking mouse button - simply in public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) check if player pressed FIRE BUTTON if (newkeys & KEY_FIRE) and then again - get all players, check for team that he depens on and spectate random again.

Also, if you want to stop spectating player when round ends (if he is spectating), check if the time is 0 (like in your script) and use function TogglePlayerSpectating

If the script, that is above, wasn't created by you (you just simply copied it), there is no point in doing such tasks like this. First of all, try doing simply tasks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)