Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Boynaar44

Members
  • Posts

    53
  • Joined

  • Last visited

    Never

Posts posted by Boynaar44

  1. Hello guys,

    A fresh version of EO2.0…

    When you run the server, start 3 clients.

    Login with 3 players and remember the one you logged in as last.

    If you walk with any of the other 2 clients(for example the first one you logged in with), only the one you logged in as last can see it moving.

    After 10 seconds, the other client(for example the second one you logged in with), will see it moving.

    Anyone else having this problem?

    I actually think my pc is just too slow for 3 clients, just to make sure I ask here.

    EDIT: The problem seems only be on local connection, on multiple pc's there is no such issue.
  2. I agree with you, I use this new reference because (to be honest) I couldn't let it read the names from charlist.txt(line by line) and store it at the same time into a new array slot.

    I thought Lightning had an external player editor, so I thought I will put my nose inside it and see how he did it. But suprising enough it's unfinished there…

    So then I looked for a new way and that was this "Microsoft Scripting Runtime"
  3. So I made this because of an unofficial request from Erwin.

    It will show you an example of how to loop through all players.

    In this example we will loop through all players and get the average level.

    ALL PLAYERS means, online and offline players.

    It is server side only.

    This tutorial requires you to add the reference "Microsoft Scripting Runtime" to your server project.

    Project -> References… -> check the "Microsoft Scripting Runtime"

    First we need to create a temporarily player type to load the player data we need of each player we loop through.

    We do that by adding the next code inside the modTypes in your server project.

    So search for: ' Public data structures

    And add in the list under it

    ```
    Public TempPlayerUse As PlayerRec
    ```

    After we have done that, we need to create the subs which will actually load the players we loop through into the "TempPlayerUse".

    We do that by adding the next 2 subs into your project, a good place would be at the bottom of your "modDatabase"

    ```

    Sub LoadTempPlayerUse(ByVal Name As String)

    Dim filename As String

    Dim F As Long

    Call ClearTempPlayerUse

    filename = App.path & "\data\accounts\" & Trim(Name)

    F = FreeFile

    Open filename For Binary As #F

    Get #F, , TempPlayerUse

    Close #F

    End Sub

    Sub ClearTempPlayerUse()

    Dim i As Long

    Call ZeroMemory(ByVal VarPtr(TempPlayerUse), LenB(TempPlayerUse))

    TempPlayerUse.Login = vbNullString

    TempPlayerUse.Password = vbNullString

    TempPlayerUse.Name = vbNullString

    TempPlayerUse.Class = 1

    End Sub

    ```

    So you see in the code we just added, before it loads a player, it clears the already loaded player. Thats why we need 2 subs, one to load and another to clear.

    Now we have that, we should make use of it and start looping through the players by reading all the player names inside the charlist.txt.

    Here we will make use of the "Microsoft Scripting Runtime".

    Create a new function called "GetAverageLevel", at the bottom of your "modPlayer" would be a good place for it.

    ```

    Public Function GetAverageLevel()

    ' Here we will create the Microsoft Scripting Runtime object.

    ' We also need to define the charlist.txt path.

    Dim averageLevels as Long

    ' Open the charlist.txt and count how many lines it has.

    ' Save the player names into an array between 0 and the count of lines in charlist.txt

    ' Close the charlist.txt

    ' Loop through the player names array we just created, we load the players and get their levels.

    GetAverageLevel = averageLevels

    End Function

    ```

    To count how many lines the charlist.txt has we need this function.

    Just add it under the unfinished GetAverageLevel function we just created.

    ```

    Private Function getLineCount(ByVal strFilePath As String) As Long

    Open strFilePath For Binary As #1

    Dim strBuff As String: strBuff = Space(LOF(1))

    Get #1, , strBuff

    getLineCount = UBound(Split(strBuff, vbCrLf))

    Close #1

    End Function

    ```

    Now we have that, we will continue working on the GetAverageLevel function.

    Inside the GetAverageLevel function do the following.

    Add under "Here we will create the Microsoft Scripting Runtime object."

    ```

    Dim FSO As New FileSystemObject ' Implement the Microsoft Scripting Runtime to use it

    Dim charlistFile As TextStream ' Here we will open the charlist.txt and since it is a TextStream we can read the lines.

    ```

    Then add under "We also need to define the charlist.txt path."

    ```

    Dim charlistPath As String ' To store the path of the charlist.txt

    ```

    And then we still need some values to use.

    Add under "Dim averageLevels as Long"

    ```

    Dim accountNames() As String ' Account names array

    Dim lineCount As Long ' The count of lines in charlist.txt

    Dim i As Long ' We need this to make a loop.

    ```

    After that we have created the FileSystemObject and dimmed the values we need.

    We can now open the charlist.txt so we can load it into the "accountNames()" array later.

    Add under "Open the charlist.txt and count how many lines it has."

    ```

    charlistPath = App.path & "\data\Accounts\charlist.txt" ' Path

    lineCount = getLineCount(charlistPath) ' Count the lines

    Set charlistFile = FSO.OpenTextFile(charlistPath) ' Open the file

    ReDim accountNames(0 To lineCount) ' Set the array width we are gonna use.

    ```

    Now we have the total lines, we can save the names into the "accountNames()" array.

    Add under "Save the player names into an array between 0 and the count of lines in charlist.txt"

    ```

    Do While Not charlistFile.AtEndOfStream ' As long as we haven't reached the end, do the following.

    accountNames(i) = charlistFile.ReadLine ' Add the current line into the current "accountNames" slot.

    i = i + 1 ' Add 1 to the current slot we are working with.

    Loop

    ```

    Now we are done with the charlist.txt, we can close it.

    Add under "Close the charlist.txt" the following code to close the file.

    ```

    charlistFile.Close ' Close the opened file.

    ```

    The accountNames are loaded, now we can read the levels by loading any of them into the TempPlayerUse which we created earlier.

    We will load them one by one and count the levels and divide at the same time to get the average level.

    Add under "Loop through the player names array we just created, we load the players and get their levels." the following code.

    ```

    For i = 0 To UBound(accountNames) ' Loop from the first to the last array slot.

    Call LoadTempPlayerUse(accountNames(i) & ".bin") ' Load the player into the current array slot.

    If i = 0 Then ' We don't divide the first one

    averageLevels = TempPlayerUse.Level

    Else

    averageLevels = (TempPlayerUse.Level + averageLevels) / 2 ' Calculate the current average.

    End If

    Next

    ```

    That's all.

    Why make the tutorial this way?

    Because in the past there was a time for me I wanted this kind of tutorials.
  4. Ik kwam dit net tegen, ik was een mod aan het testen van minecraft op een multiplayer server.

    Maar het is te groot, mijn internet kan het niet eens laden…

    Ik post gewoon de link, als je het kan zien, dan heb je het gezien ^^

    [http://imageshack.us/a/img140/439/20120504143515.png](http://imageshack.us/a/img140/439/20120504143515.png)
  5. Isn't the Winsock a user control in the components list, not in the references?

    ~~I am not sure this will work but you may try the next,

    1\. Download the mswinsck.ocx somewhere from.

    2\. I don't know if the mswinsck.ocx has a 32bit and 64bit version, if you know it's a 64bit version then place it in SysWOW64, if you don't know then place it in System32.

    3\. Open notepad or any text editor and write the following code, DO NOT FORGET to replace the [Location MSWINSCK.OCX] with the location folder the mswinsck.ocx is placed in.

    ```

    cd [Location MSWINSCK.OCX]

    regsvr32 MSWINSCK.OCX
    ```

    4\. Save the text file as a ".bat" file somewhere.

    5\. Explore to the ".bat" file you created, right-click it and run as admin.~~

    Never mind, since you see the icon, you don't have to do this.
  6. I like it how you talk to yourself ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)

    However you are a good example for some people, some things can't just be explained, you have to find them out on your own.

    So well done ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)
  7. Ben benieuwd naar je progress hedgy ![:)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/smile.png)

    Laat zien wanneer het af is.

    Welke opleiding doe je trouwens?
  8. Ik keek effe op mijn imageshack account om een picture te posten…

    En besloot de aller eerste picture die ik ooit heb geüploadt te posten.

    Dus dit was in 17-04-2010 om 06:37:12 geüploadt.

    >! ![](http://imageshack.us/a/img504/592/erroorrrrrr.png)

    EDIT: Ik weet niet eens meer waarom ik het had geüploadt.
  9. > Any can post in this thread the full tutorial? i don't understand where is the complete code and the work fine code… in this post have 20000 codes (?)... help?

    I posted it [here](http://www.touchofdeathforums.com/community/index.php?/topic/129156-eoevent-system-3-some-bug-fixes/) a while ago, look the last Quote…
  10. This code is nothing, I guess you saved the suffix to the player type? and coded so it changes the value of "name" in the code you posted to PlayerSuffix + name?

    All those spaces might be because you didn't use Trim$ by saving the suffix.

    C++

    I know the basics of C++, so I go for "I would love to learn" ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/tongue.png)
  11. @hardcorex9, there is no difference between "player(index).access = [Access here]" and "SetPlayerAccess(Index, Value)".

    >! Before everything, I was just being sarcasm because you said it's the easiest way. But yeah then you said something wrong.
    >! So that means…
    >! "player(index).level = 1" should actually be changed to "SetPlayerLevel(index, 1)", just to prevent a crash from setting a level to a value of "1"?
    >! No, you forgot something…
    >! If you know for 100% sure that there can't be any crash of setting a player-level to a value of 1, you can just use "player(index).level = 1" and ignore all the pointless things on the function "SetPlayerLevel"…
    >! Here we are talking about a small improvement of performance, where it doesn't actually matter what you use since it doesn't really effect the performance of the program, but still you should use any possibility available to increasse the performance of the program without having any possible issue.
    >! Btw.. Check the source code first before you say: the Sub I suggested to call wraps that call with some checks to prevent crashes.
    >! There can't go anything wrong by using "player(index).access = 4", in some cases it's even better, but in other cases "SetPlayerAccess" might be better.
    >! So what crashes are you actually talking about?
    >! As you see, you can't prove me wrong, because we both are actually talking about the same point.
    >! And remember, it's nice to be important, but it's more important to be nice ^^
  12. Hello guys,

    Some of you may know the game mod DayZ of Arma2:CO, so I thought I would make a topic here.

    So since 3 days I have set up an unofficial DayZ server to play on with friends.

    The server is online from 08:00am to 11:00pm in GMT, what is from 08:00 to 23:00 in 24h format.

    The server is password protected, since I don't want anyone to come on it.

    I also disabled the BattleEye from the server to allow cheats, but you are not allowed to cheat without asking me first.

    Your only enemy on the game are the zombies, you are not allowed to kill other players and that's the main reason why I made an unofficial DayZ server.

    So what I told you up there, I can call "rules" pretty much. I don't like rules, but yeah they can be of good use.

    For the people who don't know what is an unofficial DayZ server, it's a DayZ server wich is not connected with the hive and wich doesn't have the minimum required configurations decided by the makers of DayZ. Since the unofficial servers are not connected to hive, they don't have shared character data with other servers, it saves the character data on a mysql database on the server.

    So after a long story, I come near the end.

    If you would like to join me playing, you should send me a pm and I will think about sending you the server password.
  13. Replace

    ```

    If Item(GetPlayerInvItemNum(Index, invNum)).BindType = 1 Or Item(GetPlayerInvItemNum(Index, invNum)).BindType = 2 Then Exit Sub

    ```

    under

    ```

    If GetPlayerInvItemNum(Index, invNum) < 1 Or GetPlayerInvItemNum(Index, invNum) > MAX_ITEMS Then Exit Sub

    ```

    That will fix it. And please next time use the code function for codes, not the quote function.

    ![](http://img401.imageshack.us/img401/9445/codefunction.jpg)
×
×
  • Create New...