Give points hook?



  • owner:AddPoints(amount or 0)

    This didnt work, so what is right to use?? AddPoints doesnt work. Which should i then use

    “attempt to call method ‘AddPoints’ (a nil value)”



  • owner:AddPoints(amount or 0)

    This didnt work, so what is right to use?? AddPoints doesnt work. Which should i then use

    “attempt to call method ‘AddPoints’ (a nil value)”



  • function ulx.addzspoints( calling_ply, pl, amount )
    	for i=1, #pl do
    		if pl[i]:Team() == TEAM_SURVIVOR then
    			pl[ i ]:AddPoints(amount)
    			ulx.fancyLogAdmin( calling_ply, false, "#A gave #T #i points", pl, amount )
    		else
    			ULib.tsayError (calling_ply, pl[ i ]:Nick() .. " is not a human!", true)
    		end
    	end
    end
    local addzspoints = ulx.command( CATEGORY_NAME, "ulx addzspoints", ulx.addzspoints, "!addpoints" )
    addzspoints:addParam{ type=ULib.cmds.PlayersArg }
    addzspoints:addParam{ type=ULib.cmds.NumArg, min=0, max=9001, hint="add points" }
    addzspoints:defaultAccess( ULib.ACCESS_ADMIN )
    addzspoints:help( "Gives the target points." )
    
    This is what I used for my server.
    
    I am still a rookie lua coder, so other people forgive me if this code could be better. It worked, though.[/i]
    


  • pl[ i ]:“AddPoints”(amount) AddPoints doesnt exist acording to my server

    i get this “init.lua:122: attempt to call method ‘AddPoints’ (a nil value)”

    local amount = self.GiveAmount
    if (MGS_SAFEMODE) then
    local owner = cart:Getowning_ent()
    if (MGS_GM_VERSION <= 2.4) then
    owner:AddPoints(amount or 0)
    else
    owner:AddPoints(amount or 0)
    end


  • Administrators

    Well ZS itself uses AddPoints so you’re doing something wrong like trying to call it from the client or targetting a non-player entity.

    Also don’t mix three different types of variable naming conventions that’s silly:
    @Seba0702:

    Getowning_ent()


Log in to reply
 

5
Online

10978
Users

15258
Topics

297336
Posts

Looks like your connection to NoXiousNet was lost, please wait while we try to reconnect.