| Mirage Source http://miragesource.net/forums/ |
|
| Premium Players! http://miragesource.net/forums/viewtopic.php?f=210&t=3065 |
Page 1 of 1 |
| Author: | jsventor [ Tue Nov 20, 2007 11:40 pm ] |
| Post subject: | Premium Players! |
Ok, basically, I'm going to post how to add a premium feature to your game, it won't be to advanced, but enough to make someone premium and someone not premium, no tiles or items, just to get you started! Heres how it works, if someones premium then in their ini file Code: Premium= 1 if not then its 0 you can modify it for alot o good GAME Features! RATED: 1/5 Very easy, copy and paste! Ok first open up the server, thats where we are starting 1. In ModTypes add these Public Consts Code: ' Premium Constants Public Const IS_PREMIUM = 1 Public Const IS_NOT_PREMIUM = 0 2.Then in the player rec add this Code: Premium As Byte 3. In subClearChar add Code: Player(Index).Char(CharNum).Premium = 0 4. At the bottom of ModTypes add Code: Function GetPlayerPremium(ByVal Index As Long) As Long GetPlayerPremium = Player(Index).Char(Player(Index).CharNum).Premium End Function Sub SetPlayerPremium(ByVal Index As Long, ByVal Premium As Long) Player(Index).Char(Player(Index).CharNum).Premium = Premium End Sub 5. Find "Stats request packet" replace with Code: ' :::::::::::::::::::::::::: ' :: Stats request packet :: ' :::::::::::::::::::::::::: If LCase(Parse(0)) = "getstats" Then Call PlayerMsg(Index, "-=- Stats for " & GetPlayerName(Index) & " -=-", White) Call PlayerMsg(Index, "Level: " & GetPlayerLevel(Index) & " Exp: " & GetPlayerExp(Index) & "/" & GetPlayerNextLevel(Index), White) Call PlayerMsg(Index, "HP: " & GetPlayerHP(Index) & "/" & GetPlayerMaxHP(Index) & " MP: " & GetPlayerMP(Index) & "/" & GetPlayerMaxMP(Index) & " SP: " & GetPlayerSP(Index) & "/" & GetPlayerMaxSP(Index), White) Call PlayerMsg(Index, "STR: " & GetPlayerSTR(Index) & " DEF: " & GetPlayerDEF(Index) & " MAGI: " & GetPlayerMAGI(Index) & " SPEED: " & GetPlayerSPEED(Index), White) n = Int(GetPlayerSTR(Index) / 2) + Int(GetPlayerLevel(Index) / 2) i = Int(GetPlayerDEF(Index) / 2) + Int(GetPlayerLevel(Index) / 2) If n > 100 Then n = 100 If i > 100 Then i = 100 Call PlayerMsg(Index, "Critical Hit Chance: " & n & "%, Block Chance: " & i & "%", White) Call PlayerMsg(Index, "Premium: " & GetPlayerPremium(Index), White) Exit Sub End If 6. In subSavePlayer add Code: Call PutVar(FileName, "CHAR" & i, "Premium", STR(Player(Index).Char(i).Premium)) 7. in subLoadPlayer add Code: Player(Index).Char(i).Premium = Val(GetVar(FileName, "CHAR" & i, "Premium")) Server Side Complete! Time for the client(do the same for the Dev_Client!) 1. In ModTypes add these Public Consts Code: ' Premium Constants Public Const IS_PREMIUM = 1 Public Const IS_NOT_PREMIUM = 0 2.Then in the player rec add this Code: Premium As Byte 3. At the bottom of Mod Types add Code: Function GetPlayerPremium(ByVal Index As Long) As Long GetPlayerPremium = Player(Index).Premium End Function Sub SetPlayerPremium(ByVal Index As Long, ByVal Premium As Long) Player(Index).Premium = Premium End Sub And your done! You can use the functions "GetPlayerPremium" and "SetPlayerPremium" to make this tut more fun to use, make premium defined tiles, Premium defined weapons etc. Even add it for sadscript support! I hope you enjoyed my tut! |
|
| Author: | Matt [ Tue Nov 20, 2007 11:43 pm ] |
| Post subject: | Re: Premium Players! |
Quote: ' Premium Constants Public Const IS_PREMIUM = 0 Public Const IS_NOT_PREMIUM = 1 That's backwards. Also, you should save this to the account, so it affects all characters on the account. Not just one character. Or make it exchangeable between the characters. |
|
| Author: | jsventor [ Tue Nov 20, 2007 11:45 pm ] |
| Post subject: | Re: Premium Players! |
Oh I really didnt notice that >.< lol thx for the notice I'll change it now |
|
| Author: | Robin [ Wed Nov 21, 2007 5:04 pm ] |
| Post subject: | Re: Premium Players! |
People donate to mirage games, but adding a premium features is poor. |
|
| Author: | Rezeyu [ Wed Nov 21, 2007 5:37 pm ] |
| Post subject: | Re: Premium Players! |
You have more scanlines than a 60's television. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|