Sjobbe Posted May 16, 2013 Posted May 16, 2013 I have made this little module, it will allow admins to give users premium for the amount of days the admin desire you can find the module here http://nw-engine.com/index.php?c=modules&m=153 if you have any idear to improvement just write it here or send me a pm. /Sjobbe And Thanks to Kyle for his expertise/help.. Quote
Sjobbe Posted May 16, 2013 Author Posted May 16, 2013 Congratulations on your first mod! thank you more will come... :) Quote
KyleMassacre Posted May 16, 2013 Posted May 16, 2013 (edited) I have made this little module, it will allow admins to give users premium for the amount of days the admin desire you can find the module here http://nw-engine.com/index.php?c=modules&m=153 if you have any idear to improvement just write it here or send me a pm. /Sjobbe And Thanks to Kyle for his expertise/help.. Congrats on your first submission. And no problem, it was my pleasure. I hope to see what you come up with next Also what I would do is send some sort of notification to the player that you gave premium days to and let him/her know: if (function_exists("SendMessage")) SendMessage($_POST["user"],"Look What You Got",Translate("You have just been givin %s Premium Days for being so awesome",$_POST["Days"]),1); Something like that otherwise they have no idea what has happened Edited May 16, 2013 by KyleMassacre spelling error Quote
Uridium Posted May 16, 2013 Posted May 16, 2013 Your content.php is wrong its adding by days and not by time so the userVariable is always wrong,,, Quote
Uridium Posted May 16, 2013 Posted May 16, 2013 overwrite your content.php with this one.. <?php if (! IsModerator()) { header("Location: index.php"); return; } TableHeader("Add Days"); if (isset($_POST['user'])) { if(!FindUser($_POST["user"])) { ErrorMessage("Selected user is invalid"); return; } else if (!isset($_POST['Days'])) { ErrorMessage("You must select the amount of days to give"); return; } else { $currentMembership = GetUserVariable(premiumMember); // Initial value or old membership if ($currentMembership == null || $currentMembership + 0 < time()) $currentMembership = time() + (GetConfigValue("premiumMembershipDuration", "premium") * $_POST["Days"] * 48 * 60); // Adding to the current membership else $currentMembership += (GetConfigValue("premiumMembershipDuration", "premium") * $_POST["Days"] * 48 * 60); SetUserVariable(premiumMember, $currentMembership); // REMOVED FOLLING LINES THESE ARE NOT NEEDED ANY MORE BUT WILL KEEP FOR FUTURE USE.. //$newValue = (GetUserVariable(premiumMember,$_POST["user"]) + $_POST["Days"]) + 0; //SetUserVariable(premiumMember, $newValue, $_POST["user"]); ResultMessage(Translate("New value is % s", TimeInterval(time(), GetUserVariable(premiumMember,$_POST["user"])))); } } echo "<form method='post' name='AddPremiumdays'>"; echo "<table class='plainTable'>"; echo "<tr><td width='1%' valign='top'><b>" . str_replace(" ","Â ",Translate("User:")) . "</b></td><td>" . SmartSelection("select id,username from users where id <> 1", "user", $userId) . "</td></tr>"; echo "<tr><td width='1%' valign='top'><b>" . str_replace(" ","Â ",Translate("Days:")) . "</b></td><td><input type='text' name='Days' placeholder='Amount of days'></td></tr>"; // leave below lines unedited this will come in useful for a later addition if needed.. /*if (GetUserVariable(premiumMember) == 0) { echo Translate("User has no days left"); } else echo Translate("user has %s.", TimeInterval(time(), GetUserVariable(premiumMember))) ."<br>";*/ echo "</table>"; echo "</form>"; TableFooter(); ButtonArea(); SubmitButton("Add Days", "AddPremiumdays"); EndButtonArea(); Quote
Sjobbe Posted May 16, 2013 Author Posted May 16, 2013 I Will look into it today it worked for me the user i added premium to Got premium but update later today Quote
Sjobbe Posted May 16, 2013 Author Posted May 16, 2013 update send in. just waitning aproval from Alain.. and thanks for the feed back. I hope to be done with one more module to night. Quote
Sjobbe Posted May 18, 2013 Author Posted May 18, 2013 this mod will change name to admin_player_premium because its not just to give anymore. just need to be accepted by alain. Quote
Sjobbe Posted May 19, 2013 Author Posted May 19, 2013 This mod is now placed here http://nw-engine.com/index.php?c=modules&m=154 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.