Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*---------------------------------------------------------------------------
- Player2's Lottery System for Life
- Install Instructions & Important Notes
- Installation
- 1. Database Setup
- 1a) Creating the Database
- Simply create a new database named 'lottery'.
- Then run the SQL provided 'p2lottery.sql' on that database to create the tables.
- You should have two tables in the lottery database, system & tickets.
- 1b) Adding the database to ExtDB Config file
- In your servers extdb folder there should be a file called 'extdb-conf.ini'
- You will need to open that and add this to it, modify where needed:
- [p2lottery]
- Type = MySQL
- Name = lottery
- Username = <__YOUR DATABASE USERNAME__>
- Password = <__YOUR DATABASE PASSWORD__>
- IP = <__YOUR DATABASE IP__>
- Port = <__YOUR DATABASE PORT__>
- minSessions = 2
- ;maxSessions = 4
- idleTime = 60
- 2. File Structure
- As given the server portion is inside the mission PBO.
- This is not ideal as others can steal the scripts easily.
- Decide where you would like to place the server portion of the code.
- Now create a new folder in your chosen server directory and call it 'p2lottery'.
- Now CUT and paste the 'server' folder included to that location.
- Now copy and paste the entire 'p2lottery' folder into your mission file.
- The server folder should not be inside the mission file.
- Now open the 'config.sqf' for the lottery and modify the path used for 'p2l_serverFolder'
- to your newly selected path that you just copied the 'server' folder to.
- 3. Configuration
- Included is a config.sqf
- You should have just opened it to modify the 'p2l_serverFolder' path in there
- If you would like to modify the path of the p2lottery in the mission, there is an option
- Debugging mode is enabled by default as I assume this will be on a test server before a live one
- This is so you can check to see if any errors are happening while you test
- It also modifies timers a bit to make testing quicker and easier
- There are also options to configure nearly every part of the lottery system
- The default values are NOT optimal for a live server, you MUST change them to your liking.
- There are also advertisement messages included, you can have as many as you like.
- It will not display the same adverts twice, adverts are displayed in chat.
- You will need to place your vendor, I used a random map position.
- 4. SQF Setup
- 4a. Init of the database
- You will need to add our new database to your extDB startup section in your server pbo
- just after you initialize extDB.
- To find where this is, look for this:
- _result = EXTDB format["9:DATABASE:%1",DATABASE_SELECTION];
- Now add these 2 lines below that one:
- "extDB" callExtension "9:DATABASE:p2lottery";
- "extDB" callExtension format["9:ADD:%1:%2","DB_RAW_V2",FETCH_CONST(life_sql_id)];
- Making it look like this:
- _result = EXTDB format["9:DATABASE:%1",DATABASE_SELECTION];
- "extDB" callExtension "9:DATABASE:p2lottery";
- "extDB" callExtension format["9:ADD:%1:%2","DB_RAW_V2",FETCH_CONST(life_sql_id)];
- 4b. Adding the startup line
- Copy and paste this line into your mission files init.sqf at the top of the file
- [] execVM "p2lottery\init.sqf";
- 4c. Replace life cash value
- Find and replace "p2l_cashValue" with your global var for cash
- 5. Notes and Considerations
- You will need to figure out a good balance between ticket price and how often people win
- I'm not sure what kind of payout you are wanting players to get so the prizes can also
- be tweaked to your liking. Having high ticket prices and a longer running lottery with lower
- prize values might see the jackpot soar to the millions provided enough players play.
- In the database the default minimum jackpot is also set to 50,000.
- You might want to change it there aswell as in the config.
- 6. Likely Errors with Installation
- ExtDB ID (life sql id) not set up properly
- Database not set up properly
- ---------------------------------------------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment