SA-MP Forums Archive
How could i use menus with strings in them?? - 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: How could i use menus with strings in them?? (/showthread.php?tid=616205)



How could i use menus with strings in them?? - Type-R - 02.09.2016

Hello, well i really like the original San Andreas menus, or the function CreateMenu. So i have lets say ammunition shops, food places where i use this system. But lets say i want to have the prices of items dynamic, so lets say if i decide to change Deagle cost from $100 to $150 in the server, then when i go to ammunition shop select Deagle it will show me: Buy item - $150. Whats the best way to go about this? My biggest concern is having strings in them and also not having a bunch of menus, where it just says Buy item - (price), which would be quite a lot of extra menus after you select an item. Also whats the best way to use menus? I mean i just create them on GameModeInit. Is there a better way by creating them and destroying them?? Thank you, i hope my concerns are clear.


Re: How could i use menus with strings in them?? - SickAttack - 02.09.2016

https://sampwiki.blast.hk/wiki/CreateMenu
https://sampwiki.blast.hk/wiki/DestroyMenu
https://sampwiki.blast.hk/wiki/SetMenuColumnHeader
https://sampwiki.blast.hk/wiki/AddMenuItem

Everything is on the wiki?


Re: How could i use menus with strings in them?? - Type-R - 02.09.2016

I know its on the wiki, i just cannot implement it in my head.. And theres nothing that would explain how to have for example prices with strings in a menu. Thanks for trying to help though!


Re: How could i use menus with strings in them?? - SickAttack - 02.09.2016

Quote:
Originally Posted by Type-R
Посмотреть сообщение
I know its on the wiki, i just cannot implement it in my head.. And theres nothing that would explain how to have for example prices with strings in a menu. Thanks for trying to help though!
AddMenuItem(examplemenu, 0, "item");
AddMenuItem(examplemenu, 1, "price");

"You can only use 2 columns (0 and 1)."

It says on the wiki?


Re: How could i use menus with strings in them?? - Type-R - 02.09.2016

I understand that, but check this out. So i have a menu. I create OnGameModeInit:

AddMenuItem(examplemenu, 0, "BUY");
AddMenuItem(examplemenu, 1, "$150");

So now i would have to create 10 different menus that have BUY in them and prices, because of the different costs? Because lets say this is were i start of:

examplemenu = CreateMenu("Guns", 1, 200.0, 100.0, 150.0, 150.0);
AddMenuItem(examplemenu, 0, "Deagle");
AddMenuItem(examplemenu, 0, "9mm");

Now lets say i select one of these and then my menu is this for lets say deagle:

examplemenu2 = CreateMenu("Guns", 2, 200.0, 100.0, 150.0, 150.0);
AddMenuItem(examplemenu2, 0, "BUY");
AddMenuItem(examplemenu2, 1, "$150");

So if i wanted to do it like this, then for selecting lets say the 9mm option, i would have to have yet another menu created just to have BUY and price in it? Because i do not want prices in the first selection menu. I want it to be like, you select what you want and then it says the to buy it and the price. So again my question is that, i would have to keep on creating new menus because of the differentiating costs??


Re: How could i use menus with strings in them?? - SickAttack - 02.09.2016

Destroy the old menu and recreate it with the new info?

https://sampwiki.blast.hk/wiki/DestroyMenu