General > Developers Corner

Need some minor assistance!

(1/1)

lebofly:
Hey guys, I'm trying to create a ULX Redeem script for Zombie Survival.
The code bellow is the redeem script from ZS (AFAIK)


--- Code: ---function GM:PlayerRedeemed(pl, silent, noequip)
    if not silent then
        umsg.Start("PlayerRedeemed")
            umsg.Entity(pl)
        umsg.End()
    end

    pl:RemoveStatus("overridemodel", false, true)

    pl:ChangeTeam(TEAM_HUMAN)
    pl:DoHulls()
    if not noequip then pl.m_PreRedeem = true end
    pl:UnSpectateAndSpawn()
    pl.m_PreRedeem = nil

    local frags = pl:Frags()
    if frags < 0 then
        pl:SetFrags(frags * 5)
    else
        pl:SetFrags(0)
    end
    pl:SetDeaths(0)

    pl.DeathClass = nil
    pl:SetZombieClass(self.DefaultZombieClass)

    pl.SpawnedTime = CurTime()
end
Concommand.Add( "Redeem", PlayerRedeemed ) ---- I added this!

--- End code ---

Now this is the ULX addon i tried to use

--- Code: ---function ulx.slay( calling_ply, target_plys )
    local affected_plys = {}

    for i=1, #target_plys do
        local v = target_plys[ i ]

        if ulx.getExclusive( v, calling_ply ) then
            ULib.tsayError( calling_ply, ulx.getExclusive( v, calling_ply ), true )
        else
            v:Redeem() -------------------------------- Problem is here!
            table.insert( affected_plys, v )
        end
    end

    ulx.fancyLogAdmin( calling_ply, "#A redeemed #T", affected_plys )
end
local redeem = ulx.command( CATEGORY_NAME, "ulx redeem", redeem, "!redeem" )
slay:addParam{ type=ULib.cmds.PlayersArg }
slay:defaultAccess( ULib.ACCESS_ADMIN )
slay:help( "Redeem target(s)." )
--- End code ---

Obviously i need to give arguments as to what player i want to redeem but how do i go about doing so?

JamminR:
Seen these?
Might help you not only for this, but for anything you wish to do re:ULib and ULX commands.
http://forums.ulyssesmod.net/index.php/topic,4464.msg17838.html#msg17838 (Though it shows old vs new, 2nd half of first post should help...well commented command structure example - see the part starting at "So, on to the new New command structure...")
And, as always, our ULib documentation (Which, ULX uses extensively of course) - http://ulyssesmod.net/docs

lebofly:
Read it up and it confused me tbh, Although i know it's not what i was looking for

iSnipeu:

--- Code: ---function ulx.redeem( calling_ply, target_plys )

    local affected_plys = {}
    for i=1, #target_plys do
        local pl = target_plys[ i ]

        if ulx.getExclusive( pl, calling_ply ) then
            ULib.tsayError( calling_ply, ulx.getExclusive( pl, calling_ply ), true )
        else
            hook.Call( "PlayerRedeemed", GAMEMODE, pl ) -- Then put the arguments you want for PlayerRedeemed in here, already done pl
            table.insert( affected_plys, pl )
        end
    end

    ulx.fancyLogAdmin( calling_ply, "#A redeemed #T", affected_plys )
end
local redeem = ulx.command( "Utility", "ulx redeem", ulx.redeem, "!redeem" )
redeem:addParam{ type=ULib.cmds.PlayersArg }
redeem:defaultAccess( ULib.ACCESS_ADMIN )
redeem:help( "Redeems target(s)." )

--- End code ---

lebofly:
Thank you! I will try it out and get back to you

Navigation

[0] Message Index

Go to full version