Jump to content
  • 0

pomoc Spawn přes podminku


AvestX

Dotaz

Zdravím .. udělal jsem si script, všechno funguje jak má, akorát na jednu věc.

udělal jsem si podmínku že pokud hráč vztoupí do "zóny" a v té zóně zemře tak aby ho to teleportovalo na náhodné místo, ale nefunguje to .. zde je script:

 

public Dm_OnPlayerDeath(playerid, killerid)
{
   if(DMPlayerZone_In[playerid] == true)
   {
       if(IsPlayerConnected(killerid))
       {
       	DM_Killed[killerid] ++;
       	GivePlayerMoney(killerid, 500);
       	SendClientMessage(killerid, 0x00FF00AA, "TEST: USPECH !! +1 SCORE + 500$");
       }
       if(IsPlayerConnected(playerid))
	{
	    SendClientMessage(playerid, 0x00FF00AA, "TEST: Zemřel jsi v DM !");
	    DM_Kill[playerid] ++;
	    DM_DeathT[playerid] = true; // zde je ta podmínka, nastavil jsem to na true takže ten koho zabijou má podmínku na "true"
 		}
   }
return 1;
}

 

public Dm_UpDate(playerid)
{
   for(new dm=0;dm    {
       if(DM_DeathT[playerid] == false) // zde se snažím přít na problém, pokaždé když zemřu a spawnu se tak mi to restartuje score a sepíše zprávu že jsem byl odpojen a pak připojen..
       {
	if(IsPlayerInArea(playerid, DM_Info[dm][dm_zone_minx1],DM_Info[dm][dm_zone_maxx1],DM_Info[dm][dm_zone_miny1],DM_Info[dm][dm_zone_maxy1]))
	{
       	if(DMPlayerZone_In[playerid] == false)
		{
			DMPlayerZone_In[playerid] = true;
			GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon1], 100);
			GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon2], 100);
			GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon3], 100);
			GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon4], 100);
			GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon5], 100);
			SendClientMessage(playerid, 0x00FF00AA, "TEST: Byl Jsi připojen do DeathMatchu");
		}
       	if(DMPlayerZone_In[playerid] == true)
       	{
           	new str[100];
           	format(str, sizeof(str), "~r~DeathMatch~w~~n~~n~Zabil: %d~n~Zemrel:%d", DM_Killed[playerid], DM_Kill[playerid]);
			GameTextForPlayer(playerid, str, 1000, 1);
       	}

   	}else{
		if(DMPlayerZone_In[playerid] == true)
		{
			DMPlayerZone_In[playerid] = false;
			DM_Killed[playerid] = 0;
			DM_Kill[playerid] = 0;
			SendClientMessage(playerid, 0x00FF00AA, "TEST: Byl Jsi odpojen z DeathMatchu");
		}
		}
   	}
   }
   return 1;
}

 

kdyby jste chtěli vidět OnPlayerSpawn

public Dm_OnPlayerSpawn(playerid)
{
   for(new dm=0;dm    {
	if(DM_DeathT[playerid] == true)
	{
			new cislo = random(5);
		switch(cislo)
		{
			case 0: SetPlayerPos(playerid,DM_Info[dm][DM_death_spawn_X_1],DM_Info[dm][DM_death_spawn_Y_1],DM_Info[dm][DM_death_spawn_Z_1]);
			case 1: SetPlayerPos(playerid,DM_Info[dm][DM_death_spawn_X_2],DM_Info[dm][DM_death_spawn_Y_2],DM_Info[dm][DM_death_spawn_Z_2]);
			case 2: SetPlayerPos(playerid,DM_Info[dm][DM_death_spawn_X_3],DM_Info[dm][DM_death_spawn_Y_3],DM_Info[dm][DM_death_spawn_Z_3]);
			case 3: SetPlayerPos(playerid,DM_Info[dm][DM_death_spawn_X_4],DM_Info[dm][DM_death_spawn_Y_4],DM_Info[dm][DM_death_spawn_Z_4]);
			case 4: SetPlayerPos(playerid,DM_Info[dm][DM_death_spawn_X_5],DM_Info[dm][DM_death_spawn_Y_5],DM_Info[dm][DM_death_spawn_Z_5]);
		}
		GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon1], 100);
		GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon2], 100);
		GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon3], 100);
		GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon4], 100);
		GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon5], 100);
		DM_DeathT[playerid] = false;
	}
}
return 1;
}

 

 

Prosím o pomoc, snažil sem se to opravit celej den a stále samá chyba v podmínce .. už sem z toho doslova zoufalej .. tak prosím o pomoc .. (doufám že ste pochopili o co mi jde)

Link to comment
Share on other sites

4 odpovědí na tuto otázku

Recommended Posts

  • 0

Toto

for(new dm=0;dm

zmeň na

for(new dm=0;dm

 

a byť tebou na zistenie či je v niakom DM používam obyčajnú premenu... niečo ako

new DM[MAX_PLAYERS] = {-1,...}; //Ak není v DM má hodnotu -1

a potom iba v OnPlayerSpawn dám

if(DM[playerid] > -1){
new dm = DM[playerid];
         new cislo = random(5);
         switch(cislo)
         {
            case 0: SetPlayerPos(playerid,DM_Info[dm][DM_death_spawn_X_1],DM_Info[dm][DM_death_spawn_Y_1],DM_Info[dm][DM_death_spawn_Z_1]);
            case 1: SetPlayerPos(playerid,DM_Info[dm][DM_death_spawn_X_2],DM_Info[dm][DM_death_spawn_Y_2],DM_Info[dm][DM_death_spawn_Z_2]);
            case 2: SetPlayerPos(playerid,DM_Info[dm][DM_death_spawn_X_3],DM_Info[dm][DM_death_spawn_Y_3],DM_Info[dm][DM_death_spawn_Z_3]);
            case 3: SetPlayerPos(playerid,DM_Info[dm][DM_death_spawn_X_4],DM_Info[dm][DM_death_spawn_Y_4],DM_Info[dm][DM_death_spawn_Z_4]);
            case 4: SetPlayerPos(playerid,DM_Info[dm][DM_death_spawn_X_5],DM_Info[dm][DM_death_spawn_Y_5],DM_Info[dm][DM_death_spawn_Z_5]);
         }
         GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon1], 100);
         GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon2], 100);
         GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon3], 100);
         GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon4], 100);
         GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon5], 100);
         DM[playerid] = -1;
}

Link to comment
Share on other sites

  • 0

Zkoušel jsem to podle toho jak jsi napsal a je to ještě horší .. když vztoupim do DM zony začne mi to zpamovat chat "Vztoupil jste" "Opustil jste" ..

Link to comment
Share on other sites

  • 0

Tu chýba podmienka - či už je na niakom DM :)

 

public Dm_UpDate(playerid)
{
if(DM[playerid] > -1){
if(!IsPlayerInArea(playerid, DM_Info[DM[playerid] ][dm_zone_minx1],DM_Info[DM[playerid] ][dm_zone_maxx1],DM_Info[DM[playerid] ][dm_zone_miny1],DM_Info[DM[playerid] ][dm_zone_maxy1])){
// Odišiel z DM...
}else{
new str[100];
format(str, sizeof(str), "~r~DeathMatch~w~~n~~n~Zabil: %d~n~Zemrel:%d", DM_Killed[playerid], DM_Kill[playerid]);
GameTextForPlayer(playerid, str, 1000, 1);
}
}else{
for(new dm=0;dm<DM_Count+1;dm++)
{
if(IsPlayerInArea(playerid, DM_Info[dm][dm_zone_minx1],DM_Info[dm][dm_zone_maxx1],DM_Info[dm][dm_zone_miny1],DM_Info[dm][dm_zone_maxy1]))
{
if(DMPlayerZone_In[playerid] == false)
{
DMPlayerZone_In[playerid] = true;
GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon1], 100);
GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon2], 100);
GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon3], 100);
GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon4], 100);
GivePlayerWeapon(playerid, DM_Info[dm][DM_weapon5], 100);
SendClientMessage(playerid, 0x00FF00AA, "TEST: Byl Jsi připojen do DeathMatchu");
}
}
}
}
return 1;
}

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