Jump to content

A better way to write the following script


Recommended Posts

Hello Everyone,

There is way to many Functions and While loops, so is there a better way I can write this? I have a working script so far, but for me it's too messy. If I was to include all the While loops this would be a really big script, so outputted for redundancy.

Also is there a way I can turn playername into a variable and just output whatever name I have copied in the clipboard as the variable playername?

Opt("SendKeyDelay", 20)
Opt("SendKeyDownDelay", 3)

#include <IsPressed.au3>
$dll = DllOpen("user32.dll")

While 1
    If __IsPressed('13', $dll) Then
        FoulLang()
    EndIf
    Sleep(10)
WEnd

;Warnings Below
Func AbuseLang()
    Send('y@ playername, Please watch your language on our servers. Thanks.', 1)
EndFunc   ;==>AbuseLang

Func FoulLang()
    Send('y@ playername, Please keep inappropiate content off of our servers. Thank you.', 1)
EndFunc   ;==>FoulLang

Func BadSpray()
    Send('y@ playername, Please do not spray your spray again in our servers. Thank you.', 1)
EndFunc   ;==>BadSpray

Func BadName()
    Send('y@ playername, Please change your name, as <these words> are not allowed on our servers. Thank you.', 1)
EndFunc   ;==>BadName

;Kicks Below
Func AbuseKick()
    Send('sm_kick playername "Repeated use of foul/abusive language"', 1)
EndFunc   ;==>AbuseKick

Func FoulKick()
    Send('sm_kick playername "Repeated use of inappropiate language"', 1)
EndFunc   ;==>FoulKick

Func SprayKick()
    Send('sm_kick <playername> "Inappropiate spray"', 1)
EndFunc   ;==>SprayKick

Func NameKick()
    Send('sm_kick <playername> "Inappropiate name"', 1)
EndFunc   ;==>NameKick


Func OnAutoItExit()
    DllClose($dll)
EndFunc   ;==>OnAutoItExit

I am trying to make a script to make it a little easier to administrate on my clans servers. All help will be greatly appreciated. Thank you!

Link to comment
Share on other sites

  • Replies 65
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Maybe this? Can you paste in your game?

Opt("SendKeyDelay", 20)
Opt("SendKeyDownDelay", 3)
;Please uncomment   #Include <Misc.au3> if you use #include <IsPressed.au3>
;~ #include <IsPressed.au3>
#Include <Misc.au3>
$dll = DllOpen("user32.dll")
$PlayerName = ClipGet()
While 1
    If _IsPressed('13', $dll) Then
        FoulLang()
    EndIf
    Sleep(10)
WEnd

;Warnings Below
Func AbuseLang()
    Send('y@ '&$PlayerName&', Please watch your language on our servers. Thanks.', 1)
EndFunc;==>AbuseLang

Func FoulLang()
    Send('y@ '&$PlayerName&', Please keep inappropiate content off of our servers. Thank you.', 1)
EndFunc;==>FoulLang

Func BadSpray()
    Send('y@ '&$PlayerName&', Please do not spray your spray again in our servers. Thank you.', 1)
EndFunc;==>BadSpray

Func BadName()
    Send('y@ '&$PlayerName&', Please change your name, as <these words> are not allowed on our servers. Thank you.', 1)
EndFunc;==>BadName

;Kicks Below
Func AbuseKick()
    Send('sm_kick '&$PlayerName&' "Repeated use of foul/abusive language"', 1)
EndFunc;==>AbuseKick

Func FoulKick()
    Send('sm_kick '&$PlayerName&' "Repeated use of inappropiate language"', 1)
EndFunc;==>FoulKick

Func SprayKick()
    Send('sm_kick <'&$PlayerName&'> "Inappropiate spray"', 1)
EndFunc;==>SprayKick

Func NameKick()
    Send('sm_kick <'&$PlayerName&'> "Inappropiate name"', 1)
EndFunc;==>NameKick


Func OnAutoItExit()
    DllClose($dll)
EndFunc;==>OnAutoItExit
Edited by au3scr
Link to comment
Share on other sites

Maybe this? Can you paste in your game?

Opt("SendKeyDelay", 20)
 Opt("SendKeyDownDelay", 3)
;Please uncomment   #Include <Misc.au3> if you use #include <IsPressed.au3>
;~ #include <IsPressed.au3>
 #Include <Misc.au3>
 $dll = DllOpen("user32.dll")
 $PlayerName = ClipGet()
 While 1
     If _IsPressed('13', $dll) Then
         FoulLang()
     EndIf
     Sleep(10)
 WEnd
 
;Warnings Below
 Func AbuseLang()
     Send('y@ '&$PlayerName&', Please watch your language on our servers. Thanks.', 1)
 EndFunc;==>AbuseLang
 
 Func FoulLang()
     Send('y@ '&$PlayerName&', Please keep inappropiate content off of our servers. Thank you.', 1)
 EndFunc;==>FoulLang
 
 Func BadSpray()
     Send('y@ '&$PlayerName&', Please do not spray your spray again in our servers. Thank you.', 1)
 EndFunc;==>BadSpray
 
 Func BadName()
     Send('y@ '&$PlayerName&', Please change your name, as <these words> are not allowed on our servers. Thank you.', 1)
 EndFunc;==>BadName
 
;Kicks Below
 Func AbuseKick()
     Send('sm_kick '&$PlayerName&' "Repeated use of foul/abusive language"', 1)
 EndFunc;==>AbuseKick
 
 Func FoulKick()
     Send('sm_kick '&$PlayerName&' "Repeated use of inappropiate language"', 1)
 EndFunc;==>FoulKick
 
 Func SprayKick()
     Send('sm_kick <'&$PlayerName&'> "Inappropiate spray"', 1)
 EndFunc;==>SprayKick
 
 Func NameKick()
     Send('sm_kick <'&$PlayerName&'> "Inappropiate name"', 1)
 EndFunc;==>NameKick
 
 
 Func OnAutoItExit()
     DllClose($dll)
 EndFunc;==>OnAutoItExit
I believe the game is Counter-Strike Source. And yes, you can paste into that game.

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

It works great with a few minor modification! I didn't know the IsPressed function was moved, so that's what I get for reading old forum posts. Thank you au3scr.

I have another question. Am I going to need 8 While/If loops to bind 8 keys for the functions, or is there a more efficient way? Ultimately, I would like to have all the functions binded to keys.

Opt("SendKeyDelay", 20)
Opt("SendKeyDownDelay", 3)
;Please uncomment   #Include <Misc.au3> if you use #include <IsPressed.au3>
;~ #include <IsPressed.au3>
#Include <Misc.au3>
$dll = DllOpen("user32.dll")
ClipPut("")

While 1
    If _IsPressed('13', $dll) Then
        $PlayerName = ClipGet()
        FoulLang()
    EndIf
    Sleep(10)
WEnd

;Warnings Below
Func AbuseLang()
    Send('y@ '&$PlayerName&', Please watch your language on our servers. Thanks.', 1)
EndFunc;==>AbuseLang

Func FoulLang()
    Send('y@ '&$PlayerName&', Please keep inappropiate content off of our servers. Thank you.', 1)
EndFunc;==>FoulLang

Func BadSpray()
    Send('y@ '&$PlayerName&', Please do not spray your spray again in our servers. Thank you.', 1)
EndFunc;==>BadSpray

Func BadName()
    Send('y@ '&$PlayerName&', Please change your name, as <these words> are not allowed on our servers. Thank you.', 1)
EndFunc;==>BadName

;Kicks Below
Func AbuseKick()
    Send('sm_kick '&$PlayerName&' "Repeated use of foul/abusive language"', 1)
EndFunc;==>AbuseKick

Func FoulKick()
    Send('sm_kick '&$PlayerName&' "Repeated use of inappropiate language"', 1)
EndFunc;==>FoulKick

Func SprayKick()
    Send('sm_kick <'&$PlayerName&'> "Inappropiate spray"', 1)
EndFunc;==>SprayKick

Func NameKick()
    Send('sm_kick <'&$PlayerName&'> "Inappropiate name"', 1)
EndFunc;==>NameKick


Func OnAutoItExit()
    DllClose($dll)
EndFunc;==>OnAutoItExit
Link to comment
Share on other sites

a little modification to make it perfect

Opt("SendKeyDelay", 20)
Opt("SendKeyDownDelay", 3)

;~ #include <IsPressed.au3>
#Include <Misc.au3>
$dll = DllOpen("user32.dll")
$PlayerName = ClipGet()
$data = ""
While 1
    If _IsPressed('4c', $dll) Then
        clipsave()
        FoulLang()
        clipload()
    EndIf
    Sleep(10)
WEnd

;Warnings Below
Func AbuseLang()
    ClipPut('y@ '&$PlayerName&', Please watch your language on our servers. Thanks.')
    Send("^v")
EndFunc   ;==>AbuseLang

Func FoulLang()
    ClipPut('y@ '&$PlayerName&', Please keep inappropiate content off of our servers. Thank you.')
    Send("^v")
EndFunc   ;==>FoulLang

Func BadSpray()
    ClipPut('y@ '&$PlayerName&', Please do not spray your spray again in our servers. Thank you.')
    Send("^v")
EndFunc   ;==>BadSpray

Func BadName()
    ClipPut('y@ '&$PlayerName&', Please change your name, as <these words> are not allowed on our servers. Thank you.')
    Send("^v")
EndFunc   ;==>BadName

;Kicks Below
Func AbuseKick()
    ClipPut('sm_kick '&$PlayerName&' "Repeated use of foul/abusive language"')
    Send("^v")
EndFunc   ;==>AbuseKick

Func FoulKick()
    ClipPut('sm_kick '&$PlayerName&' "Repeated use of inappropiate language"')
    Send("^v")
EndFunc   ;==>FoulKick

Func SprayKick()
    ClipPut('sm_kick <'&$PlayerName&'> "Inappropiate spray"')
    Send("^v")
EndFunc   ;==>SprayKick

Func NameKick()
    ClipPut('sm_kick <'&$PlayerName&'> "Inappropiate name"')
    Send("^v")
EndFunc   ;==>NameKick


Func OnAutoItExit()
    DllClose($dll)
EndFunc   ;==>OnAutoItExit

; these 2 funcs are tu restore old clippboard :)
func clipsave()
$data = ClipGet()
EndFunc

func clipload()
ClipPut($data)
EndFunc
Edited by au3scr
Link to comment
Share on other sites

@au3scr: The last one doesn't work as well. It's a game and it doesn't handle copy and paste as well as other programs. The version I posted is working great.

So guys,

Do I make While loops for all the keys, or does it have to be nested?

Example

While 1
    If _IsPressed('13', $dll) Then
        $PlayerName = ClipGet()
        FoulLang()
    EndIf
    Sleep(10)
WEnd

While 1
    If _IsPressed('14', $dll) Then
        $PlayerName = ClipGet()
        AbuseLang()
    EndIf
    Sleep(10)
WEnd

While 1
    If _IsPressed('15', $dll) Then
        $PlayerName = ClipGet()
        BadSpray()
    EndIf
    Sleep(10)
WEnd

Are we supposed to have that many infinite loops?

[EDIT] I confirmed my suspicion that having the extra While loops doesn't work. Only the first loop works, so any idea on how to nest these?

Edited by AgentSmith15
Link to comment
Share on other sites

Would a Case select or switch be ideal in this situation?

It would look prettier. They're pretty easy to figure out from the docs. Cases are usually good when you have multiple if statements for the same variable.

Here's one I grabbed from one of my scripts. It checks to see if a checkbox is ticked, if so it calls various functions.

Select
        Case GUICtrlRead($rad1) = $GUI_CHECKED
            GUICtrlSetState($rad1,$GUI_UNCHECKED)
            rad1_133_12()
        Case GUICtrlRead($rad2) = $GUI_CHECKED
            GUICtrlSetState($rad2,$GUI_UNCHECKED)
            rad2_158_30()
        Case GUICtrlRead($rad3) = $GUI_CHECKED
            GUICtrlSetState($rad3,$GUI_UNCHECKED)           
            rad3_171_74()
        Case GUICtrlRead($rad4) = $GUI_CHECKED
            GUICtrlSetState($rad4,$GUI_UNCHECKED)
            rad4_178_20()
        Case GUICtrlRead($rad5) = $GUI_CHECKED
            GUICtrlSetState($rad5,$GUI_UNCHECKED)
            rad5_180_34()
        Case GUICtrlRead($rad6) = $GUI_CHECKED
            GUICtrlSetState($rad6,$GUI_UNCHECKED)
            rad6_191_92()
        Case GUICtrlRead($rad7) = $GUI_CHECKED
            GUICtrlSetState($rad7,$GUI_UNCHECKED)
            rad7_195_63()
        Case GUICtrlRead($rad8) = $GUI_CHECKED
            GUICtrlSetState($rad8,$GUI_UNCHECKED)
            rad8_204_23()
        Case GUICtrlRead($rad9) = $GUI_CHECKED
            GUICtrlSetState($rad9,$GUI_UNCHECKED)
            rad9_218_96()
        Case GUICtrlRead($rad10) = $GUI_CHECKED
            GUICtrlSetState($rad10,$GUI_UNCHECKED)
            rad10_220_81()
        Case GUICtrlRead($rad11) = $GUI_CHECKED
            GUICtrlSetState($rad11,$GUI_UNCHECKED)
            rad11_230_93()
        Case GUICtrlRead($rad12) = $GUI_CHECKED
            GUICtrlSetState($rad12,$GUI_UNCHECKED)
            rad12_237_53()
        Case GUICtrlRead($rad13) = $GUI_CHECKED
            GUICtrlSetState($rad13,$GUI_UNCHECKED)
            rad13_240_71()
        Case GUICtrlRead($rad14) = $GUI_CHECKED
            GUICtrlSetState($rad14,$GUI_UNCHECKED)
            AddLines(1) 
            rad14_242_85()
        Case GUICtrlRead($rad15) = $GUI_CHECKED
            GUICtrlSetState($rad15,$GUI_UNCHECKED)
            AddLines(1)
            rad15_254_43()
        Case GUICtrlRead($rad16) = $GUI_CHECKED
            GUICtrlSetState($rad16,$GUI_UNCHECKED)
            rad16_311_37()
        Case GUICtrlRead($rad17) = $GUI_CHECKED
            GUICtrlSetState($rad17,$GUI_UNCHECKED)
            rad17_322_95()
        Case GUICtrlRead($rad18) = $GUI_CHECKED
            GUICtrlSetState($rad18,$GUI_UNCHECKED)
            AddLines(2)
            rad18_373_88()
        Case GUICtrlRead($rad19) = $GUI_CHECKED
            GUICtrlSetState($rad19,$GUI_UNCHECKED)
            AddLines(2)
            rad19_385_46()
        Case GUICtrlRead($rad20) = $GUI_CHECKED
            GUICtrlSetState($rad20,$GUI_UNCHECKED)
            rad20_218_92()
        Case GUICtrlRead($rad21) = $GUI_CHECKED
            GUICtrlSetState($rad21,$GUI_UNCHECKED)
            AddLines(2)
            rad21_267_53()
        Case GUICtrlRead($rad22) = $GUI_CHECKED
            GUICtrlSetState($rad22,$GUI_UNCHECKED)
            Addlines(3)
            rad22_398_21()
        EndSelect
Link to comment
Share on other sites

you don't need to nest them if you use hotkeyset.

also, don't use a bunch of if statements in a while loop; polling ispressed like this, in my limited experience:), is not as reliable as hotkeyset.

hotkeyset("{pause}" , "FoulLang")
while 1
  sleep(50)
wend
func FoulLang()
....

edit: I'm a n00b

Edited by DangerousDan
Link to comment
Share on other sites

you don't need to nest them if you use hotkeyset.

also, don't use a bunch of if statements in a while loop; polling ispressed like this, in my limited experience:), is not as reliable as hotkeyset.

hotkeyset("{pause}" , "FoulLang")
while 1
  sleep(50)
wend
func FoulLang()
....

edit: I'm a n00b

What do you mean don't use a lot of statements? This is for a full screen game, so I have a doubt hotkeyset will not work.
Link to comment
Share on other sites

I take you wish to wait for a keypress (using _IsPressed), and upon the certain keypress, execute a function, sending the string.

Correct or far far away?

Cheers,

Brett

EDIT:

How is this?

Opt("SendKeyDelay", 20)
Opt("SendKeyDownDelay", 3)
;Please uncomment   #Include <Misc.au3> if you use #include <IsPressed.au3>
;~ #include <IsPressed.au3>
#include <Misc.au3>
$dll = DllOpen("user32.dll")
ClipPut("")

While 1
    Select
        Case _IsPressed('13', $dll);Pause Key
            FoulLang()
        Case _IsPressed ('2D', $dll);INS Key
            AbuseLang()
        Case Else
            Sleep (20)
    EndSelect
WEnd

;Warnings Below
Func AbuseLang()
    Send('y@ ' & ClipGet() & ', Please watch your language on our servers. Thanks.', 1)
EndFunc  ;==>AbuseLang

Func FoulLang()
    Send('y@ ' & ClipGet() & ', Please keep inappropiate content off of our servers. Thank you.', 1)
EndFunc  ;==>FoulLang

Func BadSpray()
    Send('y@ ' & ClipGet() & ', Please do not spray your spray again in our servers. Thank you.', 1)
EndFunc  ;==>BadSpray

Func BadName()
    Send('y@ ' & ClipGet() & ', Please change your name, as <these words> are not allowed on our servers. Thank you.', 1)
EndFunc  ;==>BadName

;Kicks Below
Func AbuseKick()
    Send('sm_kick ' & ClipGet() & ' "Repeated use of foul/abusive language"', 1)
EndFunc  ;==>AbuseKick

Func FoulKick()
    Send('sm_kick ' & ClipGet() & ' "Repeated use of inappropiate language"', 1)
EndFunc  ;==>FoulKick

Func SprayKick()
    Send('sm_kick <' & ClipGet() & '> "Inappropiate spray"', 1)
EndFunc  ;==>SprayKick

Func NameKick()
    Send('sm_kick <' & ClipGet() & '> "Inappropiate name"', 1)
EndFunc  ;==>NameKick


Func OnAutoItExit()
    DllClose($dll)
EndFunc  ;==>OnAutoItExit
Edited by BrettF
Link to comment
Share on other sites

I take you wish to wait for a keypress (using _IsPressed), and upon the certain keypress, execute a function, sending the string.

Correct or far far away?

Cheers,

Brett

Correct!

Playing in game if someone violates our rules I wish to be able to use a keypress to exec a function.

Darn, AutoIt doesn't like the code below :/

Should '$PlayerName = ClipGet()" be in the while loop or the function?

Opt("SendKeyDelay", 30)
Opt("SendKeyDownDelay", 5)
;Please uncomment   #Include <Misc.au3> if you use #include <IsPressed.au3>
;~ #include <IsPressed.au3>
#Include <Misc.au3>
$dll = DllOpen("user32.dll")
ClipPut("")

While 1
    If _IsPressed('13', $dll) Then
        Call("AbuseLang")
    ElseIf
        If _IsPressed('13',$dll) Then
            Call("FoulLang")
        ElseIf
            If _IsPressed('13',$dll) Then
                Call("BadSpray")
            ElseIf
                If _IsPressed('13',$dll) Then
                    Call("BadName")
                ElseIf
                    If _IsPressed('13',$dll) Then
                        Call("AbuseKick")
                    ElseIf
                        If _IsPressed('13',$dll) Then
                            Call("FoulKick")
                        ElseIf
                            If _IsPressed('13',$dll) Then
                                Call("SprayKick")
                            ElseIf
                                If _IsPressed('13',$dll) Then
                                    Call("NameKick")
                                    EndIf
    Sleep(10)
WEnd

;Warnings Below
Func AbuseLang()
    $PlayerName = ClipGet()
    Send('y@ '&$PlayerName&', Please watch your language on our servers. Thanks.', 1)
EndFunc;==>AbuseLang

Func FoulLang()
    $PlayerName = ClipGet()
    Send('y@ '&$PlayerName&', Please keep inappropiate content off of our servers. Thank you.', 1)
EndFunc;==>FoulLang

Func BadSpray()
    $PlayerName = ClipGet()
    Send('u@@ '&$PlayerName&', Please do not spray your spray again in our servers. Thank you.', 1)
EndFunc;==>BadSpray

Func BadName()
    $PlayerName = ClipGet()
    Send('u@@ '&$PlayerName&', Please change your name, as <these words> are not allowed on our servers. Thank you.', 1)
EndFunc;==>BadName

;Kicks Below
Func AbuseKick()
    $PlayerName = ClipGet()
    Send('sm_kick '&$PlayerName&' "Repeated use of foul/abusive language"', 1)
EndFunc;==>AbuseKick

Func FoulKick()
    $PlayerName = ClipGet()
    Send('sm_kick '&$PlayerName&' "Repeated use of inappropiate language"', 1)
EndFunc;==>FoulKick

Func SprayKick()
    $PlayerName = ClipGet()
    Send('sm_kick <'&$PlayerName&'> "Inappropiate spray"', 1)
EndFunc;==>SprayKick

Func NameKick()
    $PlayerName = ClipGet()
    Send('sm_kick <'&$PlayerName&'> "Inappropiate name"', 1)
EndFunc;==>NameKick


Func OnAutoItExit()
    DllClose($dll)
EndFunc;==>OnAutoItExit
Edited by AgentSmith15
Link to comment
Share on other sites

So if you press pause, you want to be able to press another key to send a message?

Otherwise check out my edit on previous post...

Cheers,

Brett :)

Edited by BrettF
Link to comment
Share on other sites

Okay.

Lets have a close look at the While loop in my script. This is where all the magic happens.

While 1
    Select
        Case _IsPressed('13', $dll);Pause Key
            FoulLang()
        Case _IsPressed ('2D', $dll);INS Key
            AbuseLang()
        Case Else
            Sleep (20)
    EndSelect
WEnd

Notice it is a never ending loop.

Now we use a select...case statement to test each key press. Because it is basically testing if the condition is true, we can just have the _Ispressed function call. Easier that writing _IsPressed ('fdd', $dll) = 1 or <> 0. If the key is pressed, the case is true, it executes the function call, and then continues the loop. The Case Else, is just so if there is no keypress, then sleep.

Make some more sense?

Link to comment
Share on other sites

Thank you thank you thank you!!!

The keypad numbers don't work so I thought the script was wrong, but I found out otherwise. So to use the other functions we will have to change the numbers. I can do that all myself, so here is the whole script.

Your explanation was very easy to understand. Thanks again!

Opt("SendKeyDelay", 30)
Opt("SendKeyDownDelay", 5)
;Please uncomment   #Include <Misc.au3> if you use #include <IsPressed.au3>
;~ #include <IsPressed.au3>
#include <Misc.au3>
$dll = DllOpen("user32.dll")
ClipPut("")

While 1
    Select
        Case _IsPressed('91', $dll);Scroll key
            Call("AbuseLang")
        Case _IsPressed('13', $dll);Pause key
            Call("FoulLang")
        Case _IsPressed('2D', $dll);INS key
            Call("BadSpray")
        Case _IsPressed('2E', $dll);DEL key
            Call("BadName")
        Case _IsPressed('24', $dll);HOME key
            Call("AbuseKick")
        Case _IsPressed('21', $dll);PAGEUP key
            Call("FoulKick")
        Case _IsPressed('22', $dll);PAGEDOWN key
            Call("SprayKick")
        Case _IsPressed('23', $dll);END key
            Call("NameKick")
        Case Else
            Sleep(20)
    EndSelect
WEnd

;Warnings Below
Func AbuseLang()
    $PlayerName = ClipGet()
    Send('y@ ' & $PlayerName & ', Please watch your language on our servers. Thanks.', 1)
EndFunc   ;==>AbuseLang

Func FoulLang()
    $PlayerName = ClipGet()
    Send('y@ ' & $PlayerName & ', Please keep inappropiate content off of our servers. Thank you.', 1)
EndFunc   ;==>FoulLang

Func BadSpray()
    $PlayerName = ClipGet()
    Send('u@@ ' & $PlayerName & ', Please do not spray your spray again in our servers. Thank you.', 1)
EndFunc   ;==>BadSpray

Func BadName()
    $PlayerName = ClipGet()
    Send('u@@ ' & $PlayerName & ', Please change your name, as <these words> are not allowed on our servers. Thank you.', 1)
EndFunc   ;==>BadName

;Kicks Below
Func AbuseKick()
    $PlayerName = ClipGet()
    Send('sm_kick ' & $PlayerName & ' "Repeated use of foul/abusive language"', 1)
EndFunc   ;==>AbuseKick

Func FoulKick()
    $PlayerName = ClipGet()
    Send('sm_kick ' & $PlayerName & ' "Repeated use of inappropiate language"', 1)
EndFunc   ;==>FoulKick

Func SprayKick()
    $PlayerName = ClipGet()
    Send('sm_kick <' & $PlayerName & '> "Inappropiate spray"', 1)
EndFunc   ;==>SprayKick

Func NameKick()
    $PlayerName = ClipGet()
    Send('sm_kick <' & $PlayerName & '> "Inappropiate name"', 1)
EndFunc   ;==>NameKick

Func OnAutoItExit()
    DllClose($dll)
EndFunc   ;==>OnAutoItExit
Edited by AgentSmith15
Link to comment
Share on other sites

Link to comment
Share on other sites

Opt("SendKeyDelay", 30)
Opt("SendKeyDownDelay", 5)
;Please uncomment   #Include <Misc.au3> if you use #include <IsPressed.au3>
;~ #include <IsPressed_UDF.au3>
#include <Misc.au3>

ClipPut('')

While 1
If _IsPressed('91') Then
_Command("AbuseLang")
ElseIf _IsPressed('13') Then
_Command("FoulLang")
ElseIf _IsPressed('2D') Then
_Command("BadSpray")
ElseIf _IsPressed('2E') Then
_Command("BadName")
ElseIf _IsPressed('24') Then
_Command("AbuseKick")
ElseIf _IsPressed('21') Then
_Command("FoulKick")
ElseIf _IsPressed('22') Then
_Command("SprayKick")
ElseIf _IsPressed('23') Then
_Command("NameKick")
EndIf
Sleep(20)
WEnd

Func _Command($what)
;Warnings Below

If $what = "AbuseLang" Then
$PlayerName = ClipGet()
Send('y@ ' & $PlayerName & ', Please watch your language on our servers. Thanks.', 1)
ElseIf $what ="FoulLang" Then
$PlayerName = ClipGet()
Send('y@ ' & $PlayerName & ', Please keep inappropiate content off of our servers. Thank you.', 1)
ElseIf $what = "BadSpray" Then
$PlayerName = ClipGet()
Send('u@@ ' & $PlayerName & ', Please do not spray your spray again in our servers. Thank you.', 1)
ElseIf $what = "BadName" Then
$PlayerName = ClipGet()
Send('u@@ ' & $PlayerName & ', Please change your name, as <these words> are not allowed on our servers. Thank you.', 1)
ElseIf $what = "AbuseKick" Then
$PlayerName = ClipGet()
Send('sm_kick ' & $PlayerName & ' "Repeated use of foul/abusive language"', 1)
ElseIf $what = "FoulKick" Then
$PlayerName = ClipGet()
Send('sm_kick ' & $PlayerName & ' "Repeated use of inappropiate language"', 1)
ElseIf $what = "SprayKick" Then
$PlayerName = ClipGet()
Send('sm_kick <' & $PlayerName & '> "Inappropiate spray"', 1)
ElseIf $what = "NameKick"
$PlayerName = ClipGet()
Send('sm_kick <' & $PlayerName & '> "Inappropiate name"', 1)
EndIf
EndFunc

Cheers, FireFox.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...