![]() |
Home Community Mys-Script Creative Off-Topic |
|
![]() |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
I want to do this a) to stop Yarolds people buying 100pets and lvling them all to max that day and b) to add a sense of realism (so they dont grow old in a day).
My idea was to add two columns to the "owned_adoptables" table: "date" and "clickstoday" or to that effect.Then I would edit the levelup.php script so that each click would check to see if "$date" is the current date and what "$clickstoday" is. If the date is wrong it will update the date (to the current date) and set "$clickstoday" back to naught. If the date is right and "$clickstoday" is under 11 I will have it run the normal procedure and add 1 to the field. I just wanted to run this by you guys to see if you see any immediate problems? Such as, is the date variable going to be the same for everyone? Or can someone in Australia click the pet, then an American (thus resetting the $date, since it's probably different) and the Australian being able to click it again...? Or otherwise, do you have a better system? It doesn't seam that hard to code. :\ |
#2
|
|||
|
|||
![]()
The date would go by the server's date, so whatever time zone the server your site is on will determine the date that is used for all users. I don't see why this wouldn't work. :)
|
#3
|
|||
|
|||
![]() Code:
if ($clickdate != date('Y-m-d')) { $newdate = date('Y-m-d'); $newctd= $ctd + 1; $addclicks = 1; } if ($clickdate = date('Y-m-d') && $ctd > 9 ) { $newdate = $clickdate; $newctd = $ctd + 0; } else if ($clickdate = date('Y-m-d') && $ctd < 10) { $newdate = $clickdate; $newctd = $ctd + 1; $addclicks = 1; } $query = "UPDATE ".$prefix."owned_adoptables SET ctd='".$newctd."' WHERE aid='".$id."'"; mysql_query($query); $query = "UPDATE ".$prefix."owned_adoptables SET clickdate='".$newdate."' WHERE aid='".$id."'"; mysql_query($query); $newclicks = $totalclicks + $addclicks; $newctd (which stands for "clicks today") is working fine, but for some reason $newdate keeps returning "1". Thanks, if anyone can help me. :) |
#4
|
|||
|
|||
![]()
You haven't set your date vaiable to begin with.
Sea |
#5
|
|||
|
|||
![]()
Hmm but it's used earlier to write to the "voters" table? (I mean $date, which doesn't work if I replace all the date('Y-m-d') with it. $date = date('Y-m-d') as it is)
Did you guys want to peer at the whole php file? It's pretty unorganised since I cut out the commentation (trying to cut down on bandwidth :\ ) but it's readable. P.S. I purposely made the comments so they wouldn't affect my script while I asked for help. ;) |
#6
|
|||
|
|||
![]()
Another idea, why not just use the vote-voters table? It tracks the date and adoptable ID each time someone votes for a pet. Just run a query on that table that selects all records for the current date and the adoptable ID and if the number of records returned is greater than 10 then prevent leveling. :)
|
#7
|
|||
|
|||
![]()
:o
Lol. Trust me to pick the abstract, complex way right off the bat. I'll definitely do that Brandon, thanks for suggesting it. :D EDIT: It's really hard to see if it's working, but does this look functionable to you guys? Code:
$query = "SELECT * FROM ".$prefix."vote_voters WHERE adoptableid='$id' and date = '$date'"; $result = mysql_query($query); $ctd = mysql_numrows($result); if ($ctd <= 9) { $addclicks = 1; } else { $addclicks = 0; } $newclicks = $totalclicks + $addclicks; |
#8
|
|||
|
|||
![]() Quote:
You'll be able to tell if it is working too that way. :) |
#9
|
|||
|
|||
![]()
I thought I needed the query to check the number of rows in the votes table? Sorry Brandon, but could you show me an example..? :S
EDIT: Is this what you meant? Code:
$query = "SELECT * FROM ".$prefix."vote_voters WHERE adoptableid='$id' and date = '$date'"; $result = mysql_query($query); $ctd = mysql_numrows($result); if ($ctd > 99) { $article_title = "Error"; $article_content = "<font color='#cc1111'>This Pet has recieved the maximum of 100 clicks per day</font>"; } else if ($ctd <= 99) { // Add to clicks, levelup and text return } |
#10
|
|||
|
|||
![]()
Yeah, something like your last post is what I meant, so you're not running the level up procedure if the pet can't be leveled anyway. :)
|
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Freeze ONLY the evolution, not the clicks | dulop | Questions and Supports | 2 | 09-28-2012 10:29 AM |
Limit amount of clicks per day | SilverDragonTears | Questions and Supports | 15 | 11-29-2011 11:50 AM |
Limit clicks/day to 10 | sensacion | Questions and Supports | 1 | 07-02-2011 05:15 AM |
Days Instead of Clicks | alonaria | Suggestions and Feature Requests | 7 | 06-25-2011 05:27 AM |
No Clicks at all? | rosepose | Questions and Supports | 11 | 03-07-2009 08:42 AM |
What's New? |
What's Hot? |
What's Popular? |