uen / Leveling-System

Leveling system in gLua (For DarkRP)
Other
35 stars 22 forks source link

Adding XP reward from other entities. #54

Closed LegendWIll closed 8 years ago

LegendWIll commented 8 years ago

Hi, I'm having trouble granting XP from my other printer addon. Before I make sure if I'm even in the right function, would this line actually work?

self:addXP("printer_amount" * 0.15)

uen commented 8 years ago

Show the entire function

On 17 Aug 2016 08:30, "William Welsh" notifications@github.com wrote:

Hi, I'm having trouble granting XP from my other printer addon. Before I make sure if I'm even in the right function, would this line actually work?

self:addXP("printer_amount" * 0.15)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vrondakis/Leveling-System/issues/54, or mute the thread https://github.com/notifications/unsubscribe-auth/ADxNa1s8_ye6vGPm1oSOuwbZ_TTyzFyyks5qgriigaJpZM4JmK2i .

LegendWIll commented 8 years ago

Ok, I put it somewhere else and now I can spam the printer and constantly get +whateverXP. I'm using ePrinters and it has support for EXP, which I thought was for your system. I guess not. This is in the entity's init.lua

`function ENT:Use(activator, caller, ent) local owner = self.dt.owning_ent if Prc.PrinterCopsRemoval2 then if activator:isCP() and activator != self.dt.owning_ent then activator:addMoney(Prc.PrinterCopsRemovalGift2) DarkRP.notify(activator,2,2, ("You receive $"..Prc.PrinterCopsRemovalGift2.. " by destroying this printer")) if Prc.EnableCPNotification then DarkRP.notify(owner,1,4,(Prc.OwnerNotification)) end self:Remove() end if activator:isCP() and activator == self.dt.owning_ent then self:Remove() activator:ChatPrint(Prc.CPMessage) end

end
    if Prc.EnableNotification then
        if self:GetNWInt("PrintA") > 0  then
            if not activator:isCP() then
                DarkRP.notify(activator,2,2,(Prc.Notification ..self:GetNWInt("PrintA")..Prc.Notification2))
            end
        end
    end
    if Prc.PrinterCopsRemoval2 and activator:isCP() and activator == self.dt.owning_ent then
        DarkRP.notify(owner,1,4,(Prc.CPMessage))
    else
        activator:addMoney(self:GetNWInt("PrintA"));
        activator:addXP(Prc.PrinterExp) -- Variable is set in config file
        if Prc.LevelSystem and (self:GetNWInt("PrintA") > 0) and Prc.LevelStatic then
            activator.notificationType = {"Printing", " Money"}
            activator:addEXP(Prc.PrinterExp)
        elseif Prc.LevelSystem and (self:GetNWInt("PrintA") > 0) then
            activator.notificationType = {"Printing", " Money"}
            activator:addEXP(self:GetNWInt("PrintA") * (Prc.LevelPercent * 0.01))
        end
        if Prc.StealingSystem and self:GetNWBool( "printer_stealing" ) then
            if (self:GetNWInt("PrintA") > 0) and (activator != owner) then
                owner:ChatPrint(Prc.StealingSystemMsg)
            end
        end
        self:SetNWInt("PrintA",0)
    end

end`

LegendWIll commented 8 years ago

Sorry for wasting your time. I figured it out.