View Full Version : Integrate LeSane's Store with Trivia
xxxsaint
08-11-2002, 04:50 PM
could this be done , so that every answer a person gets right on the trivia hack would gain them X amount of points in lesane's store ??
I'm not sure if this is the right forum for this request , so forgive me if it's not , I just think it would be kool and add to both hacks :D
good request as well m8
i asked for this in lesane`s hack as well
more incentive to play the quiz then if they win something but if its possible to add then its gotta be possible to delete as well if they get below a certain score.
Hope lesane`s see`s this post.
xxxsaint
08-11-2002, 11:08 PM
yes , right now I'm manually doing it and it's keeping me plenty busy :D
xxxsaint
08-20-2002, 06:17 PM
any news on this yet ?
xxxsaint
09-04-2002, 10:18 PM
I'll PAY someone to integrate this with lesane's store so that every question answerd correctly = X amount of points predefined in the Admin panel.
Lesane
09-06-2002, 11:57 AM
I don't have the hack installed but i guess that you can put the code by the end result. You can check how many questions the user has answered correctly and then update his points with an amount of x points.
This code below should work, not tested:
Find in quiz.php: (around line 310)
$pct = $totalcorrect * $base;
Add AFTER it:
$storeamount = 10 * $totalcorrect;
$updatestore = $DB_site->query_first("UPDATE user SET storep=storep+'$storeamount' WHERE userid='$bbuserinfo[userid]');
This gives 10 points for every good answer. Let me know if this work correctly for you.
NuclioN
09-06-2002, 12:28 PM
Warning: Unexpected character in input: '\' (ASCII=92) state=1
Maybe a typo ;)
xxxsaint
09-07-2002, 04:57 AM
I get this :
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in quiz.php on line 638
Parse error: parse error, unexpected T_VARIABLE in quiz.php on line 638
Lesane
09-07-2002, 09:47 AM
I edited my code.
NuclioN
09-07-2002, 10:38 AM
Well...did it work for you lesane?
Lesane
09-07-2002, 11:38 AM
Like i said, i don't have the hack installed so i cannot test it.
xxxsaint
09-07-2002, 12:57 PM
That one gives this :
Parse error: parse error, unexpected T_STRING in quiz.php on line 319
xxxsaint
09-26-2002, 09:04 AM
bump :( :( :(
xxxsaint
09-30-2002, 09:46 PM
ok well this latest code that lesane tried to help me with gives me this error :
Parse error: parse error in /****/****/****/****/forums/quiz.php on line 320
and my line 320 is this :
$current_time = vbdate($timeformat, time());
any ideas , help , suggestions would be greatly apprecieated.
xxxsaint
09-30-2002, 10:12 PM
Hey Hey , I think I am getting closer here , after reading thru some of the php help files , I noticed that Lesane left out a " in his code line ,
$updatestore = $DB_site->query_first("UPDATE user SET storep=storep+'$storeamount' WHERE userid='$bbuserinfo[userid]');
so I inserted it
$updatestore = $DB_site->query_first("UPDATE user SET storep=storep+'$storeamount' WHERE userid='$bbuserinfo[userid]'");
and it did award points in a quiz i did for a test , but now it gave me this error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /****/****/****/****/forums/admin/db_mysql.php on line 154
which when I look that up comes from this block of code :
function fetch_array($query_id=-1,$query_string="") {
// retrieve row
if ($query_id!=-1) {
$this->query_id=$query_id;
}
if ( isset($this->query_id) ) {
$this->record = mysql_fetch_array($this->query_id);
} else {
if ( !empty($query_string) ) {
$this->halt("Invalid query id (".$this->query_id.") on this query: $query_string");
} else {
$this->halt("Invalid query id ".$this->query_id." specified");
}
}
return $this->record;
}
and line 154 is this line right here :
$this->record = mysql_fetch_array($this->query_id);
Any help will be extremely apprecieated.
Lesane
10-02-2002, 06:15 AM
Try this line:
$updatestore = $DB_site->query("UPDATE user SET storep=storep+'$storeamount' WHERE userid='$bbuserinfo[userid]'");
xxxsaint
10-02-2002, 09:09 AM
WHOOOOO HOOOOOOo !!!!!!!!
THAT'S IT !
TY TY TY TY TY TY TY TY so very much man, you just don't know how much time i was spending manually going in there and awarding points , I really apprecieate your help :D
xxxsaint
10-02-2002, 09:10 AM
I've seen others asking for this hack so you might wanna release it :D
xxxsaint
10-02-2002, 09:41 AM
Now that the code is working and paying 10 points for every correct answer , is there a way to reward those that get 100% on their quiz and give them 1000 points instead of 100 ?
Lesane
10-03-2002, 01:46 PM
I'm glad it's working properly now. :)
I have it way too busy to release a hack, you have my permission to use the code and release it as an addon if you want.
If you want to give them 1000 points instead of 100 then find this line in quiz.php:
$storeamount = 10 * $totalcorrect;
And change it to:
$storeamount = 100 * $totalcorrect;
xxxsaint
10-03-2002, 02:38 PM
Ok , I am a total noob when it comes to php coding, I did the happy dance for about 15 minutes when I figured out how to make any name any color I wanted in the ' currently active users ' list , so is there any way to make a php code that would do this :
(yes i know this isn't a code LOL, I'm trying to convey my idea )
$base = round(100 / $question_count);
$pct = $totalcorrect * $base;
If $pct = 100 then
$storeamount = 100 * $totalcorrect;
$updatestore = $DB_site->query("UPDATE user SET storep=storep+'$storeamount' WHERE userid='$bbuserinfo[userid]'");
else
$storeamount = 10 * $totalcorrect;
$updatestore = $DB_site->query("UPDATE user SET storep=storep+'$storeamount' WHERE userid='$bbuserinfo[userid]'");
See this way , if someone took a 10 question quiz and got 9 or less right , it will give 10 points per question , but if they got all 10 right and scored 100% , it would award them $1000
make any sense , sorry if it doesnt :P
NuclioN
10-03-2002, 09:11 PM
Yep, it would be nice if you release this as an addon when it's working. ;)
xxxsaint
10-03-2002, 09:39 PM
it works now as far as paying x amount of points per correct answer , if that's all you intend to do with it , without the perfect score bonus , it's ready :D
Lesane
10-04-2002, 07:57 AM
Originally posted by xxxsaint
Ok , I am a total noob when it comes to php coding, I did the happy dance for about 15 minutes when I figured out how to make any name any color I wanted in the ' currently active users ' list , so is there any way to make a php code that would do this :
See this way , if someone took a 10 question quiz and got 9 or less right , it will give 10 points per question , but if they got all 10 right and scored 100% , it would award them $1000
make any sense , sorry if it doesnt :P
if ($totalcorrect=='10') {
$storeamount = 100 * $totalcorrect;
} else {
$storeamount = 10 * $totalcorrect;
}
xxxsaint
10-04-2002, 11:49 AM
Perfect man , very nice job. I installed and tested it all out , it works fine with no problems at all. Thanks for all the help you did on this and for allowing me to release this as an add on , which I did just now, right here :
https://vborg.vbsupport.ru/showthread.php?s=&threadid=44279
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.