Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Premium Players!
#1
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 Wink

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!
Reply
#2
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.
Reply
#3
Oh I really didnt notice that >.<
lol thx for the notice I'll change it now
Reply
#4
People donate to mirage games, but adding a premium features is poor.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#5
You have more scanlines than a 60's television.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)