Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85
cant use tibia api (error: Client.getPlayer(), cant work with anything)
Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: cant use tibia api (error: Client.getPlayer(), cant work with anything)

  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    16

    cant use tibia api (error: Client.getPlayer(), cant work with anything)

    hello.

    well, this time after months without trying .net, i decided to work it again. So, when i import tibia and tibia.objects. Works fine, but when trying to use an function for example:

    Dim player As Objects.Player = Client.GetPlayer()
    player.OutfitType = Tibia.Constants.OutfitType.BeggarMale
    player.Addon = Tibia.Constants.OutfitAddon.Both

    Doesnt work, it marks Client.getPlayer(). Wont work with any function on the Code Samples, only using the client.choosebox works good.

    If any has happend this before, could help me out ?

    thanks in advance.

  2. #2

    cant use tibia api (error: Client.getPlayer(), cant work with anything)

    Code:
    Imports Tibia
    Imports Tibia.Objects
    Public Class Form1
    Private client As Tibia.Objects.Client
    
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            client = Tibia.Util.ClientChooser.ShowBox()
            If (client Is Nothing) Then
                Application.Exit()
            End If
    End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
                Dim player As Player = client.GetPlayer()
                player.OutfitType = Tibia.Constants.OutfitType.JesterMale
       End Sub
    End class

    Works for me tibia8.5 ) gl.

  3. #3
    Administrator
    Join Date
    Mar 2007
    Posts
    1,723

    cant use tibia api (error: Client.getPlayer(), cant work with anything)

    You have to make a client object.
    Code:
    Dim client As Objects.Client = Util.ClientChooser.ShowBox()
    ...
    Dim player As Objects.Player = client.GetPlayer()
    EDIT- jujruer beat me lol.

  4. #4
    Junior Member
    Join Date
    Jul 2009
    Posts
    16

    cant use tibia api (error: Client.getPlayer(), cant work with anything)

    how nice u both replied fast xD only 1 minute difference Jo3

    well it worked, but now, when trying to do levelspy or outfit changing doesnt work.

    Client.Map.NameSpyOn()
    Client.Map.LevelSpyOn(-1)

    Dim player As Player = client.getPlayer()
    player.OutfitType = Tibia.Constants.OutfitType.BeggarMale
    player.Addon = Tibia.Constants.OutfitAddon.Both

    doesnt apply any to the client.

  5. #5

    cant use tibia api (error: Client.getPlayer(), cant work with anything)

    Code:
     Dim map As New Map(client)
            map.LevelSpyOn(-1)
            map.NameSpyOn()
            map.FullLightOn()

  6. #6
    Junior Member
    Join Date
    Jul 2009
    Posts
    16

    cant use tibia api (error: Client.getPlayer(), cant work with anything)

    stills doin anything.

    just an example of me testing tibiaAPI;

    Imports Tibia
    Imports Tibia.Objects
    Imports Tibia.Objects.Player
    Imports Tibia.Util

    Public Class Form1
    Private client As Tibia.Objects.Client

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim client As Client = ClientChooser.ShowBox()
    If client Is Nothing Then
    MsgBox("No active client.")
    Application.[Exit]()
    End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Dim map As New Map(client)
    map.LevelSpyOn(-1)
    map.NameSpyOn()
    map.FullLightOn()

    End Sub

  7. #7

    cant use tibia api (error: Client.getPlayer(), cant work with anything)

    Code:
    Imports Tibia
    Imports Tibia.Objects
    Public Class Form1
        Private client As Tibia.Objects.Client
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim map As New Map(Client)
            map.LevelSpyOn(-1)
            map.NameSpyOn()
            map.FullLightOn()
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            client = Tibia.Util.ClientChooser.ShowBox()
            If (client Is Nothing) Then
                Application.Exit()
            End If
        End Sub
    End Class


    copy and paste all work.

  8. #8
    Junior Member
    Join Date
    Jul 2009
    Posts
    16

    cant use tibia api (error: Client.getPlayer(), cant work with anything)

    thank you

    but now problem, while changing player outfit.

    Imports Tibia
    Imports Tibia.Objects
    Public Class Form1
    Private client As Tibia.Objects.Client
    Private player As Tibia.Objects.Player

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    player.OutfitType.Banshee()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    client = Tibia.Util.ClientChooser.ShowBox()
    If (client Is Nothing) Then
    Application.Exit()
    End If
    End Sub
    End Class

  9. #9

    cant use tibia api (error: Client.getPlayer(), cant work with anything)

    Make one combobox
    put all outfit you want
    example: Norseman,Knight,Druid

    put in button


    Code:
    if combobox1.text = "Norseman" then
    player.OutfitType = Tibia.Constants.OutfitType.NorsemanMale
    player.Addon = Constants.OutfitAddon.Both
    End if
    if combobox1.text = "Druid" then
    player.OutfitType = Tibia.Constants.OutfitType.DruidMale
    player.Addon = Constants.OutfitAddon.Both
    End if
    if combobox1.text = "Knight" then
    player.OutfitType = Tibia.Constants.OutfitType.KnightMale
    player.Addon = Constants.OutfitAddon.Both
    End if

  10. #10

    cant use tibia api (error: Client.getPlayer(), cant work with anything)

    gattaca,

    Two issues I see with your code:

    The first is that in order to do anything with an object you need an instance of it. That is why you need the client chooser to get a client object for you.

    The second is that you need to make sure your variables are instantiated correctly. In your last example, you only declare a player object; it never has a value. You can either cache the object by setting it when you start (in form.load put player = client.GetPlayer()) or you can get it every time you click the button (client.GetPlayer() instead of player in your button click event handler).

    I hope this better explains the problem than just pasting working code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •