All pastes #608859 Raw Edit

Mafia bot

public text v1 · immutable
·published 2007-07-08 15:22 UTC
rendered paste body
dim Gamestate
Gamestate= 0
dim num
num = 0
dim i
Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)
if lcase(message)="!start" then 
    if Gamestate=0 then
        writeinifile "mafia.ini", "vars", "num", 0
        Gamestate=1
    else 
        sendcommand "/msg " + channel + " Dude. the game already started"
    end if
end if
if lcase(message)="!join" then 
    if gamestate = 1 then
        writeinifile "mafia.ini","players", num, nickname
        num = num + 1
    else if gamestate=0 then
        sendcommand "/msg " + channel + " Let's try starting the game first, mmmkay?"
    else 
        sendcommand "/msg " + channel + " Litle bit late for that, no?"
    end if
end if
if left(lcase(message),7)="!count " then
    count = Mid(message,8)
    text = Getinifile("mafia.ini","players", count, "0")
    sendcommand "/msg " + channel + " " + text
end if
if left(lcase(message),6)="!count" then
    if gamestate = 1 then
        i=0
        for i = 0 to num
            text = Getinifile("mafia.ini","players", count, "0")
            sendcommand "/msg " + channel + " " + text
            next
        else if gamestate = 0 then 
            sendcommand "/msg " + channel + " Let's try starting the game first, mmmkay?"
    end if
end if
if lcase(message)="!reset" then 
    i=1    
    for i = 1 to 6 
        writeinifile "mafia.ini", "players", i, 0
    next
    num = 0
    gamestate= 0
end if
End Sub