Jump to content
  • 0

Question

Posted

Problema intalnita (descriere): am pus la ongamemodeinit sa afiseze icon la casele de vanzare iar la cele cu proprietari alt icon si nu merge

Ero(area / rile) / warning-(ul / urile): nu sunt
Liniile de cod / sursa / script-ul:

for(new u=0;u<MAX_PLAYERS;u++)
    {
        for(new h = 0; h < sizeof(HouseInfo); h++)
        {
            if(HouseInfo[h][hOwned] == 1)
            {
            //    if(PlayerInfo[playerid][pcasa] == 1)
            //    {
                    SetPlayerMapIcon(u, 31, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 32, COLOR_YELLOW);
                    RemovePlayerMapIcon(u, 32);
            //        PlayerInfo[playerid][pcasa] = 0;
               //    }
            }
            if(HouseInfo[h][hOwned] == 0)
            {
            //    if(PlayerInfo[playerid][pcasa] == 0)
            //    {
                    SetPlayerMapIcon(u, 32, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 31, COLOR_YELLOW);
                        RemovePlayerMapIcon(u, 31);
                   //     PlayerInfo[playerid][pcasa] = 1;
            //    }
            }
        }
    }


Imagini / Video (optional): -
Ati incercat sa rezolvati singur?: am mutat la onplayerupdate si tot nu merge

 

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn

22 answers to this question

Recommended Posts

  • 0
Posted (edited)

La OnGameModeInit pui:

 

SetTimer("UpdateHouseIcon", 5000, 1);

 

Iar asta o pui la sfarsitul gamemode-ului:

forward UpdateHouseIcon();
public UpdateHouseIcon()
{
	for(new i=0;i<MAX_PLAYERS;i++)
	{
		if(IsPlayerConnected(i))
		{
			for(new h = 0; h < sizeof(HouseInfo); h++)
			{
				if(HouseInfo[h][hOwned] == 1)
				{
					RemovePlayerMapIcon(playerid, h);
					SetPlayerMapIcon(i, h, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 32, COLOR_YELLOW);
				}
				if(HouseInfo[h][hOwned] == 0)
				{
					RemovePlayerMapIcon(playerid, h);
					SetPlayerMapIcon(i, h, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 31, COLOR_YELLOW);
				}
			}
		}	
	}
}	
Edited by Gireada

 

1859311972_BANNER-GIREADAcopy-min.thumb.png.48e5e420ae2185dce5b244965a1d2601.png

 

  • 0
  • Administrator
Posted

Sterge

for(new u=0;u<MAX_PLAYERS;u++)
{
}

Si chestia asta o pui la OnPlayerConnect.

  • 0
  • Administrator
Posted

Cand o cumpara trebuie sa le actualizezi iar.

 

Si nu are cum sa se actualizeze  doar pentru o casa din moment ce tu le parcurgi pe toate.

for(new h = 0; h < sizeof(HouseInfo); h++)
    {
      if(HouseInfo[h][hOwned] == 1)
      {
      //  if(PlayerInfo[playerid][pcasa] == 1)
      //  {
          SetPlayerMapIcon(u, 31, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 32, COLOR_YELLOW);
              RemovePlayerMapIcon(u, 32);
        //    PlayerInfo[playerid][pcasa] = 0;
       //  }
      }
      if(HouseInfo[h][hOwned] == 0)
      {
      //  if(PlayerInfo[playerid][pcasa] == 0)
      //  {
          SetPlayerMapIcon(u, 32, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 31, COLOR_YELLOW);
          RemovePlayerMapIcon(u, 31);
         //   PlayerInfo[playerid][pcasa] = 1;
      //  }
      }
    }
  • 0
Posted (edited)

am pus la /buyhouse si l a/sellhouse si se creaza o singura iconita si cand cumpar alta casa anterioara se sterge si apare la cea cumparata, adica este o singura iconita...

Edited by Mister

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
  • 0
  • Administrator
Posted

Comenteaza

RemovePlayerMapIcon(u, 32);

si

RemovePlayerMapIcon(u, 31);

si vezi daca iti apar toate. Tu aici din cate intelegi, il stergi si dupa il creezi iar.

  • 0
Posted (edited)

acum am pus la onplayerconnect la /sellhouse si /buyhouse si se creaza doar 2 cand cumpar urmatoare se sterge anterioara, iar iconitele  nu sunt trebuie sa cumpar casele ca sa apara

Edited by Mister

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
  • 0
  • Administrator
Posted

Sterge RemovePlayerMapIcon(u, 31); si RemovePlayerMapIcon(u, 32); de la OnPlayerConenct si vezi daca iti merge.

  • 0
Posted (edited)

sunt sterse

 

    if(HouseInfo[house][hOwned] == 1)
                {
                      SetPlayerMapIcon(playerid, 31, HouseInfo[house][hEntrancex], HouseInfo[house][hEntrancey], HouseInfo[house][hEntrancez], 32, COLOR_YELLOW);
                }
                else if(HouseInfo[house][hOwned] == 0)
                {
                       SetPlayerMapIcon(playerid, 32, HouseInfo[house][hEntrancex], HouseInfo[house][hEntrancey], HouseInfo[house][hEntrancez], 31, COLOR_YELLOW);
                }

asta am la /sellhouse buyhouse si onplayerconnect se creaza dor 2 iconite pentru ca doar atatea am 31 si 32

sa fac un for si in loc de pIcon(playerid, 31)  sa fie pIcon(u, i) ca sa se creeze asa in continu

Edited by Mister

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
  • 0
  • Administrator
Posted
for(new h = 0; h < sizeof(HouseInfo); h++)
    {
      if(HouseInfo[h][hOwned] == 1)
      {
      //  if(PlayerInfo[playerid][pcasa] == 1)
      //  {
          SetPlayerMapIcon(u, 31, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 32, COLOR_YELLOW);
              //RemovePlayerMapIcon(u, 32);
        //    PlayerInfo[playerid][pcasa] = 0;
       //  }
      }
      if(HouseInfo[h][hOwned] == 0)
      {
      //  if(PlayerInfo[playerid][pcasa] == 0)
      //  {
          SetPlayerMapIcon(u, 32, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 31, COLOR_YELLOW);
          //RemovePlayerMapIcon(u, 31);
         //   PlayerInfo[playerid][pcasa] = 1;
      //  }
      }
    }
  • 0
Posted
for(new h = 0; h < sizeof(HouseInfo); h++)
    {
      if(HouseInfo[h][hOwned] == 1)
      {
      //  if(PlayerInfo[playerid][pcasa] == 1)
      //  {
          SetPlayerMapIcon(u, 31, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 32, COLOR_YELLOW);
              //RemovePlayerMapIcon(u, 32);
        //    PlayerInfo[playerid][pcasa] = 0;
       //  }
      }
      if(HouseInfo[h][hOwned] == 0)
      {
      //  if(PlayerInfo[playerid][pcasa] == 0)
      //  {
          SetPlayerMapIcon(u, 32, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 31, COLOR_YELLOW);
          //RemovePlayerMapIcon(u, 31);
         //   PlayerInfo[playerid][pcasa] = 1;
      //  }
      }
    }

Pai asta este exact ce am facut eu prima data si nu mergea, din cate vad pe server, trebuie un for pentru

"SetPlayerMapIcon(u, 32," acel 32 pentru ca nu creza decat o iconita cum sa fac un for pentru un numar de inconita  egal cu al caselor?

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
  • 0
  • Administrator
Posted

In acel for comentezi 

RemovePlayerMapIcon(u, 31);

si

RemovePlayerMapIcon(u, 32);
  • 0
Posted

Adica asa si nu merge

 

for(new h = 0; h < sizeof(HouseInfo); h++)
{
if(HouseInfo[h][hOwned] == 1)
{
SetPlayerMapIcon(u, 31, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 32, COLOR_YELLOW);
}
if(HouseInfo[h][hOwned] == 0)
{
SetPlayerMapIcon(u, 32, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 31, COLOR_YELLOW);
}
}

 

nu merge pentru ca eu am 100 de case iar comanda zice doar iconita cu nr 32 si nr 31 sa apara deci cum poate exista iconita cu id 32 si cea cu id 31 in 50 de locuri in acelasi timp

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
  • 0
  • Administrator
Posted

Inlocuieste u cu playerid. Foloseste streamer sa adaugi mai mult de 100 de iconite.

 

Si inlocuieste 

SetPlayerMapIcon(u, 31, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 32, COLOR_YELLOW);

si

SetPlayerMapIcon(u, 32, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 31, COLOR_YELLOW);

cu asta

SetPlayerMapIcon(playerid, h, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 31, 0, MAPICON_LOCAL);

si

SetPlayerMapIcon(playerid, h, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 32, 0, MAPICON_LOCAL);
  • 0
Posted

Am pus exact asa iar cand ma conectez tot nu apare iconita si cand o cumpar apara cand cumpar alta apara doar pentru casa curenta, deci inainte apareau 2 iconite acum apare doar una

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
  • 0
Posted (edited)

Inlocuieste

SetPlayerMapIcon(u, 32, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez], 31, COLOR_YELLOW);

cu

CreateDynamicPickup(u, 32, HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h][hEntrancez]);

Cred ca ti-am fost de folos, in cazul in care tu doresti ca la systemul de case sa apara un PickUp.

Edited by KnowN .

242086.png

  • 0
Posted (edited)

Salut, am pus asa, si cand cumpar casa dupa 5 secunde se pune icon bun si dupa 5 secunde dispare.

 

Edit: am adaugat la /sellhouse si /buyhouse funcita  "UpdateHouseIcon();" ca sa nu astept timerul

Edited by Mister

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.