SA-MP Forums Archive
Set different model to one map icon - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Set different model to one map icon (/showthread.php?tid=662597)



Set different model to one map icon - m4karow - 06.01.2019

Hey

I have a map icon for a purchasable house.
A player comes, and purchases the house.

I want to make to the icon change to the red house icon, but other players still have to see the green house icon except the players, who purchased the houses? How I can do this with streamer?


Re: Set different model to one map icon - Logic_ - 06.01.2019

The playerid parameter.


Re: Set different model to one map icon - Bolex_ - 06.01.2019

I'll either go with.. (House is owned)

Код:
CreateDynamicMapIcon(x, y, z, 32, 0, 0, 0, -1, 50.0);



Re: Set different model to one map icon - m4karow - 06.01.2019

You don't understand what I want...


Re: Set different model to one map icon - Logic_ - 06.01.2019

You can use streamer data manipulative function to show and hide the map icons for a player, I believe. Look up the streamer include properly.


Re: Set different model to one map icon - m4karow - 06.01.2019

Quote:
Originally Posted by Logic_
Посмотреть сообщение
You can use streamer data manipulative function to show and hide the map icons for a player, I believe. Look up the streamer include properly.
I know I can manipulate the data, this is what I want. This is why I created this thread becouse I don't know how I can change the streaming model for specific players.


Re: Set different model to one map icon - H4bdel - 07.01.2019

RemovePlayerMapIcon, SetPlayerMapIcon


Re: Set different model to one map icon - m4karow - 07.01.2019

Quote:
Originally Posted by H4bdel
Посмотреть сообщение
RemovePlayerMapIcon, SetPlayerMapIcon
Read the thread before posting........


Re: Set different model to one map icon - ch1ps - 07.01.2019

Only the icon interesting you? i think if you use SetPlayerMapIcon it will put the icon above the original green icon.
that way the player who bought the house will see a red icon above the original green icon and the rest will just see a green icon.


Re: Set different model to one map icon - NaS - 07.01.2019

You could use 2 Icons, one red and one green one.

If the player owns the house, hide the green one (Streamer_RemoveArrayData) and show the red one (Streamer_AppendArrayData).
Also add it to OnPlayerConnect to show/hide the proper icon for each house.


Re: Set different model to one map icon - m4karow - 07.01.2019

Quote:
Originally Posted by NaS
Посмотреть сообщение
You could use 2 Icons, one red and one green one.

If the player owns the house, hide the green one (Streamer_RemoveArrayData) and show the red one (Streamer_AppendArrayData).
Also add it to OnPlayerConnect to show/hide the proper icon for each house.
Finally, an evaluable answer.

Thats right. But is there any way to change the icon model for specific players? Or I have to create two different map icons to handle that?


Re: Set different model to one map icon - Kevinas100 - 07.01.2019

Quote:
Originally Posted by m4karow
Посмотреть сообщение
Hey

I have a map icon for a purchasable house.
A player comes, and purchases the house.

I want to make to the icon change to the red house icon, but other players still have to see the green house icon except the players, who purchased the houses? How I can do this with streamer?
add an enum boughthouse and when the player connects set the mapicon example if player[boughthouse] true setplayermapicon... else setplayermapicon...


Re: Set different model to one map icon - Kevinas100 - 07.01.2019

EDIT: didn't see the solution


Re: Set different model to one map icon - NaS - 07.01.2019

Quote:
Originally Posted by m4karow
Посмотреть сообщение
Finally, an evaluable answer.

Thats right. But is there any way to change the icon model for specific players? Or I have to create two different map icons to handle that?
Not really, you can update the Icon ID via Streamer_SetIntData but that's going to change it for everyone.

If every player can only ever have 1 House icon though, you could place the green ones via dynamic map icons, limit the dynamic map icon count for everyone to 99 (that leaves 1 free slot as the limit is 100) and use SAMP's SetPlayerMapIcon (slot 99) for players who need to have a red icon.
That way ID 99 would stay unused by the Streamer Plugin and since it's the highest ID it would also stay on top all the time.

However I never tested this so I cannot say 100% that the Streamer never touches ID 99, but it shouldn't.

You can set the limit for the Streamer with Streamer_MaxVisibleItems if you want to test this.

This is theoretically a tiny bit more efficient but I think it's really easier and more reliable to do it with 2 Map Icons that get toggled, especially if you may need to add more red icons or handle other Map Icons similarly (which after a while would result in a lot of dedicated Map Icon IDs).


Re: Set different model to one map icon - m4karow - 08.01.2019

Quote:
Originally Posted by NaS
Посмотреть сообщение
Not really, you can update the Icon ID via Streamer_SetIntData but that's going to change it for everyone.

If every player can only ever have 1 House icon though, you could place the green ones via dynamic map icons, limit the dynamic map icon count for everyone to 99 (that leaves 1 free slot as the limit is 100) and use SAMP's SetPlayerMapIcon (slot 99) for players who need to have a red icon.
That way ID 99 would stay unused by the Streamer Plugin and since it's the highest ID it would also stay on top all the time.

However I never tested this so I cannot say 100% that the Streamer never touches ID 99, but it shouldn't.

You can set the limit for the Streamer with Streamer_MaxVisibleItems if you want to test this.

This is theoretically a tiny bit more efficient but I think it's really easier and more reliable to do it with 2 Map Icons that get toggled, especially if you may need to add more red icons or handle other Map Icons similarly (which after a while would result in a lot of dedicated Map Icon IDs).
I solved it with 2 different map icons and manipulating array data. Thanks


Re: Set different model to one map icon - AhmedMohamed - 08.01.2019

You can make a loop in all players.
if i != house_owner so,
CreateDynamicMapIcon(x,y,z,type,color,-1,-1, i, 150.0,MAPICON_LOCAL)

I didn't try it, I just thought of it right now.