Dynamic items
I've read this https://forums.alliedmods.net/showthread.php?t=123445 tutorial regarding dynamic items . How can we show shop for different team ? T and CT ? .
Any help didnt find anything like that in that tutorial . |
Re: Dynamic items
On the 'public _item_add( iPlugin, iParams )' function declaration, you need to receive 4 paramenters instead of 3. Note, '( iPlugin, iParams )' are not the parameters. The parameters I am talking about are those you get with 'get_param(1)'.
The new parameter will the the CS_TEAM's constants on which you are adding the item. Them you can add different itens for CT and T, handling on the this function to which team you are adding items. On that function, when you add a item, it goes to the global Array 'g_aItems'. Now you will have to create more 1 global Array, for the other team items, and add the items for that team to it. Next step is to change the function 'ShowShopMenu( iPlayer, iPage )'. On it, you will the get user team by their id using 'cs_get_user_team(1)' function. And create the menu with the CT items, or with the TR items. Remember, the items are on the arrays you created on the last step. Cs team use example: Code:
Update: Using a switch for the team selection seens to be more appropriate. Code:
|
Re: Dynamic items
Try this:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
Re: Dynamic items
Thanks :) for the help . Will try it .
|
Re: Dynamic items
The above code is updated, because i forgot to add options for both teams.
|
| All times are GMT -4. The time now is 18:33. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.