Jump to content

[IRC]Resource restart?


wouter0100

Recommended Posts

Posted

Hi :)

I have maked a script:

                if "..user.." == "DutchCheater" then 
                restartResource(irc) 
                end 

This script would be that if someone in the irc

did that the resource must restart irc?

but that gives nothing back?

Thanks..

Wouter

Posted

wtf is that? i don't get anything of that code... 2 lines of something that makes no sense? is that your WHOLE code?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
-------------------------------------------------------- 
-- Name: irc                                          --
-- Author: MCvarial <[email protected]>              --
-- Date: 02-05-2010                                   --
--------------------------------------------------------
 
-- events
 
addEventHandler("onIRCConnecting",root,
    function ()
        outputServerLog("IRC: connecting to "..getServerHost(source).." on port "..getServerPort(source).."...")
    end
)
 
addEventHandler("onIRCConnect",root,
    function ()
        outputServerLog(getServerName(source)..": connected as "..getServerNick(source).."!")
    end
)
 
addEventHandler("onIRCRaw",root,
    function (data)
        --outputServerLog(getServerName(source)..": "..data)
    end
)
 
addEventHandler("onIRCJoin",root,
    function (channel,user)
        outputServerLog(getServerName(source)..": "..user.." ("..getUserHost(user)..") joined "..channel.."!")
                if ..user.. == "DutchCheater" then
                restartResource(irc)
                end
    end
)
 
addEventHandler("onIRCMode",root,
    function (channel,user,mode,users)
        outputServerLog(getServerName(source)..": "..channel.." "..user.." sets mode "..mode.." "..table.concat(users," "))
    end
)
 
addEventHandler("onIRCMessage",root,
    function (channel,user,message)
        outputServerLog(getServerName(source)..": "..channel.." <"..user.."> "..message)
    end
)
 
addEventHandler("onIRCPrivateMessage",root,
    function (user,message)
        outputServerLog(getServerName(source)..": PM from "..user..": "..message)
    end
)
 
addEventHandler("onIRCNotice",root,
    function (channel,user,message)
        outputServerLog(getServerName(source)..": "..channel.." NOTICE <"..user.."> "..message)
    end
)
 
addEventHandler("onIRCPrivateNotice",root,
    function (user,message)
        if user == getServerName(source) then return end
        if user == getServerHost(source) then return end
        outputServerLog(getServerName(source)..": notice from "..user..": "..message)
    end
)
 
addEventHandler("onIRCPart",root,
    function (channel,user,reason)
        outputServerLog(getServerName(source)..": "..user.." parted "..channel.."! ("..reason..")")
    end
)
 
addEventHandler("onIRCKick",root,
    function (channel,user,kicker,reason)
        outputServerLog(getServerName(source)..": "..user.." was kicked from "..channel.." by "..kicker.." ("..reason..")")
    end
)
 
addEventHandler("onIRCQuit",root,
    function (user,reason)
        outputServerLog(getServerName(source)..": "..user.." quit! ("..reason..")")
    end
)
 
addEventHandler("onIRCDisconnect",root,
    function (reason)
        outputServerLog(getServerName(source)..": disconnected! ("..reason..")")
    end
)
 
-- output on irc
addEventHandler("onResourceStart",root,
    function (resource)
        if getResourceInfo(resource,"type") ~= "map" then
            outputIRC("07* Resource '"..getResourceName(resource).."' started!")
        end
    end
)
 
addEventHandler("onResourceStop",root,
    function (resource)
        if getResourceInfo(resource,"type") ~= "map" then
            outputIRC("07* Resource '"..(getResourceName(resource) or "?").."' stopped!")
        end
    end
)
 
addEventHandler("onPlayerJoin",root,
    function ()
        outputIRC("03*** "..getPlayerName(source).." joined the game.")
    end
)
 
addEventHandler("onPlayerQuit",root,
    function (quit,reason,element)
        if reason then
            outputIRC("02*** "..getPlayerName(source).." was "..quit.." from the game by "..getPlayerName(element).." ("..reason..")")
        else
            outputIRC("02*** "..getPlayerName(source).." left the game ("..quit..")")
        end
    end
)
 
addEventHandler("onPlayerChangeNick",root,
    function (oldNick,newNick)
        outputIRC("13* "..oldNick.." is now known as "..newNick)
    end
)
 
addEventHandler("onPlayerChat",root,
    function (message,type)
        if type == 0 then
            outputIRC("07"..getPlayerName(source)..":01 "..message)
        elseif type == 1 then
            outputIRC("06* "..getPlayerName(source).." "..message)
        elseif type == 2 then
            outputIRC("07(TEAM)"..getPlayerName(source)..": "..message)
        end
    end
)
 
local bodyparts = {nil,nil,"Torso","Ass","Left Arm","Right Arm","Left Leg","Right Leg","Head"}
local weapons = {}
weapons[19] = "Rockets"
weapons[88] = "Fire"
addEventHandler("onPlayerWasted",root,
    function (ammo,killer,weapon,bodypart)
        if killer then
            if getElementType(killer) == "vehicle" then
                local driver = getVehicleController(killer)
                if driver then
                    outputIRC("04* "..getPlayerName(source).." was killed by "..getPlayerName(driver).." in a "..getVehicleName(killer))
                else
                    outputIRC("04* "..getPlayerName(source).." was killed by an "..getVehicleName(killer))
                end
            elseif getElementType(killer) == "player" then
                if weapon == 37 then
                    if getPedWeapon(killer) ~= 37 then
                        weapon = 88
                    end
                end
                outputIRC("04* "..getPlayerName(source).." was killed by "..getPlayerName(killer).." ("..(getWeaponNameFromID(weapon) or weapons[weapon] or "?")..")("..bodyparts[bodypart]..")")
            else
                outputIRC("04* "..getPlayerName(source).." died")
            end
        else
            outputIRC("04* "..getPlayerName(source).." died")
        end
    end
)
       
addEvent("onPlayerFinish",true)
addEventHandler("onPlayerFinish",root,
    function (rank,time)
        outputIRC("12* "..getPlayerName(source).." finished (rank: "..rank.." time: "..msToTimeStr(time)..")")
    end
)
 
addEvent("onGamemodeMapStart",true)
addEventHandler("onGamemodeMapStart",root,
    function (res)
        outputIRC("12* Map started:01"..(getResourceInfo(res, "name") or getResourceName(res)))
        local resource = getResourceFromName("mapratings")
        if resource and getResourceState(resource) == "running" then
            outputIRC("07* Rating: 01"..exports.mapratings:getMapRating(res))
        end
    end
)
 
addEvent("onPlayerToptimeImprovement",true)
addEventHandler("onPlayerToptimeImprovement",root,
    function (newPos,newTime,oldPos,oldTime)
        if newPos == 1 then
            outputIRC("07* New record: "..msToTimeStr(newTime).." by "..getPlayerName(source).."!")
        end
    end
)
 
addEventHandler("onBan",root,
    function (ban)
        outputIRC("12* Ban added by "..(getPlayerName(source) or "Console")..": name: "..(getBanNick(ban) or "/")..", ip: "..(getBanIP(ban) or "/")..", serial: "..(getBanSerial(ban) or "/")..", by: "..(getBanAdmin(ban) or "/").." for: "..(getBanReason(ban) or "/"))
    end
)
 
addEventHandler("onUnban",root,
    function (ban)
        outputIRC("12* Ban removed by "..(getPlayerName(source) or "Console")..": name: "..(getBanNick(ban) or "/")..", ip: "..(getBanIP(ban) or "/")..", serial: "..(getBanSerial(ban) or "/")..", by: "..(getBanAdmin(ban) or "/").." for: "..(getBanReason(ban) or "/"))
    end
)
 
-- commands
function addCommands ()
 
addIRCCommandHandler("!say",
    function (server,channel,user,command,...)
        local message = table.concat({...}," ")
        if not message then ircNotice(server,user,"syntax is !say <message>") return end
        outputChatBox("* "..user.." (On IRC): "..message,root,255,168,0)
        outputIRC("07* "..user.." (On IRC): "..message)
    end,getCommandLevel("!say"),isEchoChannelOnly("!say")
)
 
addIRCCommandHandler("!s",
    function (server,channel,user,command,...)
        local message = table.concat({...}," ")
        if not message then ircNotice(server,user,"syntax is !s <message>") return end
        outputChatBox("* "..user.." (On IRC): "..message,root,255,168,0)
        outputIRC("07* "..user.." (On IRC): "..message)
    end,getCommandLevel("!s"),isEchoChannelOnly("!s")
)
 
addIRCCommandHandler("!pm",
    function (server,channel,user,command,name,...)
        local message = table.concat({...}," ")
        if not name then ircNotice(server,user,"syntax is !pm <name> <message>") return end
        if not message then ircNotice(server,user,"syntax is !pm <name> <message>") return end
        local player = getPlayerFromPartialName(name)
        if player then
            outputChatBox("* PM from "..user.." on irc: "..message,player,255,168,0)
            ircNotice(server,user,"Your pm has been send to "..getPlayerName(player))
        else
            ircNotice(server,user,"'"..name.."' no such player")
        end
    end,getCommandLevel("!pm"),isEchoChannelOnly("!pm")
)
 
addIRCCommandHandler("!kick",
    function (server,channel,user,command,name,...)
        if not name then ircNotice(server,user,"syntax is !kick <name> <reason>") return end
        local reason = table.concat({...}," ") or ""
        local player = getPlayerFromPartialName(name)
Posted

so you want to restart the resource when a guy with name DutchCheater joins?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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
  • Recently Browsing   0 members

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