SMF Shop
SMFShop => Items => Topic started by: xfollowthereaperx on February 20, 2007, 07:09:38 am
-
Huge thanks to Basil Beard and TechnoDragon for making this item
The item is still in testing
With this item no one can bash your karma, steal your credits, change your member title, or rob your bank.
Install the package
If you would like insurance from an item that isn't listed then edit one of theses two into the item.
Add this code to each item you want insurances to block (Single member affects, ie: steal your credits, bash karma)
$result = db_query("SELECT insurance from {$db_prefix}members WHERE id_member = ($_POST['target'])", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
if ($row > 0) {
db_query("UPDATE {$db_prefix}members SET insurance = (insurance - 1) WHERE id_member = ($_POST['target']))", __FILE__, __LINE__);
return "That user has insurance, and wasn't affected.";
}
else {
//rest of code goes here
}
And as for multiple member affects, (ie: Rob the bank, Karmageddon)
$result = db_query("SELECT insurance from {$db_prefix}members WHERE id_member = ($_POST['target'])", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
if ($row > 0) {
db_query("UPDATE {$db_prefix}members SET insurance = (insurance - 1) WHERE insurance > 0)", __FILE__, __LINE__);
return "Some users have insurance and weren't affected.";
}
else {
//rest of code goes here
}
-
Yes. It would be possible.
Basically, you would want to add a column to the smf_members table called "insurance" or something like that. It would store a 1 if they are insured, and a 0 if not. You would then have to edit the code to all of those items with something like
$result = db_query("SELECT insurance from {$db_prefix}members WHERE id_member = ($_POST['target'])", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
if ($row == 1) {
return "That user has insurance";
}
else {
//rest of code goes here
}
Of course, an item like tha would be rather powerful. so you might want to consider either making it work only a certain amount of the time, or make it die after a certain amount of ti,e.
-
Hmm, I know how to add the code to each item I want insurance from but I'm not sure how to code the item. If someone would be nice enough to code it I'd give them a big old hug
-
$result = db_query(SELECT insurance FROM {$db_prefix}members WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
if ($row['insurance'] == 1) {
return "you are already insured";
}
else {
$result = db_query(UPDATE {$db_prefix}members SET insurance = 1 WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
return "You are now insured!";
}
-
Is there a tutorial on time expiring items?
-
Here is the code, not working though :buck2:
<?php
/**********************************************************************************
* SMFShop item *
***********************************************************************************
* SMFShop: Shop MOD for Simple Machines Forum *
* =============================================================================== *
* Software Version: SMFShop 3.0 (Build 12) *
* $Date:: 2007-01-18 19:26:55 +1100 (Thu, 18 Jan 2007) $ *
* $Id:: Insurance.php 79 2007-01-18 08:26:55Z daniel15 $ *
* Software by: DanSoft Australia (http://www.dansoftaustralia.net/)*
* Copyright 2005-2007 by: DanSoft Australia (http://www.dansoftaustralia.net/)*
* Support, News, Updates at: http://www.dansoftaustralia.net/ *
* *
* Forum software by: Simple Machines (http://www.simplemachines.org) *
* Copyright 2006-2007 by: Simple Machines LLC (http://www.simplemachines.org) *
* 2001-2006 by: Lewis Media (http://www.lewismedia.com) *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under *
* the terms of the provided license as published by Simple Machines LLC. *
* *
* This program is distributed in the hope that it is and will be useful, but *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* See the "license.txt" file for details of the Simple Machines license. *
* The latest version of the license can always be found at *
* http://www.simplemachines.org. *
**********************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');
// Your class should always be called item_filename, eg. if your file is
// myCoolItem.php then the class should be called 'item_myCoolItem'. This
// class should always extend itemTemplate.
class item_Insurance extends itemTemplate
{
// When this function is called, you should set all the item's
// variables (see inside this example)
function getItemDetails()
{
// The author of the item
$this->authorName = 'xfollowthereaperx';
// The author's website
$this->authorWeb = '';
// And their email address
$this->authorEmail = 'xfollowthereaperx@hotmail.com';
// VALUES CHANGEABLE FROM WITHIN ADMIN PANEL:
// The name of the item
$this->name = 'Insurance';
// The item's description
$this->desc = 'Buy this item to stop negitive affects from other users';
// The item's price
$this->price = 1000;
//UNCHANGEABLE VALUES:
// Whether the item requires input or not.
$this->require_input = false;
// Useable?
$this->can_use_item = true;
// Since this item requires no input, we don't need to have a getUseInput function
$result = db_query(SELECT insurance FROM {$db_prefix}members WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
if ($row['insurance'] == 1) {
return "you are already insured";
}
else {
$result = db_query(UPDATE {$db_prefix}members SET insurance = 1 WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
return "You are now insured!";
}
?>
-
cool item, but the main issue would be figuring out how to set some kind of counter so it expires...
EDIT
Ok, here's an idea, still add the new field to the member table, but istead of doing just a one, have it a number set in the admin panel for items...so anything from say 1 to ten. then in the query for the items that insurance would protect them, you would have the query look for insurance where it is greater than zero. if it is, then they are insured, and the the same query would then deduct one from the total, until it reached zero...at which point they would no longer be insured
-
cool item, but the main issue would be figuring out how to set some kind of counter so it expires...
EDIT
Ok, here's an idea, still add the new field to the member table, but istead of doing just a one, have it a number set in the admin panel for items...so anything from say 1 to ten. then in the query for the items that insurance would protect them, you would have the query look for insurance where it is greater than zero. if it is, then they are insured, and the the same query would then deduct one from the total, until it reached zero...at which point they would no longer be insured
You could also do that, but I'd much rather have it timed because some of my items are cheaper and if they used to to take someone's insurance it would be very inexpensive.
But I suppose the insurance item is very cheap and very effective in the first place.
-
Also it would need a script for items like Karmageddon.
-
Well here is the conceptual code for the items...
$result = db_query("SELECT insurance from {$db_prefix}members WHERE id_member = ($_POST['target'])", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
if ($row > 0) {
db_query("UPDATE {$db_prefix}members SET insurance = (insurance - 1))", __FILE__, __LINE__);
return "That user has insurance";
}
else {
//rest of code goes here
}
-
Well here is the conceptual code for the items...
$result = db_query("SELECT insurance from {$db_prefix}members WHERE id_member = ($_POST['target'])", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
if ($row > 0) {
db_query("UPDATE {$db_prefix}members SET insurance = (insurance - 1))", __FILE__, __LINE__);
return "That user has insurance";
}
else {
//rest of code goes here
}
Then I guess if an item effects all members like 'rob the bank' then it would be written like this?
$result = db_query("SELECT insurance from {$db_prefix}members WHERE id_member = ($_POST['target'])", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
if ($row > 0) {
db_query("UPDATE {$db_prefix}members SET insurance = (insurance - 1))", __FILE__, __LINE__);
return "Some users have insurance and weren't affected.";
}
else {
//rest of code goes here
}
-
Close....
ok, for the specific member the query would look like this....
$result = db_query("SELECT insurance from {$db_prefix}members WHERE id_member = ($_POST['target'])", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
if ($row > 0) {
db_query("UPDATE {$db_prefix}members SET insurance = (insurance - 1) WHERE id_member = ($_POST['target']))", __FILE__, __LINE__);
return "That user has insurance";
}
else {
//rest of code goes here
}
for items like rob the bank, then you would use this one...
$result = db_query("SELECT insurance from {$db_prefix}members WHERE id_member = ($_POST['target'])", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
if ($row > 0) {
db_query("UPDATE {$db_prefix}members SET insurance = (insurance - 1) WHERE insurance > 0)", __FILE__, __LINE__);
return "That user has insurance";
}
else {
//rest of code goes here
}
Otherwise you run the risk of setting every members insurance field...even the ones that were zero...those checks keep that from happening
-
Close....
ok, for the specific member the query would look like this....
$result = db_query("SELECT insurance from {$db_prefix}members WHERE id_member = ($_POST['target'])", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
if ($row > 0) {
db_query("UPDATE {$db_prefix}members SET insurance = (insurance - 1) WHERE id_member = ($_POST['target']))", __FILE__, __LINE__);
return "That user has insurance";
}
else {
//rest of code goes here
}
for items like rob the bank, then you would use this one...
$result = db_query("SELECT insurance from {$db_prefix}members WHERE id_member = ($_POST['target'])", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
if ($row > 0) {
db_query("UPDATE {$db_prefix}members SET insurance = (insurance - 1) WHERE insurance > 0)", __FILE__, __LINE__);
return "That user has insurance";
}
else {
//rest of code goes here
}
Otherwise you run the risk of setting every members insurance field...even the ones that were zero...those checks keep that from happening
Okay, I'll update it
Now we need to work on the item ::)
-
Also, the code you're giving makes it so that the item you use on someone who has insurance fails and is delete, correct?
-
well, with a slight modification to the first part, yes you could have the item delete from inventory if the person they use it on has insurance
-
Here is what I've got to far for the whole item, I'm probably missing something very simple :uglystupid2:
<?php
/**********************************************************************************
* SMFShop item *
***********************************************************************************
* SMFShop: Shop MOD for Simple Machines Forum *
* =============================================================================== *
* Software Version: SMFShop 3.0 (Build 12) *
* $Date:: 2007-01-18 19:26:55 +1100 (Thu, 18 Jan 2007) $ *
* $Id:: Insurance.php 79 2007-01-18 08:26:55Z daniel15 $ *
* Software by: DanSoft Australia (http://www.dansoftaustralia.net/)*
* Copyright 2005-2007 by: DanSoft Australia (http://www.dansoftaustralia.net/)*
* Support, News, Updates at: http://www.dansoftaustralia.net/ *
* *
* Forum software by: Simple Machines (http://www.simplemachines.org) *
* Copyright 2006-2007 by: Simple Machines LLC (http://www.simplemachines.org) *
* 2001-2006 by: Lewis Media (http://www.lewismedia.com) *
**********************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');
// Your class should always be called item_filename
class item_Insurance extends itemTemplate
{
// When this function is called, you should set all the item's
// variables (see inside this example)
function getItemDetails()
{
// The author of the item
$this->authorName = 'xfollowthereaperx5';
// The author's website
$this->authorWeb = '';
// And their email address
$this->authorEmail = 'xfollowtehreaperx@hotmail.com';
// VALUES CHANGEABLE FROM WITHIN ADMIN PANEL:
// The name of the item
$this->name = 'Insurance';
// The item's description
$this->desc = 'Prevents negitive affects from occuring to you, one time use.';
// The item's price
$this->price = 500;
//UNCHANGEABLE VALUES:
// Whether the item requires input or not. In this case, we don't need
// any input
$this->require_input = false;
// Since this is a rock (you can't use it), we set this to false
$this->can_use_item = true;
// Since this item requires no input, we don't need to have a getUseInput function
// here (see the testitem2.php file if you want to make an item that needs input)
// Also, since this is a rock, you don't need an onUse function (since it doesn't get used)
$result = db_query(SELECT insurance FROM {$db_prefix}members WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
if ($row['insurance'] == 1) {
return "you are already insured";}
else {
$result = db_query(UPDATE {$db_prefix}members SET insurance = 1 WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
return "You are now insured!";}
?>
-
ok, well for the items that you want insurance to protect from here's an example...
This is from the steal.php item...
here is the original onuse function:
function onUse() {
global $db_prefix, $ID_MEMBER, $item_info, $sourcedir, $user_info;
// Check some inputs
if (!isset($_POST['stealfrom']) || $_POST['stealfrom'] == '') die("ERROR: Please enter a username to steal from!");
// Get a random number between 0 and 100
$try = mt_rand(0, 100);
// If successfull
if ($try < $item_info[1]) {
// Get stealee's money count
$result = db_query("SELECT money
FROM {$db_prefix}members
WHERE memberName = '{$_POST['stealfrom']}'", __FILE__, __LINE__);
// If user doesn't exist
if (mysql_num_rows($result) == 0) die("ERROR: The specified user doesn't exist!");
$row = mysql_fetch_array($result, MYSQL_ASSOC);
// Get random amount between 0 and amount of money stealee has
$steal_amount = mt_rand(0, $row['money']);
// Take this money away from stealee...
$result = db_query("UPDATE {$db_prefix}members
SET money = money - {$steal_amount}
WHERE memberName = '{$_POST['stealfrom']}'
LIMIT 1", __FILE__, __LINE__);
//...and give to stealer (robber)
$result = db_query("UPDATE {$db_prefix}members
SET money = money + {$steal_amount}
WHERE ID_MEMBER = {$ID_MEMBER}
LIMIT 1", __FILE__, __LINE__);
if($steal_amount < 50){
return "Steal successful, although you only stole {$steal_amount}!";
} else {
require_once($sourcedir . '/Subs-Post.php');
$topicOptions['board'] = 127; //SHOP history forum Mine is #98 You need to create this then use it's ID number
$topicOptions['id']=0; //NEW topic
$msgOptions['subject'] = "I am a Thief {$user_info['username']}"; //Subject
$msgOptions['body'] = "{$user_info['username']} just used a sticky hand and stole {$steal_amount} from ".$_POST['stealfrom']; //Message area
$msgOptions['icon'] = 'exclamation';
$posterOptions['id']=$ID_MEMBER; //Current user's ID
createPost(&$msgOptions, &$topicOptions, &$posterOptions); //create the post using the SMF posting function
return "Successfully stole $steal_amount from {$_POST['stealfrom']}! It's their fault they don't have their money in the bank!";
}
} else {
// If reducing Karma doesn't work, replace
// 'karmaBad = karmaBad + 10' with 'karmaGood = karmaGood - 10'
$result = db_query("UPDATE {$db_prefix}members
SET karmaBad = karmaBad + 10
WHERE ID_MEMBER = {$ID_MEMBER}",
__FILE__, __LINE__);
return "Steal <b>unsuccessful!</b> You Karma is now reduced by 10!";
}
}
}
and here is how the new function looks with the insurance check added in...
function onUse() {
global $db_prefix, $ID_MEMBER, $item_info, $sourcedir, $user_info;
// Check some inputs
if (!isset($_POST['stealfrom']) || $_POST['stealfrom'] == '') die("ERROR: Please enter a username to steal from!");
// Get a random number between 0 and 100
$try = mt_rand(0, 100);
// If successfull
if ($try < $item_info[1]) {
// Get stealee's money count
$result = db_query("SELECT money, insurance
FROM {$db_prefix}members
WHERE memberName = '{$_POST['stealfrom']}'", __FILE__, __LINE__);
// If user doesn't exist
if (mysql_num_rows($result) == 0) die("ERROR: The specified user doesn't exist!");
$row = mysql_fetch_array($result, MYSQL_ASSOC);
if ($row['insurance'] > 0) {
db_query("UPDATE {$db_prefix}members SET insurance = (insurance - 1) WHERE insurance > 0 AND memberName = '{$_POST['stealfrom']}'", __FILE__, __LINE__);
return "That user has insurance";
}
else {
// Get random amount between 0 and amount of money stealee has
$steal_amount = mt_rand(0, $row['money']);
// Take this money away from stealee...
$result = db_query("UPDATE {$db_prefix}members
SET money = money - {$steal_amount}
WHERE memberName = '{$_POST['stealfrom']}'
LIMIT 1", __FILE__, __LINE__);
//...and give to stealer (robber)
$result = db_query("UPDATE {$db_prefix}members
SET money = money + {$steal_amount}
WHERE ID_MEMBER = {$ID_MEMBER}
LIMIT 1", __FILE__, __LINE__);
}
if($steal_amount < 50){
return "Steal successful, although you only stole {$steal_amount}!";
}
else {
require_once($sourcedir . '/Subs-Post.php');
$topicOptions['board'] = 127; //SHOP history forum Mine is #98 You need to create this then use it's ID number
$topicOptions['id']=0; //NEW topic
$msgOptions['subject'] = "I am a Thief {$user_info['username']}"; //Subject
$msgOptions['body'] = "{$user_info['username']} just used a sticky hand and stole {$steal_amount} from ".$_POST['stealfrom']; //Message area
$msgOptions['icon'] = 'exclamation';
$posterOptions['id']=$ID_MEMBER; //Current user's ID
createPost(&$msgOptions, &$topicOptions, &$posterOptions); //create the post using the SMF posting function
return "Successfully stole $steal_amount from {$_POST['stealfrom']}! It's their fault they don't have their money in the bank!";
}
}
else {
// If reducing Karma doesn't work, replace
// 'karmaBad = karmaBad + 10' with 'karmaGood = karmaGood - 10'
$result = db_query("UPDATE {$db_prefix}members
SET karmaBad = karmaBad + 10
WHERE ID_MEMBER = {$ID_MEMBER}",
__FILE__, __LINE__);
return "Steal <b>unsuccessful!</b> You Karma is now reduced by 10!";
}
}
}
I will work on the actual item itself here shortly...you have a good start though!
-
Hmm, this is very confusing for someone like me :p
I'll hopefully have new versions for each item (with insurance coding in them) available. Once you finish the actuall item that is.
Thanks a lot for the help
-
ok, here's the completed item:
<?php
/**********************************************\
| SMFSHOP (Shop MOD for Simple Machines Forum) |
| (c) 2006 DanSoft Australia |
| http://www.dansoftaustralia.net/ |
\**********************************************/
//File: Insurance.php
class item_Insurance extends itemTemplate {
function getItemDetails() {
$this->authorName = "TechnoDragon";
$this->authorWeb = "http://dragontalk.net";
$this->authorEmail = "admin@dragontalk.net";
$this->name = "Item Protection";
$this->desc = "Protect yourself from bad items.";
$this->price = 100;
$this->require_input = false;
$this->can_use_item = true;
}
// See 'AddToPostCount.php' for info on how this works
function getAddInput() {
return "Number of times to protect from bad items: <input type='text' name='info1' value='5' />";
}
function getUseInput() {
return "";
}
function onUse() {
global $db_prefix, $ID_MEMBER, $item_info;
$result = db_query("UPDATE {$db_prefix}members
SET insurance = insurance + {$item_info[1]}
WHERE ID_MEMBER = {$ID_MEMBER}",
__FILE__, __LINE__);
return "You are now protected from bad items for {$item_info[1]} times!";
}
}
?>
Just make sure to call it Insurance.php (notice the case of the letters)
-
Okay, when I go to use the insurance item it tells me that I need to upgrade my database
Where can I do that?
It says my database is 1.1 and my SMF is 1.1.2
Unknown column 'insurance' in 'field list'
File: /hosted/subs/ulmb.com/p/o/powerspike/public_html/forums/Sources/shop/items/Insurance.php
Line: 39
Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 1.1.2, while your database is at version 1.1. The above error might possibly go away if you execute the latest version of upgrade.php.
-
How do I add the insurance thing to my database?
I'm really confused about this part, I found smf_members, but thats it, once I go into that thing it doesn't show anything like "add database item" or whatever. What would be the inputs as well.
-
ok, give me a few and I will make up a package so you can install the item through the smf package manager...
-
ok, give me a few and I will make up a package so you can install the item through the smf package manager...
Wow, thanks so much :smitten:
-
ok, you can download an installable package HERE (http://dragontalk.net/index.php?action=tpmod;dl=item84)
This will do everything for you so all you'll have to do is add the item to your shop through the admin panel!
-
Thanks a billion
-
Didn't work :'(
Fatal error: require() [function.require]: Failed opening required '/hosted/subs/ulmb.com/p/o/powerspike/public_html/forums/Packages/temp/avtr_install.php' (include_path='.:') in /hosted/subs/ulmb.com/p/o/powerspike/public_html/forums/Sources/Packages.php on line 552
-
hold on...apparently i missed an edit...give me a sec
-
ok, redownload and try again
-
Error: The installer was unable to add a needed setting to the {db_prefix}members table. You may have to do this yourself.
I'm sure, if I try hard enough, that I can add that part. :coolsmiley:
Thanks a lot
-
that would be the insurance field...
-
:\
So, it didn't work? :(
-
are you sure you didn't already add the insurance field to your member table?
-
No, it's still giving me errors :'(
Unknown column 'insurance' in 'field list'
File: /hosted/subs/ulmb.com/p/o/powerspike/public_html/forums/Sources/shop/items/Insurance.php
Line: 39
Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 1.1.2, while your database is at version 1.1. The above error might possibly go away if you execute the latest version of upgrade.php.
-
ok, mediumint 10 default is zero
-
I got the item to work, now I need to edit in the codes for the items that I would like to prevent.
If I get them to work, I'll put them in a Zip and host them for everyone
-
Can you do me a favor and post another example item that works with insurance, and if you already coded all of the items with the new insurance code, could you please post them?
Thanks, it looks as if you made it so that the items STILL can be unsuccessful, but if they are successful, and the member has insurance, the item still does nothing. Very awesome idea, I wouldn't have thought of it.
Thanks a lot
-
Well, that opackage you downloaded from me already has the steal item edited...as for mass use items (like aramageddon or rob the bank) i already have those figured out how to make them work!
-
Is the steal item the updated version without the bug in it?
-
it has been working perfectly for me...though i suppose i could zip up all of the items i have edited and post them here...
-
it has been working perfectly for me...though i suppose i could zip up all of the items i have edited and post them here...
PLEASE DO IT :D
-
Ok, just added a zip file to my downloads section at my site that hass ALL of the items i have edited to work with insursurance...as well as a few other extras in them...
I have modified them to also post a new topic to the forum when used...though you will have to modify them to insert your own board id...
This line is what tells it what board to post to:
$topicOptions['board'] = 127; //SHOP history forum Mine is #98 You need to create this then use it's ID number
-
Ok, just added a zip file to my downloads section at my site that hass ALL of the items i have edited to work with insursurance...as well as a few other extras in them...
I have modified them to also post a new topic to the forum when used...though you will have to modify them to insert your own board id...
This line is what tells it what board to post to:
$topicOptions['board'] = 127; //SHOP history forum Mine is #98 You need to create this then use it's ID number
So if I don't add that code the item will still work perfectly fine?
Thanks a bunch, sorry for bugging you :P
-
actually that line is already in each of those files you are/have downloaded you'll have to modify it to a different board id (unless you already have a board id of 127) lol
-
Codes, meaning items? Okay, I'll edit it out ::)
Thanks a lot
I'll make the first post have all of the information anyone would need to add this item to their forum
-
Wow, great idea, I may implement something similar in a future version of SMFShop :).
Just a note, I'm very strict about the SMF Coding Guidelines now... it's best to make sure your code follows the coding guidelines (see http://custom.simplemachines.org/mods/guidelines.php) :)
Also, to whoever invented the SMFShop logging stuff:
require_once($sourcedir . '/Subs-Post.php');
$topicOptions['board'] = 127; //SHOP history forum Mine is #98 You need to create this then use it's ID number
$topicOptions['id']=0; //NEW topic
$msgOptions['subject'] = "I am a Thief {$user_info['username']}"; //Subject
$msgOptions['body'] = "{$user_info['username']} just used a sticky hand and stole {$steal_amount} from ".$_POST['stealfrom']; //Message area
$msgOptions['icon'] = 'exclamation';
$posterOptions['id']=$ID_MEMBER; //Current user's ID
createPost(&$msgOptions, &$topicOptions, &$posterOptions); //create the post using the SMF posting function
SMFShop 3.0 has a Shop-Subs.php file... It may be worth creating a function called ShopLog() or similar, and placing the code in there. Then, reduce the code in the SMFShop item to a single function call :).
I may have logging in a future version, but unfortunately, school is taking up all my free time at the moment :(
-
Very nice so far, some improvements I'd like to see are these:
PM user when his/her insurance is completely gone
Somehow show how much insurance a certain user has
-
Ya, those are the exact ideas i have for it as well....who knows...maybe I will have enough spare time this weekend to figure out how to do that!
-
Very nice so far, some improvements I'd like to see are these:
PM user when his/her insurance is completely gone
Somehow show how much insurance a certain user has
I'm afraid I cannot be of much help, however how about having it so a user is PMed say five days before, a day before, and then right when it expires? This way they can keep track of it ahead of time, or if possible just add a counter to their profile so that someone can see someones insurance that way, and they can also find out manually that way. Being PMed five days before, a day before, and then right when it expires, would also help those who are just plain lazy.
Jeff.
-
well, the day timing won't work, because it sets a "counter" that degrades each time it is used... I am working on something that would allow a user to see how many uses htey have left
-
The Rob the Bank item you uploaded isn't working for me :(
-
it is generating any errors?
-
Yes, it is
If you want I can check which error, but I'm sure you know what error it is anyways :p
-
actually no...it seems to be working fine on my forum...let me attach my version and see if that fixes it for you...just remember to change the board number in the code for the item
-
actually no...it seems to be working fine on my forum...let me attach my version and see if that fixes it for you...just remember to change the board number in the code for the item
Thanks so much
-
You are very welcome!
Ok, I have added the tinsurance count so members can see how much they have left (This only show the particular member and noone else)
in shop.template.php find:
<b>',$txt['shop_money_in_pocket'],': </b>',$context['shop_money'],'<br />
',$context['shop_money_in_bank'],'<br />
add after:
';<b>',$txt['shop_money_in_pocket'],': </b>',$context['shop_money'],'<br />
',$context['shop_money_in_bank'],'<br />';
if ($context['shop_shieldleft'] > 5){
echo'
<b>',$txt['shop_insurance'],':</b> ',$context['shop_shieldleft'],'<br />';
}
elseif ($context['shop_shieldleft'] >1 && $context['shop_shieldleft'] < 5){
echo'
<font color="red">',$txt['shop_insurance_low'],'</font><br />
<b>',$txt['shop_insurance'],':</b> ',$context['shop_shieldleft'],'<b> ',$txt['shop_insurance_left'],'</b><br />';
}
else{
echo'
<font color="red">',$txt['shop_insurance_none'],'</font><br />
<b>',$txt['shop_insurance'],':</b> ',$context['shop_shieldleft'],'<b> ',$txt['shop_insurance_left'],'</b><br />';
}
echo'
in shop.php find:
// The current member's money
$result = db_query("SELECT money, moneyBank
add after:
, insurance
find:
$context['shop_money_bank'] = formatMoney($row['moneyBank']);
add after:
$context['shop_shieldleft'] = $row['insurance'];
add these strings to the shop.english.php
$txt['shop_insurance'] = "Dragon Shield";
$txt['shop_insurance_low'] = "Your Dragon Shield is getting low! You may want to stock up!";
$txt['shop_insurance_none'] = "You have no Dragon Shield...Be Warned, this makes you a target for those that like to steal!";
$txt['shop_insurance_left'] = "Remaining";
make sure to change them to reflect what you call the insurance on your forum.
this will display their current amount left as well as change what message displays based on how much they have left
-
Wow. Interesting thread. Is there a complete version somewhere so I can try to add this item or is TechnoDrago's code just above this post the complete code so far?
-
well, there is no complete installpackage if that is what you mean...the zip file i have at my site should add the item and the database field, but the code above has to be manually installed to have the current shield count show up for the member in the shop
-
Has anyone gotten one to work with Egg Avatar or Karma Bash?
-
I haven't implemented it yet for either of those items, but I am sure it wouldn't be much harder than any of the other items
-
Karmagedon would be nice ;)
-
i'll see what I can do...the items I already released were the ones I modified on my site....didn't want them to be protected from EVERYTHING! LOL
-
TechnoDragon, has anyone on your forums successfully used "robthebank" because it doesn't seem it let me successfully do it
-
well if you mean it failed...that is because of the extremely low percentage chance of success...if you mean there is an error if there is success Iwill look at my code and if there is an issue I will post up the corrected item
-
I would like protection against some items but is this item finalised? I downloaded and installed it via package manager, but nothing shows in the add/edit/delete shop item page. Does something have to be done manually?
Also does it tell you who the person stealing the money, the karma, etc is? That would be good to know.
-
it should show up in the items list so that you can add it to the shop to buy...if not try checking your server to make sure iot was uploaded. I can't remember if I added a PM to these versions or not. Most likely not, because it would require manual changes to the files for the board you want it posted to.
-
I have the insurance working fine but I would like to display the insurance value in the message window just below the post count. Someone please. How can I show the insurace value in the message window just below the post count?
-
Where Do I Download The Pakage,or how do i install it :tickedoff:
-
ok, you can download an installable package HERE (http://dragontalk.net/index.php?action=tpmod;dl=item84)
This will do everything for you so all you'll have to do is add the item to your shop through the admin panel!
that answer your question vista?
I have the insurance working fine but I would like to display the insurance value in the message window just below the post count. Someone please. How can I show the insurace value in the message window just below the post count?
Well, you don't WANT other people to know how much insurance they have... Otherwise they wouldn't waste their items on the person. That is why i wont help you make it show. =)
-
You are very welcome!
Ok, I have added the tinsurance count so members can see how much they have left (This only show the particular member and noone else)
in shop.template.php find:
<b>',$txt['shop_money_in_pocket'],': </b>',$context['shop_money'],'<br />
',$context['shop_money_in_bank'],'<br />
add after:
';<b>',$txt['shop_money_in_pocket'],': </b>',$context['shop_money'],'<br />
',$context['shop_money_in_bank'],'<br />';
if ($context['shop_shieldleft'] > 5){
echo'
<b>',$txt['shop_insurance'],':</b> ',$context['shop_shieldleft'],'<br />';
}
elseif ($context['shop_shieldleft'] >1 && $context['shop_shieldleft'] < 5){
echo'
<font color="red">',$txt['shop_insurance_low'],'</font><br />
<b>',$txt['shop_insurance'],':</b> ',$context['shop_shieldleft'],'<b> ',$txt['shop_insurance_left'],'</b><br />';
}
else{
echo'
<font color="red">',$txt['shop_insurance_none'],'</font><br />
<b>',$txt['shop_insurance'],':</b> ',$context['shop_shieldleft'],'<b> ',$txt['shop_insurance_left'],'</b><br />';
}
echo'
in shop.php find:
// The current member's money
$result = db_query("SELECT money, moneyBank
add after:
, insurance
find:
$context['shop_money_bank'] = formatMoney($row['moneyBank']);
add after:
$context['shop_shieldleft'] = $row['insurance'];
add these strings to the shop.english.php
$txt['shop_insurance'] = "Dragon Shield";
$txt['shop_insurance_low'] = "Your Dragon Shield is getting low! You may want to stock up!";
$txt['shop_insurance_none'] = "You have no Dragon Shield...Be Warned, this makes you a target for those that like to steal!";
$txt['shop_insurance_left'] = "Remaining";
make sure to change them to reflect what you call the insurance on your forum.
this will display their current amount left as well as change what message displays based on how much they have left
What Version Is This For? I Need Help I Have SMF Shop 3.0 and SMF Version 1.1.3
Please Help Me Add This
-
use the link at my above post
-
no i mean i cant find those parts in the files??? there not there??? (shop.php, and the shop.template.php) where you say look for these Parts and add after or before there on in the code at all please help me :)
-
~!~Add a Meter On Your Shop Home Page To Tell You How Many Insurance's You Have Left.~!~
-All Credit Goes To Feildmaster - He Gave Me These Edits I'm Just Posting Them For Everyone Else.
These Codes Have been Tested By Me On SMF 3.0 Shop And These SMF Versions:
1. 1.1.3
2. 1.1.4
Here Are The Code Edits...
Open... Sources/Load.php
Find...
// Begin SMFShop MOD Version New Version
'money' => isset($user_settings['money']) ? $user_settings['money'] : '',
'moneyBank' => isset($user_settings['moneyBank']) ? $user_settings['moneyBank'] : '',
// End SMFShop MOD
Add After...
'insurance' => isset($user_settings['insurance']) ? $user_settings['insurance'] : '',
Find...
mem.buddy_list, mg.onlineColor AS member_group_color, IFNULL(mg.groupName, '') AS member_group,
pg.onlineColor AS post_group_color, IFNULL(pg.groupName, '') AS post_group, mem.is_activated, mem.shop_nameStyle, mem.money,
Add At End...
mem.insurance,
Find...
// Begin SMFShop MOD Version New Version
'money' => $profile['money'],
// End SMFShop MOD
Add After...
'insurance' => $profile['insurance'],
Find....
'money' => &$user_info['money'],
Add After...
'insurance' => &$user_info['insurance'],
Save Load.php...
Open Themes/default/shop.templete.php...
Find...
', sprintf($txt['shop_currently_have1'], formatMoney($context['user']['money'])), ($modSettings['shopBankEnabled'] ? sprintf($txt['shop_currently_have2'], formatMoney($context['user']['moneyBank'])) : ''), '
<br /><br />';
Add After...
echo 'Insurance Left: ', $context['user']['insurance'] > 5? $context['user']['insurance'] : ($context['user']['insurance'] > 0 ? '<font color="red">'.$context['user']['insurance'].', you might want to consider buying more.</font>' : '<font color="red">NONE! Buy more from the shop!</font>');
Save Themes/default/shop.templete.php...
Congrats On The New Meter
-All Credit Goes To Feildmaster - He Gave Me These Edits I'm Just Posting Them For Everyone Else.
-
Does anyone have a copy of this mod that they could provide here? TechnoDragon shut down his website so the download link no longer works. He suspended his own site with his own hosting company because he didn't have any time to maintain it.
Thanks,
brianjw
-
Wait so is
http://www.daniel15.com/forum/index.php/topic,620.msg7595.html#msg7595
The entire mod, or just the insurance meter? Where can I find the latest codes together? I'd like to install this one.
-
I'm just gonna bump this.
-
It's nice to see how often people post on this forum. :'(
-
Unfortunately, it's now often at all...