X-Fan
09-11-2003, 01:51 PM
G'day all,
I tried modifying a few existing hacks to create an add-on for Lesane's store wherein a user could pay to have a warning point removed (from g-force2k2's Warning Hack), but I've hit a snag wherein the check to see if a user has any points and giving them an error screen if they don't isn't working.
Here's the code:
$warns = $DB_site->query_first("SELECT warninglvl FROM user WHERE userid='$bbuserinfo[userid]'");
if ($warns <= 0) {
eval("standarderror(\"".gettemplate('store_removewarn_error')."\");");
}
Any idea why that's not working?
Also, here's the code I've got for removing the point. Not sure if it works or not as I haven't got that far, but comments would be appreciated, thanks!
if ($cost>$points) {
eval("standarderror(\"".gettemplate('store_error')."\");");
} else {
$DB_site->query("UPDATE user SET warninglvl=warninglvl-1,storep=storep-$cost WHERE userid='$bbuserinfo[userid]'");
$changestorenow = $DB_site->query("UPDATE store SET sold=sold+1 WHERE action='removewarn'");
$moneycheck = $DB_site->query_first("SELECT storep FROM user WHERE userid=$bbuserinfo[userid]");
$money = $moneycheck[storep];
eval("dooutput(\"".gettemplate("store_removewarn_done")."\");");
}
}
I tried modifying a few existing hacks to create an add-on for Lesane's store wherein a user could pay to have a warning point removed (from g-force2k2's Warning Hack), but I've hit a snag wherein the check to see if a user has any points and giving them an error screen if they don't isn't working.
Here's the code:
$warns = $DB_site->query_first("SELECT warninglvl FROM user WHERE userid='$bbuserinfo[userid]'");
if ($warns <= 0) {
eval("standarderror(\"".gettemplate('store_removewarn_error')."\");");
}
Any idea why that's not working?
Also, here's the code I've got for removing the point. Not sure if it works or not as I haven't got that far, but comments would be appreciated, thanks!
if ($cost>$points) {
eval("standarderror(\"".gettemplate('store_error')."\");");
} else {
$DB_site->query("UPDATE user SET warninglvl=warninglvl-1,storep=storep-$cost WHERE userid='$bbuserinfo[userid]'");
$changestorenow = $DB_site->query("UPDATE store SET sold=sold+1 WHERE action='removewarn'");
$moneycheck = $DB_site->query_first("SELECT storep FROM user WHERE userid=$bbuserinfo[userid]");
$money = $moneycheck[storep];
eval("dooutput(\"".gettemplate("store_removewarn_done")."\");");
}
}