Results 1 to 4 of 4

Thread: Detect String

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Location
    St. Louis
    Posts
    14

    Question Detect String

    Hey this is my 3rd topic I need help on. Some of you know I am making a mod for a game called CSPSP, and so far it's AWESOME. I need help now. In that game there is a bug where when you join the game from a PSP and type something in chat, your message shows up to other people, but not to you. Also, you can't join teams. If you quit the game, you will have to wait, because when you quit, your name is still in the server so you wait ~1 min until server clears up players (bad coding), if you kick that person, they can rejoin without having to wait.
    So: I need to make a command like "!bug", and it kicks the players

    In the text box, when they say bug, it shows up as

    *SPEC* Player1: !bug

    How do I make it so the person can type bug, and the computer detects the string BEFORE the : and AFTER the *SPEC*? This is very difficult for me, since I just learned how to get the string AFTER the command, but now it's a lot more advanced. Please help. Even if you try, I will give you +REP

    I want the player name to be in STRING_HERE

    Code:
    Call SendMessage(hWndTextbox, WM_SETTEXT, 0, "/ban " & STRING_HERE)
    Call PostMessage(hWndTextbox, WM_KEYDOWN, VK_RETURN, 0)
    Sleep (75)

  2. #2

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Location
    St. Louis
    Posts
    14

    Re: Detect String

    Bump?

  3. #3
    Addicted Member Witis's Avatar
    Join Date
    Jan 2011
    Location
    VB Forums Online Freedom Mode: Operational
    Posts
    213

    Re: Detect String

    Here are a couple of different ways of getting the info out of the string, using split is probably the easiest of the two. Output is to the debug window (ctrl + g)

    Code:
    Private Sub Command1_Click()
    Dim s$, EndPosSpec&
    
    s = "*SPEC* Player1: !bug"
    EndPosSpec = InStr(1, s, "*SPEC*") + Len("*SPEC*")
    Debug.Print Mid(s, EndPosSpec, InStr(1, s, ":") - EndPosSpec)
    
    Debug.Print Split(s, (" "))(1)
    End Sub
    All men have an inherent right to life, the right to self determination including freedom from forced or compulsory labour, a right to hold opinions and the freedom of expression, and the right to a fair trial and freedom from torture. Be aware that these rights are universal and inalienable (cannot be given, taken or otherwise transferred or removed) although you do risk losing the aforementioned rights should you fail to uphold them e.g Charles Taylor; United Nations sources: http://www.un.org/en/documents/udhr/, http://www.ohchr.org/EN/Professional...ages/CCPR.aspx. Also Charles I was beheaded on the 30th of January of 1649 for trying to replace parliamentary democracy with an absolute monarchy, the same should happen to Dr Phil and Stephen Fry; source: http://www.vbforums.com/showthread.p...ute-Monarchism.

    The plural of sun is stars you Catholic turkeys.

  4. #4
    Frenzied Member
    Join Date
    Nov 2010
    Posts
    1,470

    Re: Detect String

    what you write means very little to me...

    when you type *spec* do you mean that these characters always appear as in your example or is *spec* a shortcode for some random amount of garbage you wish to ignore

    here to help

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width