Jump to content
  • 0

problema icon case


Mister

Question

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
Link to comment
Share on other sites

22 answers to this question

Recommended Posts

  • 0

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

 

Link to comment
Share on other sites

  • 0

Salut, daca pun la onplayerconnect apara dor pentru o casa si daca o cumpar nu se schimba altundeva unde sa il pun?

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

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;
      //  }
      }
    }
Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

  • 0

creaza doar pentru o singura casa si cand cumpar alta se sterge acel prim icon si se creaza la noua casa

Deci nu.

Edited by Mister

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

  • 0
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;
      //  }
      }
    }
Link to comment
Share on other sites

  • 0
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
Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

  • 0

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);
Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

  • 0

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

Link to comment
Share on other sites

  • 0

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
Link to comment
Share on other sites

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.