PVJsquad Posted April 14, 2012 Author Share Posted April 14, 2012 **INTRO** :ohh no! I get a weird code, is it useful? That's why I made ​​the serial code to get a secret item.>! ![](http://www.freemmorpgmaker.com/files/imagehost/pics/aec57bac9c6bc6799b03c24ac92ddd3f.PNG)![](http://www.freemmorpgmaker.com/files/imagehost/pics/b17c40cbd5670c4bcba732260ce7f804.PNG) **What i Editing or adding?*** **Client** : modCode, modConstants, modEnumurations, modHandledata, modInput, frmMain, frmSerial* **Server** : modCode, modConstants, modDatabase, modEnumurations, modGeneral, modHandledata, modPlayer**Difficulty** **:** Medium**Date Fixed** : 20/02/2013**Extra Files** : [http://www.mediafire…cq0up4m43s3i4t9](http://www.mediafire.com/?cq0up4m43s3i4t9)**Recomended** : Start Over Fresh**Engine** : EO 2.0, EO 3.0, EA**Notes** : serial code will be removed when it is used**Thanks to** : [Kemerd](http://www.eclipseorigins.com/community/index.php?/user/53239-kemerd/) , [DarkDino](http://www.eclipseorigins.com/community/index.php?/user/48122-darkdino/) **>! Try EA + Serial System *not recommeded>! [http://www.eclipseorigins.com/community/index.php?/topic/125864-eo-2030-serial-number-redeem-item-or-etc-fixed/?p=905554](http://www.eclipseorigins.com/community/index.php?/topic/125864-eo-2030-serial-number-redeem-item-or-etc-fixed/?p=905554)The system has been fixed at 07/09/2014 so don't use other fixed in this thread**SERVER SIDE**add the **modCode.bas** to your projectOpen **modCode** in **Public Type SerialRec** replace```Name As String * NAME_LENGTH```to```Name As String * SERIAL_LENGTH```Open **modConstant** add in the bottom```Public Const SERIAL_LENGTH As Byte = 10 ' Change this value to max length you like in your codes```Open **modDatabase** add in the bottom```' serialSub SaveSerialNumbers(ByVal i As Long)For i = 1 To MAX_SERIAL_NUMBERCall SaveSerialNumber(i)NextEnd SubSub SaveSerialNumber(ByVal SerialNum As Long)Dim filename As StringDim F As Longfilename = App.path & "\data\serial\" & SerialNum & ".dat"F = FreeFileOpen filename For Binary As #FPut #F, , Serial(SerialNum)Close #FEnd SubSub LoadSerialNumbers()Dim filename As StringDim i As LongDim F As LongDim sLen As LongCall CheckSerialNumberFor i = 1 To MAX_SERIAL_NUMBERfilename = App.path & "\data\serial\" & i & ".dat"F = FreeFileOpen filename For Binary As #FGet #F, , Serial(i)Close #FNextEnd SubSub CheckSerialNumber()Dim i As LongFor i = 1 To MAX_SERIAL_NUMBERIf Not FileExist("\Data\serial\" & i & ".dat") ThenCall SaveSerialNumbers(i)End IfNextEnd SubSub ClearSerialNumbers()Dim i As LongFor i = 1 To MAX_SERIAL_NUMBERCall ClearSerialNumber(i)NextEnd SubSub ClearSerialNumber(ByVal index As Long)Call ZeroMemory(ByVal VarPtr(Serial(index)), LenB(Serial(index)))Serial(index).Name = vbNullString'ReDim Serial(index)End Sub```Open **modEnumurations** add above **SMSG_COUNT**```'serialSSerialEditorSUpdateSerial```add above **CMSG_COUNT**```'SerialCSaveSerialCRequestSerialCRequestEditSerialCSerialGift```Open **modGeneral** in **InitServer()**below```ChkDir App.path & "\Data\", "spells"```add```ChkDir App.path & "\Data\", "serial"```find```Call SetStatus("Clearing spells...")Call ClearSpells```add below it```Call SetStatus("Clearing database...")Call ClearSerialNumbers```find```Call SetStatus("Loading spells...")Call LoadSpells```add below it```Call SetStatus("Loading database...")Call LoadSerialNumbers```Open **modHandledata** in **InitMessage()**add```'SerialHandleDataSub(CSaveSerial) = GetAddress(AddressOf HandleSaveSerial)HandleDataSub(CRequestSerial) = GetAddress(AddressOf HandleRequestSerial)HandleDataSub(CRequestEditSerial) = GetAddress(AddressOf HandleEditSerial)HandleDataSub(CSerialGift) = GetAddress(AddressOf HandleSerialGift)```and add the code in the bottom of module```' SerialSub HandleEditSerial(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim buffer As clsBuffer' Prevent hackingIf GetPlayerAccess(index) < ADMIN_DEVELOPER ThenExit SubEnd IfSet buffer = New clsBufferbuffer.WriteLong SSerialEditorSendDataTo index, buffer.ToArray()Set buffer = NothingEnd SubSub HandleRequestSerial(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)SendSerial indexEnd SubPrivate Sub HandleSaveSerial(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim SerialNum As LongDim buffer As clsBufferDim SerialSize As LongDim SerialData() As Byte' Prevent hackingIf GetPlayerAccess(index) < ADMIN_DEVELOPER ThenExit SubEnd IfSet buffer = New clsBufferbuffer.WriteBytes Data()SerialNum = buffer.ReadLong' Prevent hackingIf SerialNum < 0 Or SerialNum > MAX_SERIAL_NUMBER ThenExit SubEnd IfSerialSize = LenB(Serial(SerialNum))ReDim SerialData(SerialSize - 1)SerialData = buffer.ReadBytes(SerialSize)CopyMemory ByVal VarPtr(Serial(SerialNum)), ByVal VarPtr(SerialData(0)), SerialSize' Save itCall SendUpdateSerialToAll(SerialNum)Call SaveSerialNumber(SerialNum)'Call AddLog(GetPlayerName(index) & " saved Serial Code #" & SerialNum & ".", ADMIN_LOG)End SubPublic Sub HandleSerialGift(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim buffer As clsBufferDim Item As Long, Value As LongSet buffer = New clsBufferbuffer.WriteBytes Data()Item = buffer.ReadLongValue = buffer.ReadLongGivePlayerItems index, Item, ValuePlayerMsg index, "Kamu Mendapatkan Item Dari serial code cek Inventori mu!", YellowEnd Sub```**Notes : If You Use EO 2.0 use that**repalce **HandleSerialGift** with this```Public Sub HandleSerialGift(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim buffer As clsBufferDim Item As Long, Value As LongSet buffer = New clsBufferbuffer.WriteBytes Data()Item = buffer.ReadLongValue = buffer.ReadLongGiveInvItem index, Item, ValuePlayerMsg index, "Kamu Mendapatkan Item Dari serial code cek Inventori mu!", YellowEnd Sub```Open **modPlayer**below```Call SendSpells(index)```add```Call SendSerial(index)```**CLIENT SIDE**add **frmEditor_Serial.frm** and **modCode.bas** to your projectOpen **modConstants** find```Public Const EDITOR_ANIMATION As Byte = 6```add below it```Public Const EDITOR_SERIAL_NUMBER As Byte = 7 'or next number```add this code in bottom **modConstant**```Public Const SERIAL_LENGTH As Byte = 10 ' Change this value to max length you like in your codes```in **modEnumurations** add```'serialSSerialEditorSUpdateSerial```add too```'SerialCSaveSerialCRequestSerialCRequestEditSerialCSerialGift```Open **modHandledata** in **InitMessage()**add```'SerialHandleDataSub(SSerialEditor) = GetAddress(AddressOf HandleSerialEditor)HandleDataSub(SUpdateSerial) = GetAddress(AddressOf HandleUpdateSerial)```add in the bottom module```' serialPrivate Sub HandleSerialEditor()Dim i As LongWith frmEditor_SerialEditor = EDITOR_SERIAL_NUMBER.lstIndex.Clear' Add the namesFor i = 1 To MAX_SERIAL_NUMBER.lstIndex.AddItem i & ": " & Trim$(Serial(i).Name)Next.Show.lstIndex.ListIndex = 0SerialEditorInitEnd WithEnd SubPrivate Sub HandleUpdateSerial(ByVal Index As Long, ByRef data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim serialNum As LongDim buffer As clsBufferDim serialSize As LongDim serialData() As Byte' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo errorhandlerSet buffer = New clsBufferbuffer.WriteBytes data()serialNum = buffer.ReadLongserialSize = LenB(Serial(serialNum))ReDim serialData(serialSize - 1)serialData = buffer.ReadBytes(serialSize)ClearSerial serialNumCopyMemory ByVal VarPtr(Serial(serialNum)), ByVal VarPtr(serialData(0)), serialSizeSet buffer = Nothing' Error handlerExit Suberrorhandler:HandleError "HandleUpdateserials", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd Sub```Open **modInput** find```Case "/help"```add above it```Case "/editserial"If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then GoTo ContinueSendRequestSerialSendRequestEditSerialCase "/redeem"frmmain.picClaim.visible = not picClaim.visible```**CLIENT WORK**add picturebox, textbox and command button name it **picClaim,** **txtCode** and **cmdClaim**make like this![](http://www.freemmorpgmaker.com/files/imagehost/pics/aec57bac9c6bc6799b03c24ac92ddd3f.PNG)Set **picClaim** visible to **False**Double Click the **cmdClaim** and Add this```Dim a As LongIf txtCode.Text = vbNullString ThentxtCode.Text = "Not Valid Code!"ElseFor a = 1 To MAX_SERIAL_NUMBERIf txtCode.Text = Serial(a).Name ThenCall SendSerialGift(MyIndex, Serial(a).Item, Serial(a).ItemValue)Call ClearSerial(a)Call SendSaveSerial(a)txtCode.Text = "Item Send to your Inv..."picClaim.visible = FalseExit SubEnd IfNexttxtCode.Text = "Not Valid Code!"picClaim.Visible = FalseEnd If```Go to **frmSerial** and click **txtName**![](http://i58.servimg.com/u/f58/18/38/65/59/val210.png)Change the MAX LENGTH to Public Const SERIAL_LENGTH As Byte = **10 **<- to your VALUE in SERIAL_LENGTH![](http://i58.servimg.com/u/f58/18/38/65/59/val110.png)**WELL DONE**** Link to comment Share on other sites More sharing options...
fernz123 Posted April 14, 2012 Share Posted April 14, 2012 Thanks, I could use this for events in-game. Link to comment Share on other sites More sharing options...
Zopto Posted April 14, 2012 Share Posted April 14, 2012 some litl bugs..but fix able! Link to comment Share on other sites More sharing options...
PVJsquad Posted April 15, 2012 Author Share Posted April 15, 2012 You're welcome Guy's please if you have Bug's report me Link to comment Share on other sites More sharing options...
Killa_ Posted April 15, 2012 Share Posted April 15, 2012 Nah ive made a topic with a question on how to make the same system..Thanks for the answer :D Link to comment Share on other sites More sharing options...
Zopto Posted April 15, 2012 Share Posted April 15, 2012 @Killa_:> Nah ive made a topic with a question on how to make the same system..Thanks for the answer :Dwhat are you talking about? o.o what answer Link to comment Share on other sites More sharing options...
DshWinchester Posted April 15, 2012 Share Posted April 15, 2012 this system does what? .-. Link to comment Share on other sites More sharing options...
PVJsquad Posted April 15, 2012 Author Share Posted April 15, 2012 to send an item by using the text to send to the inventory,with Sistem Text Editor Link to comment Share on other sites More sharing options...
Domino_ Posted April 15, 2012 Share Posted April 15, 2012 >! Private Sub cmdClaim_Click()Dim a As LongDim n As String>! For a = 1 To MAX_SERIAL_NUMBER 'or what ever you called it>! If txtClaim.text = Serial(a).Name Then SendSpawnItem Serial(a).Item, Serial(a).ItemValue CheckMapGetItem Call ClearSerial(a) If Serial_Changed(a) Then '( what if?, dont need if I think… ) Call SendSavedoor(a) End If lblClaimStatus.Caption = "Status: [Success] Item Successfully Delivered." Exit Sub End If>! Next>! lblClaimStatus.Caption = "Status: [Failed] code is invalid or already in use."End Sub o.ODont need to be SendSaveSerial ?edit: Your missing smtn… ( Serial_Changed ) Link to comment Share on other sites More sharing options...
Justn Posted April 15, 2012 Share Posted April 15, 2012 @Zopto:> works grate tnx..^^I don't think u even added it cause I tried to test and got same error as domino Link to comment Share on other sites More sharing options...
Domino_ Posted April 15, 2012 Share Posted April 15, 2012 @Justn:> I don't think u even added it cause I tried to test and got same error as dominoMaybe he added and just run server without full compile so bugging his work..p.s. ill try to fix this tomorrow if this wount be fixed, g2g to sleep xD Link to comment Share on other sites More sharing options...
Zopto Posted April 15, 2012 Share Posted April 15, 2012 . Link to comment Share on other sites More sharing options...
Wortel Angels Posted April 16, 2012 Share Posted April 16, 2012 Serial_Changed–---------------Sub or function not defined... Link to comment Share on other sites More sharing options...
Domino_ Posted April 16, 2012 Share Posted April 16, 2012 @Zopto:> works grate tnx..^^Why didn you told us about bug that there is mistakes in code then? Because he answered you.@GoldSide:> You're welcome Guy's please if you have Bug's report meNeed to explain what means "bug" ? :D Link to comment Share on other sites More sharing options...
PVJsquad Posted April 17, 2012 Author Share Posted April 17, 2012 @Mortal:> Serial_Changed> –---------------> Sub or function not defined...**Client Side**Open **modGlobals**find :```Public Shop_Changed(1 To MAX_SHOPS) As Boolean```add this below it```Public Serial_Changed(1 To MAX_SERIAL_NUMBER) As Boolean```@Domino_:> Need to explain what means "bug" ? :DOther Word For ERROR :D**FIX System*** * ***Client Side**Open **frmMain** double click **cmdClaim**find :```If Serial_Changed(a) Then Call SendSavedoor(a) End If```replace with```Call SendSaveSerial(a)```Open **modGlobals**find :```Public Shop_Changed(1 To MAX_SHOPS) As Boolean```add this below it```Public Serial_Changed(1 To MAX_SERIAL_NUMBER) As Boolean```Thank To **Domino_*** * ***Server Side**open **modHandleData** in **Sub HandleSpawnItem**find :```If GetPlayerAccess(index) < ADMIN_CREATOR Then Exit Sub```Give The comment Line Like This:```'If GetPlayerAccess(index) < ADMIN_CREATOR Then Exit Sub```or delete it if you not need the code***Notes :** the server FIX for the give item to Inventory Not Admin Member Link to comment Share on other sites More sharing options...
Domino_ Posted April 17, 2012 Share Posted April 17, 2012 Thanks for fix, but Where is command to open serial editor in game? xDlike /editserial or smtn.?Ohh sry found, just need to add command. ^^ Link to comment Share on other sites More sharing options...
PVJsquad Posted April 17, 2012 Author Share Posted April 17, 2012 @Domino_:> Thanks for fix, but Where is command to open serial editor in game? xD> like /editserial or smtn.?> Ohh sry found, just need to add command. ^^You are absolutely right, you are very helpful.**Fixed Again**open **frmMain** Look In admin paneladd new **command button**-name it **cmdAClaim**-caption it **Set Code**like this![](http://www.freemmorpgmaker.com/files/imagehost/pics/6f9d438c6a963d7b7dbccb8536ccda40.bmp)double click the commandand add this```Private Sub cmdAClaim_Click()' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then Exit Sub End If SendRequestEditSerial ' Error handler Exit Suberrorhandler: HandleError "cmdAItem_Click", "frmMain", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub``` Link to comment Share on other sites More sharing options...
PVJsquad Posted April 17, 2012 Author Share Posted April 17, 2012 Thanks For you found in my program Bug's Link to comment Share on other sites More sharing options...
Wortel Angels Posted April 17, 2012 Share Posted April 17, 2012 Now it works.. buti must type in1 <–- whith many spaces and then it dissapear from the list when i open the editor and close it and open again its there and the code work again one time... how can i fix thatill use it only for GM's because i got many items and then its better to get the code in than search xDSo whats to fix?Save serial in the list forever O.oDelete the self generated spaces >.< Link to comment Share on other sites More sharing options...
kahnival Posted April 17, 2012 Share Posted April 17, 2012 This is a great idea that I'll probably be implementing into my project!But a quick question/suggestion you may not have thought of…But is there a way to limit it to one use of the code per person so that people don't just spam and farm the items if say the code gave a rare expensive item. And a way to make unique codes for each person?For example Person A gets code for Big Bag of Gold and uses said code and then gives the code to Person B who uses it to get the item as well...That wouldn't be cool :( Link to comment Share on other sites More sharing options...
Domino_ Posted April 18, 2012 Share Posted April 18, 2012 @kahnival:> This is a great idea that I'll probably be implementing into my project!> > But a quick question/suggestion you may not have thought of…But is there a way to limit it to one use of the code per person so that people don't just spam and farm the items if say the code gave a rare expensive item. And a way to make unique codes for each person?> > For example Person A gets code for Big Bag of Gold and uses said code and then gives the code to Person B who uses it to get the item as well...That wouldn't be cool :(I have similar problem when lots of spaces shows up afther opening editor again and all time he says that code is wrong. xD ill reinstall code , maybe i have made a mistake. ;D Link to comment Share on other sites More sharing options...
PVJsquad Posted April 18, 2012 Author Share Posted April 18, 2012 @Mortal:> Now it works.. but> i must type in> 1 <–- whith many spaces and then it dissapear from the list when i open the editor and close it and open again its there and the code work again one time... how can i fix that> ill use it only for GM's because i got many items and then its better to get the code in than search xD> > So whats to fix?> > Save serial in the list forever O.o> Delete the self generated spaces >.<For This Problem I recommendin **SERVER** and **CLIENT**find the code in **modTypes**```Public Type SerialRec Name As String * NAME_LENGTH NamePlayer As String * NAME_LENGTH Item As Long ItemValue As LongEnd Type```delete *** NAME_LENGTH**like this```Public Type SerialRec Name As String NamePlayer As String * NAME_LENGTH Item As Long ItemValue As LongEnd Type```*delete serial folder in server "/data/serial"* * ***you need to know**, this project or the serial code is valid only one time use only, after which the code is deleted in the list and remove …if you do not want to delete it I would suggest removing this codeThese two codes ... in **cmdClaim**```Call ClearSerial (a) Call SendSaveSerial (a) ``` Link to comment Share on other sites More sharing options...
Wortel Angels Posted April 18, 2012 Share Posted April 18, 2012 ~~ill test it~~ :D thanksTested…So now i can use the code more than one time :D First problem clearedbutIf i do it like this ' Call ClearSerial(a)```Private Sub cmdClaim_Click()Dim a As LongDim n As StringFor a = 1 To MAX_SERIAL_NUMBER 'or what ever you called it If txtClaim.text = Serial(a).Name Then SendSpawnItem Serial(a).Item, Serial(a).ItemValue CheckMapGetItem' Call ClearSerial(a) If Serial_Changed(a) Then Call SendSaveSerial(a) End If lblClaimStatus.Caption = "Status: [Erfolg] Item gesendet." Exit Sub End IfNextlblClaimStatus.Caption = "Status: [Fehler] Falscher Code."End Sub```The code is deletet when i open the Serial window again…And when i comment out the Call SendSaveSerial (a)```Private Sub cmdClaim_Click()Dim a As LongDim n As StringFor a = 1 To MAX_SERIAL_NUMBER 'or what ever you called it If txtClaim.text = Serial(a).Name Then SendSpawnItem Serial(a).Item, Serial(a).ItemValue CheckMapGetItem' Call ClearSerial(a) If Serial_Changed(a) Then' Call SendSaveSerial(a) End If lblClaimStatus.Caption = "Status: [Erfolg] Item gesendet." Exit Sub End IfNextlblClaimStatus.Caption = "Status: [Fehler] Falscher Code."End Sub```Or delete it i cant save the serials :D the server stops and i got an message (The server does not work e.c.t e.c.t.) Link to comment Share on other sites More sharing options...
Jumbofile Posted April 19, 2012 Share Posted April 19, 2012 can this have multiple codes? Link to comment Share on other sites More sharing options...
PVJsquad Posted April 19, 2012 Author Share Posted April 19, 2012 if you want to make the code does not delete Serialreplace **cmdClaim** with this codePrivate Sub cmdClaim_Click()```Dim a As LongDim n As StringFor a = 1 To MAX_SERIAL_NUMBER 'or what ever you called it If txtClaim.text = Serial(a).Name Then SendSpawnItem Serial(a).Item, Serial(a).ItemValue CheckMapGetItem lblClaimStatus.Caption = "Status: [Success] Item Successfully Delivered." Exit Sub End IfNextlblClaimStatus.Caption = "Status: [Failed] code is invalid or already in use."End Sub```why you still with this code?```If Serial_Changed(a) Then```delet it Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now