Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Have you purchased a mod and lost your copy? Just file a support ticket through your "My Mods" page.


This forum is now closed and has moved to a new location! Click here to find out why.

AuthorTopic: Mysql Code Question  (Read 502 times)

Dusty

  • Basic Member
  • *
  • Reputation Power: 21
  • Dusty has no influence.
  • Offline Offline
  • Posts: 39
  • TRD Computer Repair
    • Yahoo Instant Messenger - peewee986
    • View Profile
    • WWW
Mysql Code Question
« on: June 04, 2010, 09:04:35 AM »
mysql_query("UPDATE users SET will=will+30 WHERE will<maxwill AND userid = $userid");

this is what I have..       This is what I want it to do ...    Where it says it will add +30 to the will and stop at the max will ..  well 30 works fine as long at the maxwill is a low number..   the higher it is the lower the % is  when it fills up ..       

I've tryed added a % with that 30 but it dont work ..  SOOOOO   if i want that 30 to fill will for 5% or 10% for all maxwill how do I make that number into a working % number.
Logged
TRD Computer Repair Services
www.trdcomputer.com

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: Mysql Code Question
« Reply #1 on: June 04, 2010, 03:19:05 PM »
Im not sure what you mean?
Logged
Project Choosen - 10%
Daniel - Hanson . Com

Dusty

  • Basic Member
  • *
  • Reputation Power: 21
  • Dusty has no influence.
  • Offline Offline
  • Posts: 39
  • TRD Computer Repair
    • Yahoo Instant Messenger - peewee986
    • View Profile
    • WWW
Re: Mysql Code Question
« Reply #2 on: June 04, 2010, 06:19:18 PM »
mysql_query("UPDATE users SET will=will+30 WHERE will<maxwill AND userid = $userid");

That code if for an item called a will pill  some thing that they will find in the game playing the streets or what ever.   This item give you will BUT not 100% will..    you see where it says set will=will+30  well I need that to say SET will=will+5% or 10% and work ..   If put in 5% but it dont work at all it works with +30 in there but it dont give 5% or 10% like I would like for it to do .    I need to know what I need to do to make that + number 5 or 10%
Logged
TRD Computer Repair Services
www.trdcomputer.com

Cronus

  • Administrator
  • Senior Member
  • *****
  • Reputation Power: 2901
  • Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!
  • Offline Offline
  • Posts: 550
    • MSN Messenger - preston__08@hotmail.com
    • View Profile
    • WWW
Re: Mysql Code Question
« Reply #3 on: June 05, 2010, 05:39:39 AM »
Code: [Select]
$percent=.05;
mysql_query("UPDATE users SET will=will+(maxwill*$percent) WHERE will<maxwill AND userid = $userid");

This would make it 5 percent, change the .05 to .1 for 10 percent, etc.
Logged
My msn is preston__08@hotmail.com if anyone is interested, I am online frequently.

Dusty

  • Basic Member
  • *
  • Reputation Power: 21
  • Dusty has no influence.
  • Offline Offline
  • Posts: 39
  • TRD Computer Repair
    • Yahoo Instant Messenger - peewee986
    • View Profile
    • WWW
Re: Mysql Code Question
« Reply #4 on: June 05, 2010, 07:05:02 AM »
Thanks Cronus  Ill post on how the out come turns out.. as soon as I add that to it   Thanks again
Logged
TRD Computer Repair Services
www.trdcomputer.com

Dusty

  • Basic Member
  • *
  • Reputation Power: 21
  • Dusty has no influence.
  • Offline Offline
  • Posts: 39
  • TRD Computer Repair
    • Yahoo Instant Messenger - peewee986
    • View Profile
    • WWW
Re: Mysql Code Question
« Reply #5 on: June 05, 2010, 08:20:15 AM »
Worked Great..  Thanks Again. 
Logged
TRD Computer Repair Services
www.trdcomputer.com
 


This forum is now closed and has moved to a new location! Click here to find out why.