Posts: 1,174
Threads: 251
Joined: May 2012
Reputation:
0
Hello.Today I created my Material Shop.It`s working perfect.But when zombies come there they need to sell materials.But if I check how many materials have that zombie.And example that zombie have 3 materials.And he want to sell them all.And one material costs 500$ example.How can I check how many materials have if he have 3 just to sell them for some 1500 dollars how can I make it!(OMG Sorry I am bad with explaining!)
Posts: 125
Threads: 10
Joined: May 2011
Reputation:
0
When they buy materials, where do you store it? In a variable?
Then use the same variable to check how many materials they have...
Posts: 125
Threads: 10
Joined: May 2011
Reputation:
0
Then, if a zombie buys a material, you do UserStats[playerid][Exp]++
So, when selling, you should do:
new price = UserStats[playerid][Exp] * 500
So, if the zombie has bought 3 materials, in price you will have '1500'
Posts: 125
Threads: 10
Joined: May 2011
Reputation:
0
You are not using the variable? Then you are storing the materials directly into MySQL?
Posts: 125
Threads: 10
Joined: May 2011
Reputation:
0
Well, then you can directly do:
GivePlayerMoney(playerid, UserStats[playerid][Exp] * 500);
UserStats[playerid][Exp] = 0;