Little Help - 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: Little Help (
/showthread.php?tid=372766)
Little Help -
Sanady - 28.08.2012
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!)
Respuesta: Little Help -
Siralos - 28.08.2012
When they buy materials, where do you store it? In a variable?
Then use the same variable to check how many materials they have...
Re: Respuesta: Little Help -
Sanady - 28.08.2012
Quote:
Originally Posted by Siralos
When they buy materials, where do you store it? In a variable?
Then use the same variable to check how many materials they have...
|
I am using mySQL so but i am storing it to "UserStats[playerid][Exp]"(variable).
Respuesta: Little Help -
Siralos - 28.08.2012
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'
Re: Respuesta: Little Help -
Sanady - 28.08.2012
Quote:
Originally Posted by Siralos
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'
|
but why variable when you are not using it?
Respuesta: Little Help -
Siralos - 28.08.2012
You are not using the variable? Then you are storing the materials directly into MySQL?
Re: Respuesta: Little Help -
Sanady - 28.08.2012
Quote:
Originally Posted by Siralos
You are not using the variable? Then you are storing the materials directly into MySQL?
|
Lol no..My question was means why you using variable "price".When you don`t using in script!
Respuesta: Little Help -
Siralos - 28.08.2012
Well, then you can directly do:
GivePlayerMoney(playerid, UserStats[playerid][Exp] * 500);
UserStats[playerid][Exp] = 0;