[Plugin] McRainbow r2 UPDATED
#18
So I added the DoWithPlayer() function in Rev 639, here's an actual code that kills a player specified:
Code:
function HandleKill(Split, InitiatorPlayer)
    -- InitiatorPlayer is valid throughout this function, even within the local function KillPlayer()
    local World = cRoot:Get():GetDefaultWorld()
    local PlayerName = Split[2] or ""
    if (PlayerName == "") then
        InitiatorPlayer:SendMessage(cChatColor.Green .. "Expected the player name to kill as the parameter")
        return true
    end

    local KillPlayer = function(Player)
        -- Player is valid only within this function, it cannot be stord and used later!
        Player:SendMessage("Incoming gift from " .. InitiatorPlayer:GetName() .. " to " .. PlayerName .. ": " .. (Split[3] or ""))
        Player:TakeDamage(100, InitiatorPlayer)
        HasFound = true
    end
    if (not(World:DoWithPlayer(PlayerName, KillPlayer))) then
        InitiatorPlayer:SendMessage(cChatColor.Green .. "Could not find player " .. PlayerName)
    end
    return true
end
Reply
Thanks given by:


Messages In This Thread
[Plugin] McRainbow r2 UPDATED - by Kwen - 12-25-2011, 09:34 AM
RE: McRainbow r1 - by FakeTruth - 12-25-2011, 09:43 AM
RE: McRainbow r1 - by Kwen - 12-25-2011, 09:56 AM
RE: [Plugin] McRainbow r1 - by NiLSPACE - 12-25-2011, 08:37 PM
RE: [Plugin] McRainbow r1 - by Kwen - 12-26-2011, 09:16 AM
RE: [Plugin] McRainbow r1 - by Lapayo - 12-26-2011, 09:55 AM
RE: [Plugin] McRainbow r1 - by NiLSPACE - 12-27-2011, 12:17 AM
RE: [Plugin] McRainbow r1 - by Lapayo - 12-27-2011, 01:31 AM
RE: [Plugin] McRainbow r1 - by Kwen - 12-29-2011, 02:50 AM
RE: [Plugin] McRainbow r2 UPDATED - by NiLSPACE - 12-29-2011, 07:02 AM
RE: [Plugin] McRainbow r2 UPDATED - by Luthrandel - 12-29-2011, 12:28 PM
RE: [Plugin] McRainbow r2 UPDATED - by mtilden - 12-29-2011, 10:25 AM
RE: [Plugin] McRainbow r2 UPDATED - by Taugeshtu - 06-05-2012, 03:17 AM
RE: [Plugin] McRainbow r2 UPDATED - by NiLSPACE - 06-05-2012, 04:00 AM
RE: [Plugin] McRainbow r2 UPDATED - by NiLSPACE - 06-05-2012, 05:20 AM
RE: [Plugin] McRainbow r2 UPDATED - by batekman - 06-28-2012, 12:59 AM
RE: [Plugin] McRainbow r2 UPDATED - by xoft - 07-02-2012, 07:47 PM
RE: [Plugin] McRainbow r2 UPDATED - by xoft - 07-02-2012, 09:28 PM



Users browsing this thread: 1 Guest(s)