set specific price for each player
so basically i have a custom shop, i wanna make it so that for every VIP, they will have some discount on that shop, my idea is that to make an array that will contain every price of every item for every player, so basically a 2d array. here's bit of my code..
Code:
now my question is that, using the code above, will there be any flaw or possible bug that will happen? or maybe you can give me another example/code that does the same job in a better way btw currently i cant test on multiplayer, but i need to get it done asap, that's why im asking it here in the first place |
Re: set specific price for each player
You don't need to be on a multiplayer server to test this, you could easily test it yourself. So far i don't see anything that could cause any problems, the message is: test it.
|
Re: set specific price for each player
Quote:
|
Re: set specific price for each player
You could just multiply the default price by the percent of discount instead of doing this
Code:
cod_itemPrice[id][item] = cod_defaultPrice[item] *3 / 4Code:
// 1.0 is 100 percentIf you want 70% off, multiply by 0.3 etc. |
Re: set specific price for each player
Quote:
|
Re: set specific price for each player
Is there need for a global variable to save each-player prices?
You could simple use formatex(menu_itemname, charsmax(menu_itemname), "%s\y $%i", cod_itemname[item], (flag & ADMIN_LEVEL_E) ? floatround( cod_defaultPrice[item] * 0,75 ) : cod_defaultPrice[item]) When looping throught items to create player menu. And in the handler you do the same check for taking the cash from player. |
Re: set specific price for each player
The plugin is pretty simple, there is nothing you really need to improve
You can go with xalus method but there's no benefit, choose whatever is easier for you to work with |
| All times are GMT -4. The time now is 13:52. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.