ULX

Author Topic: Need some minor assistance!  (Read 2894 times)

0 Members and 1 Guest are viewing this topic.

Offline lebofly

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Need some minor assistance!
« on: November 01, 2012, 07:17:35 PM »
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: [Select]
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!

Now this is the ULX addon i tried to use
Code: [Select]
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)." )

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

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Need some minor assistance!
« Reply #1 on: November 02, 2012, 03:13:58 PM »
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
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline lebofly

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Need some minor assistance!
« Reply #2 on: November 03, 2012, 11:13:55 PM »
Read it up and it confused me tbh, Although i know it's not what i was looking for

Offline iSnipeu

  • Jr. Member
  • **
  • Posts: 83
  • Karma: 12
Re: Need some minor assistance!
« Reply #3 on: November 04, 2012, 11:35:04 PM »
Code: [Select]
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)." )

Offline lebofly

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Need some minor assistance!
« Reply #4 on: November 05, 2012, 04:14:06 PM »
Thank you! I will try it out and get back to you