Thread: Autovote - Motivote - Server and Web tutorial

Page 1 of 13 12311 ... LastLast
Results 1 to 10 of 121
  1. #1 Autovote - Motivote - Server and Web tutorial 
    ???

    funkE's Avatar
    Join Date
    Feb 2008
    Posts
    2,612
    Thanks given
    255
    Thanks received
    989
    Rep Power
    1366


    MOTIVOTERS (v3) HAS BEEN RELEASED

    So I made Motivote pretty easy to install, right off the bat. The only real tricky part is going to be writing the code that gives the user the reward, but I've made that as simple as I can make it.



    1. Create a MySQL database, user, and give the user as many privileges as you can.
    2. Extract Motivote-(WHATEVER CURRENT VERSION IS)-web.rar and upload the contents into a directory on your website. I'd use /vote/.
    3. Set permissions on config.php to 0777. If you don't, the script will tell you what to put in config.php by yourself.
    4. Visit http://yoursite.com/vote/ and enter the installation information and just follow the steps.
    5. MAKE SURE YOU SAVE YOUR SERVER DATA CALLBACK KEY AND YOUR ADMIN CONTROL PASSWORD!




    Then, for the server installation, include Motivote-(current version).jar in your build path.
    For PI, here's the method I added in PlayerHandler.java: Add to PlayerHandler.java - Pastebin.com

    Create RewardHandler.java:
    Code:
    import server.model.players.Client;
    import server.model.players.Player;
    import server.model.players.PlayerHandler;
    
    import com.rspserver.motivote.MotivoteHandler;
    import com.rspserver.motivote.Reward;
    
    public class RewardHandler extends MotivoteHandler<Reward>
    {
    	@Override
    	public void onCompletion(Reward reward)
    	{
    		// SOME OF THIS CODE WILL BE DIFFERENT FOR YOUR SERVER, CHANGE IT ACCORDINGLY. everything to do with motivote will stay the same!
    		int itemID = -1;
    		
    		if (reward.rewardName().equalsIgnoreCase("gold"))
    		{
    			itemID = 995;
    		}
    		
    		if (PlayerHandler.isPlayerOn(reward.username()))
    		{
    			Player p = PlayerHandler.getPlayer(reward.username());
    			
    			if (p != null && p.isActive == true) // check isActive to make sure player is active. some servers, like project insanity, need extra checks.
    			{
    				synchronized(p)
    				{
    					Client c = (Client)p;
    					
    					if (c.getItems().addItem(itemID, reward.amount()))
    					{
    						c.sendMessage("You've received your vote reward! Congratulations!");
    						reward.complete();
    					}
    					else
    					{
    						c.sendMessage("Could not give you your reward item, try creating space.");
    					}
    				}
    			}
    		}
    	}
    }
    Add where you initialize/start everything else:
    Code:
    new Motivote(new RewardHandler(), "http://yoursite.com/vote/", "server data callback key").start();


    Really, it's that easy. If you have any issues, just post a reply and I'll try and sort them out to the best of my ability. Thanks!
    Last edited by Major; 12-13-2014 at 06:50 PM.
    .
    Reply With Quote  
     


  2. #2  


    Major's Avatar
    Join Date
    Jan 2011
    Posts
    2,997
    Thanks given
    1,293
    Thanks received
    3,556
    Rep Power
    5000
    Why do people insist on formatting their code unconventionally

    Edit: also

    Code:
    p.isActive == true
    Last edited by Major; 11-30-2014 at 09:44 PM.
    Reply With Quote  
     

  3. #3  
    ???

    funkE's Avatar
    Join Date
    Feb 2008
    Posts
    2,612
    Thanks given
    255
    Thanks received
    989
    Rep Power
    1366
    Quote Originally Posted by Major View Post
    Why do people insist on formatting their code unconventionally
    if you're talking about my java, I've stopped doing that but just didn't update my settings in eclipse. my php is formatted like normal people do it now.

    I used to do it for my own readability, but I realize it's not that big a deal and I should try to be conventional
    .
    Reply With Quote  
     

  4. #4  
    Banned
    Join Date
    Jul 2014
    Posts
    437
    Thanks given
    200
    Thanks received
    76
    Rep Power
    0
    Good job on this, mate.
    Reply With Quote  
     

  5. #5  
    ???

    funkE's Avatar
    Join Date
    Feb 2008
    Posts
    2,612
    Thanks given
    255
    Thanks received
    989
    Rep Power
    1366
    Quote Originally Posted by Samar_ View Post
    Good job on this, mate.
    thank you
    .
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Jun 2014
    Posts
    15
    Thanks given
    0
    Thanks received
    1
    Rep Power
    11
    Php looks nice and clean, i will install and test this when i have time.
    I have some questions:
    - Does this have "multi voting" checks?
    - Does this require html 5?

    Anyways nice release
    Reply With Quote  
     

  7. #7  
    ???

    funkE's Avatar
    Join Date
    Feb 2008
    Posts
    2,612
    Thanks given
    255
    Thanks received
    989
    Rep Power
    1366
    Quote Originally Posted by naksuasd View Post
    Php looks nice and clean, i will install and test this when i have time.
    I have some questions:
    - Does this have "multi voting" checks?
    - Does this require html 5?

    Anyways nice release
    what do you mean by multi-voting checks?

    and no, this is meant to work an a wide range of browsers with no issue. it's possible to write an html5 theme, but the default is not formatted that way.
    .
    Reply With Quote  
     

  8. #8  
    Donator


    Join Date
    Aug 2010
    Posts
    3,174
    Thanks given
    1,724
    Thanks received
    2,002
    Rep Power
    3837
    Quote Originally Posted by Supah Fly View Post
    what do you mean by multi-voting checks?

    and no, this is meant to work an a wide range of browsers with no issue. it's possible to write an html5 theme, but the default is not formatted that way.
    I believe he's askin if it supports multiple callbacks or not.
    Reply With Quote  
     

  9. #9  
    anInt69

    Max _'s Avatar
    Join Date
    Feb 2012
    Age
    26
    Posts
    1,801
    Thanks given
    426
    Thanks received
    727
    Rep Power
    599
    Quote Originally Posted by Hank View Post
    I believe he's askin if it supports multiple callbacks or not.
    I think he means if it has proxy checks and doesn't allow users being submitted to the db more than once over 12hours.
    Reply With Quote  
     

  10. #10  
    ???

    funkE's Avatar
    Join Date
    Feb 2008
    Posts
    2,612
    Thanks given
    255
    Thanks received
    989
    Rep Power
    1366
    Quote Originally Posted by MaxiiPad View Post
    I think he means if it has proxy checks and doesn't allow users being submitted to the db more than once over 12hours.
    yes, it works like this:

    user clicks button, if they can vote again (time is up) => insert vote into db, but isn't counted as completed, redirect to vote site
    user votes, then it's completed. vote interface checks server and server tells them how long until next vote.
    .
    Reply With Quote  
     

Page 1 of 13 12311 ... LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. An advertiser, server developer and web developer
    By 'Mystic Flow in forum Requests
    Replies: 10
    Last Post: 01-19-2012, 06:14 PM
  2. EQ Hosting [DEDI, Game Servers, Voice, and Web]
    By beastro man in forum Hosting
    Replies: 2
    Last Post: 12-19-2011, 07:50 AM
  3. Need server and web coder
    By Kissy in forum Requests
    Replies: 0
    Last Post: 12-06-2011, 03:00 PM
  4. Replies: 2
    Last Post: 08-15-2011, 03:11 AM
  5. Replies: 12
    Last Post: 02-16-2010, 05:01 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •