GregFest Posted March 2, 2011 Posted March 2, 2011 Just have a question is there something out there where if a new player joins your game it sends them a welcome message Quote
a_bertrand Posted March 2, 2011 Posted March 2, 2011 Just add an insert in the register file... should not be that complex. Quote
Haunted Dawg Posted March 2, 2011 Posted March 2, 2011 lol hahaha mysql_query('INSERT INTO `events` VALUES()'); If you can post of the Table Structure for the event's table, ill be able to complete the rest. I have not looked at MCCode for over a year and a half, and can't be bothered for a simple query. Quote
Djkanna Posted March 2, 2011 Posted March 2, 2011 After $i = $db->insert_id(); in register.php Add //Define $mail and $subject before hand with the message you'd like to send $db->query('INSERT INTO `mail` ( `mail_to`, `mail_time`, `mail_subject`, `mail_text` ) VALUES ( '.$i.', UNIX_TIMESTAMP(), "'.$db->escape($subject).'", "'.$db->escape($mail).'")'); Done. EDIT: Optionally alter the create user query to set the new_mail field to 1 or $db->query('UPDATE `users` SET `new_mail` = 1 WHERE (`userid` = '.$i.')'); Quote
Dayo Posted March 2, 2011 Posted March 2, 2011 DJ would you not define the new message within the insert query or even set the default to 1 ;) and why not just use the event_add() function? Quote
Djkanna Posted March 3, 2011 Posted March 3, 2011 DJ would you not define the new message within the insert query or even set the default to 1 ;) and why not just use the event_add() function? EDIT: Optionally alter the create user query to set the new_mail field to 1 or Either would work those two were just examples, and I think it's because the event_add is for events rather than messages. :P Quote
Dayo Posted March 3, 2011 Posted March 3, 2011 but wouldent an event be better, cos you joining is an event itself Quote
Djkanna Posted March 4, 2011 Posted March 4, 2011 but wouldent an event be better, cos you joining is an event itself That's entirely not my call, the topic poster asked for a welcome message so that's what I gave. :) Quote
GregFest Posted March 7, 2011 Author Posted March 7, 2011 thanks to all who posted it was a lot of help, thanks again Quote
MrEvilChaos Posted March 24, 2011 Posted March 24, 2011 After $i = $db->insert_id(); in register.php Add //Define $mail and $subject before hand with the message you'd like to send $db->query('INSERT INTO `mail` ( `mail_to`, `mail_time`, `mail_subject`, `mail_text` ) VALUES ( '.$i.', UNIX_TIMESTAMP(), "'.$db->escape($subject).'", "'.$db->escape($mail).'")'); Done. EDIT: Optionally alter the create user query to set the new_mail field to 1 or $db->query('UPDATE `users` SET `new_mail` = 1 WHERE (`userid` = '.$i.')'); So I would put $db->query('INSERT INTO `mail` ( `mail_to`, `mail_time`, `mail_subject`, `mail_text` ) VALUES ( '.$i.', UNIX_TIMESTAMP(), "'.$db->escape(Welcome).'", "'.$db->escape(Hello Welcome to the game.'")'); Quote
Dave Posted March 24, 2011 Posted March 24, 2011 Above the insert simple define the two variables like such $subject = "Welcome to MYGAME!"; $mail = "Some really long message right here..."; Quote
MrEvilChaos Posted March 24, 2011 Posted March 24, 2011 Ahh okay and How would one get it so It would come from Id 2 Not id 1? Quote
Djkanna Posted March 25, 2011 Posted March 25, 2011 Ahh okay and How would one get it so It would come from Id 2 Not id 1? $db->query('INSERT INTO `mail` ( `mail_to`, `mail_from`, `mail_time`, `mail_subject`, `mail_text` ) VALUES ( '.$i.', 2, UNIX_TIMESTAMP(), "'.$db->escape($subject).'", "'.$db->escape($mail).'")'); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.