Warning: preg_replace_callback(): Requires argument 2, '$func['entity_fix']('\2')', to be a valid callback in /nfs/c01/h06/mnt/10927/domains/dragonprime.net/html/Sources/Load.php(225) : runtime-created function on line 3

Warning: preg_replace_callback(): Requires argument 2, '$func['entity_fix']('\2')', to be a valid callback in /nfs/c01/h06/mnt/10927/domains/dragonprime.net/html/Sources/Load.php(225) : runtime-created function on line 3
Print Page - adding a "no mail on bank robbed" setting

DragonPrime - LoGD Resource Community

Coding Support => v0.9.7 Technical Help => Topic started by: sixf00t4 on May 23, 2004, 05:19:19 PM



Title: adding a "no mail on bank robbed" setting
Post by: sixf00t4 on May 23, 2004, 05:19:19 PM
people rob the bank a lot on my server.  Which everyone is fine with, the only problem is the YOM everytime someone does.  

How can i add a game setting in preferences to enable/disable those mails?


Title: Re:adding a "no mail on bank robbed" setting
Post by: Auron on May 23, 2004, 05:21:06 PM
Wouldn't you just get rid of the systemmail statement?


Title: Re:adding a "no mail on bank robbed" setting
Post by: sixf00t4 on May 23, 2004, 05:22:27 PM
well, some people like to know when some of their money is taken ;D


Title: Re:adding a "no mail on bank robbed" setting
Post by: Jnfoot on May 23, 2004, 05:51:45 PM
You could just add a new colomn to the accounts table called mailonrob default 1, and in the preferences, just add another part called Receive YOM on bank robbery, and if the user chooses yes, then have mailonrob=1, and if no, then have mailonrob=0. Then just put If ($session['user']['mailonrob']==1) { around the systemmail function.


Title: Re:adding a "no mail on bank robbed" setting
Post by: sixf00t4 on May 23, 2004, 05:58:58 PM
not really.

$session user is the person robbing the bank.

so i would need to make a db call to look at whether or not mailonrob =1 or 0
...
makes logical sense...guess i just have to give her the trial and error and code it.


Title: Re:adding a "no mail on bank robbed" setting
Post by: sixf00t4 on May 23, 2004, 06:15:48 PM
wait a minute....

in my preferences, i already have
Code:
,"systemmail"=>"Send email for system generated messages?,bool"

anyone know of code in any file that uses that setting?  it is a stock setting.

i am at work now, and dont have a "find in files" feature in my text editor.  if anyone does, and wants to help me out, do a find in files for "systemmail" in the logd directory.   if not, i will do it when i get home...thanks


Title: Re:adding a "no mail on bank robbed" setting
Post by: Talisman on May 23, 2004, 06:41:35 PM
That's used to determine whether or not an email is sent to the user when the system generates a YOM.  I don't think it's what you're after...

systemmail is a function in common.php; one file that calls it is pvp.php


Title: Re:adding a "no mail on bank robbed" setting
Post by: sixf00t4 on May 23, 2004, 06:50:14 PM
 ???

hmmmmmm....i am confused then.  the check for whether or not to send the message is built into the systemmail() function in common.php.

that is how the message is sent in robbing the bank, with systemmail.  so, the question...
A.  does that feature even work???
B.  Why is it ignoring it from rob the bank?


Title: Re:adding a "no mail on bank robbed" setting
Post by: Talisman on May 23, 2004, 07:08:51 PM
Because you are confusing YOMs with emails.  The system will generate a message and YOM it to you - such as successful in the fields.  The check here is whether or not the game will send you an email to you@here.com in addition to that YOM


Title: Re:adding a "no mail on bank robbed" setting
Post by: sixf00t4 on May 23, 2004, 07:10:13 PM
I bet kids loved you in kindergarten Tal.
know it all. :P


Title: Re:adding a "no mail on bank robbed" setting
Post by: Talisman on May 23, 2004, 07:12:53 PM
Ouch   ;D


Title: Re:adding a "no mail on bank robbed" setting
Post by: sixf00t4 on May 23, 2004, 07:36:01 PM
:)

ok, i got it working, but for some reason the preferences are not changing robmail from 0 to 1, or vice versa.

i just copied the systemmail line.
Code:
,"robmail"=>"Send YOM when bank is robbed?,bool"

if i manipulate the db directly to 0 or 1, it works.
and the weird thing is, it will switch from yes to no.  just not show up in the db, and it wont change whether they get mail or not.  
i see no sql statement anywhere...am i missing one?


Title: Re:adding a "no mail on bank robbed" setting
Post by: Talisman on May 23, 2004, 08:19:49 PM
What you are doing is setting a new value in the prefs array - it is updating, and will not touch the field you created.  You need to either load that array for each user (seems like a waste of resources to me).


Title: Re:adding a "no mail on bank robbed" setting
Post by: Excalibur on May 23, 2004, 10:24:16 PM
In robbank.php you have this line
Code:
$sql = "SELECT acctid,goldinbank,bounty,login FROM accounts";
just change it to
Code:
$sql = "SELECT acctid,goldinbank,bounty,login,yom FROM accounts";
Then add an IF statement to check if player want to receive the YOM message:
Code:
if ($row['yom']==0){
                        $mailmessage = "`^".$session[user][name]." ha derubato la banca e ha preso $takengold pezzi del tuo oro.";
                                $mailmessage = str_replace("%p",($session['user']['sex']?"her":"his"),$mailmessage);
                                $mailmessage = str_replace("%o",($session['user']['sex']?"she":"he"),$mailmessage);
                                //systemmail($row['acctid'],"`2Parte del tuo Oro stato rubato`2",$mailmessage);
                        if ($takengold!=0) systemmail($row['acctid'],"`2Parte del tuo Oro stato rubato`2",$mailmessage);
                        }
in prefs.php add this line before the systemmail control
Code:
,"yom"=>"Send YOM when bank is robbed?,bool"
and finally add the "yom" field in accounts db

I haven't test it, but it should work ;)

Rgds Excalibur


Title: Re:adding a "no mail on bank robbed" setting
Post by: sixf00t4 on May 23, 2004, 10:33:58 PM
good ol Tal...his heart was in the right place.

Ex, leave that code there, that is what Tal and i had, and have.  The problem is the prefs array does not work.  and we cant figure out why.

BREAKDOWN:
the code in robbank works fine.

we need to find a way to manipulate the dbfield in prefs.php


Title: Re:adding a "no mail on bank robbed" setting
Post by: Excalibur on May 24, 2004, 01:33:27 AM
we need to find a way to manipulate the dbfield in prefs.php

I've found a solution :)

Locate this code in prefs.php
Code:
if (stripslashes($_POST['bio'])!=$session['user']['bio']){
before it add:
Code:
if (stripslashes($_POST['yom'])!=$session['user']['yom']) $session[user][yom]=stripslashes($_POST['yom']);

You have to change this line if robbank.php:
from:
Code:
if ($row['yom']==0){
to:
Code:
if ($row['yom']!=0){
When you create the 'yom' field in DB you can choose what you want to do, set it to '0' to avoid to send sysmail for robbank, set it to '1' to send sysmail for robbank.

I've tried on my local server and it works fine ;)

Rgds Excalibur


Title: Re:adding a "no mail on bank robbed" setting
Post by: sixf00t4 on May 24, 2004, 01:56:27 PM
Rock on Ex!

you are a great asset!!


Title: Re:adding a "no mail on bank robbed" setting
Post by: Talisman on May 24, 2004, 02:31:19 PM
Yup, now I can stop banging my head against the wall...nice job, Excalibur!


Title: Re:adding a "no mail on bank robbed" setting
Post by: Excalibur on May 24, 2004, 02:36:09 PM
Rock on Ex!
you are a great asset!!

 :-[ ::hide himself ashamed for the nice words::  :-[


Title: Re:adding a "no mail on bank robbed" setting
Post by: sixf00t4 on May 24, 2004, 03:44:15 PM
rough childhood?  :P

compliments are a good thing Ex, don't hide.  Infact, do just the opposite!


Title: Re:adding a "no mail on bank robbed" setting
Post by: Excalibur on May 24, 2004, 03:57:46 PM
rough childhood?  :P

compliments are a good thing Ex, don't hide.  Infact, do just the opposite!
Nah, just joking :D
I'm not at all a programmer (studied Cobol & Fortran about 25 years ago). I've taken the co-management of a LoGD site at the beginning of this years, I've never studied PHP, learned it reading the source code, and started to program my first MOD 2-3 months ago.
So, finding a solution to your problem, and listening to your compliments makes me feel pride  :D 8) :D

With respect
Excalibur


Title: Re:adding a "no mail on bank robbed" setting
Post by: Talisman on May 25, 2004, 12:34:14 PM
Ok...now here's why you keep me around... ;D

You need to add a line in dragon.php to carry that setting over after a DK.

Find:  ,"beta"=>1
Insert after:  ,"robmail"=>1

© 2019 DragonPrime - LoGD Resource Community
Email Talisman: talisman -at- gmail.com
&oeXs)2U7=V BmܲV.U e=;p\}eG )Jj} C5EH7ˤH=j } mo|*Ŋw{drV_@IV>/- TFQJ׀̀Ve}l1,V O iNYx͘$e$;
Forums: Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines