[Help] Canot install Script

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
DexmanGR
Posts: 1
Joined: Sun Oct 12, 2008 8:43 pm

[Help] Canot install Script

Post by DexmanGR »

If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision 3228:
L2JDP Revision 6321:

Hello i cannot install a script for PvP Reward The script is this:

Code: Select all

## PvP rewards system by TheOne# This script gives Adena and SP # to players who kill other players.# It's a PvP server after all!# import sys from net.sf.l2j.util                               import Rndfrom java.lang                   import Systemfrom net.sf.l2j.gameserver                    import Announcementsfrom net.sf.l2j.gameserver.model.quest.jython      import QuestJython as JQuest from net.sf.l2j.gameserver.model.quest          import Statefrom net.sf.l2j.gameserver.model.actor.instance    import L2PcInstancefrom net.sf.l2j.gameserver.model.quest          import QuestStatefrom net.sf.l2j.gameserver.model         import L2Worldfrom net.sf.l2j.gameserver.network.serverpackets       import PledgeShowInfoUpdate  #Give a bonus to the Adena and SP reward the higher the killed player is in PvP/Pk points. LifeStones = [ 9575,9576,10485,10486 ] #Clan Reputation Bonus for killing another playerClanRepBonus = 50  class PvpRewards (JQuest) : def __init__(self,id,name,descr):   JQuest.__init__(self,id,name,descr)   self.PvpPlayers = []   self.startQuestTimer("playerCheck",2000,None,None,True)   self.startQuestTimer("PvpAnnounce",1200000,None,None,True)   self.exploitProtect = {}   self.permList = []  def onAdvEvent (self,event,npc,player):     if event == "PvpAnnounce":          rr = Rnd.get(100)         if rr < 20:             Announcements.getInstance().announceToAll("To gain more Adena and SP you need to kill other players!  Happy hunting!")     if "playerCheck" in event:         playerList = L2World.getInstance().getAllPlayers().values()         for i in playerList:             st1 = i.getQuestState("PvpRewards")             if not st1:                 st1 = self.newQuestState(i)             if not i in self.PvpPlayers:                 if not player.getName() in self.permList:                     self.permList.append(player.getName())                     self.exploitProtect[player] = []                     self.exploitProtectTime[player] = []                 st1.addNotifyOfDeath(st1.getPlayer())                 self.PvpPlayers.append(i)         for j in self.PvpPlayers:             if not j in playerList:                 self.PvpPlayers.remove(j)  def onDeath(self, killer, victim, st) :   if victim in self.PvpPlayers:    timeNow = System.currentTimeMillis()    victimLevel = victim.getLevel()    killerLevel = killer.getLevel()    self.PvpPlayers.remove(victim)    st = victim.getQuestState("PvpRewards")    st2 = killer.getQuestState("PvpRewards")    victimIp = victim.getClient().getConnection().getSocket().getInetAddress()    killerIp = killer.getClient().getConnection().getSocket().getInetAddress()    if killerIp == victimIp:        killer.sendMessage("The drop system does not work on players with the same IP")        victim.sendMessage("The drop system does not work on players with the same IP")        return    if not victimLevel in range((killerLevel - 5),(killerLevel + 5)):        killer.sendMessage("Your level is too high to get a reward")        return    killerName = killer.getName()    if killerName in self.exploitProtect[victim]:        aa = 0        bb = 0        for newName in range(len(self.exploitProtect[victim])):            if self.exploitProtect[victim][newName] == killerName:                aa += 1                if self.exploitProtectTime[victim][newName] in range((timeNow - 20000),(timeNow + 20000)):                    killer.sendMessage("You cannot kill the same player so soon to get another reward")                    bb += 1        if bb > 1:            killer.setInJail(1,10)            killer.sendMessage("EXPLOIT PROTECTION SYSTEM")            killer.sendMessage("You are being sent to jail for 10 minutes for trying to cheat.")        if aa >= 1:            return    self.exploitProtect[victim].append(killerName)    self.exploitProtectTime[victim].append(timeNow)    StrongVictimBonus = 0    victimPvp,victimPk = victim.getPvpKills(),victim.getPkKills()    TotalVictimKills = victimPvp + victimPk    if TotalVictimKills > 200:        if TotalVictimKills > 2000:            TotalVictimKills = 2000        StrongVictimBonus = (TotalVictimKills - 200) / 5     rrLifeStones = Rnd.get(len(LifeStones))    Rew2Id = LifeStones[rrLifeStones] #High and top grades, levels 80 and 82    Rew2Chance = 3    BaseReward1 = 1    ChanceDrop = Rnd.get(100)    if ChanceDrop < Rew2Chance:        st2.giveItems(Rew2Id,BaseReward1)     Rew2Id = 4358 #paagrio    Rew2Chance = 20    BaseReward1 = 1    ChanceDrop = Rnd.get(100)    if ChanceDrop < Rew2Chance:        st2.giveItems(Rew2Id,BaseReward1)     Rew1Id = 57 #adena    Rew1Chance = 100    Rew1Min,Rew1Max = 65000,110000    BaseReward1 = Rew1Min + Rnd.get(((Rew1Max - Rew1Min) + 1))    if TotalVictimKills > 200:        BaseReward1 = int(BaseReward1 + (BaseReward1 * (StrongVictimBonus / 100)))    ChanceDrop = Rnd.get(100)    if ChanceDrop < Rew1Chance:        st2.giveItems(Rew1Id,BaseReward1)     Rew2Chance = 100 #SP    Rew2Min,Rew2Max = 70000,140000    BaseReward1 = Rew2Min + Rnd.get(((Rew2Max - Rew2Min) + 1))    if TotalVictimKills > 200:        BaseReward1 = int(BaseReward1 + (BaseReward1 * (StrongVictimBonus / 100)))    ChanceDrop = Rnd.get(100)    if ChanceDrop < Rew2Chance:        curSp = killer.getSp()        newSp = curSp + BaseReward1        if newSp > 2147000000:            newSp == 2147000000        killer.setSp(newSp)        killer.sendMessage("Your SP has increased by " + str(BaseReward1))        killer.broadcastUserInfo()    if killer.getClan():        killerClan = killer.getClan()        clanRep = killerClan.getReputationScore()        newRep = clanRep + ClanRepBonus        killerClan.setReputationScore(newRep,True)        killerClan.broadcastToOnlineMembers(PledgeShowInfoUpdate(killerClan))        killer.sendMessage("Gained: " + str(ClanRepBonus) + " Clan Reputation Points.")   QUEST       = PvpRewards(-1,"PvpRewards","ai")  print "Player Kill(PvP/PK) Rewards System - ONLINE"
it had write me an error in console on the start:

Code: Select all

C:\server\L2Server\data\scripts\ai\PvpRewards\PvpRewards.pyTraceback (innermost last):  File "PvpRewards.py", line 50, in onAdvEventAttributeError: 'NoneType' object has no attribute 'getName'
and someone told me that:
"you call
self.startQuestTimer("playerCheck",2000,None,None,True)
player is None so when you trying to read it it fails"
and he told me to change some values i thing only the "payer" to "i" :

Code: Select all

     if "playerCheck" in event:         playerList = L2World.getInstance().getAllPlayers().values()         for i in playerList:             st1 = i.getQuestState("PvpRewards")             if not st1:                 st1 = self.newQuestState(i)             if not i in self.PvpPlayers:                 if not i.getName() in self.permList:                     self.permList.append(i.getName())                     self.exploitProtect[i] = []                     self.exploitProtectTime[i] = []                 st1.addNotifyOfDeath(st1.getPlayer())                 self.PvpPlayers.append(i)         for j in self.PvpPlayers:             if not j in playerList:                 self.PvpPlayers.remove(j)
After that i change the values the error in line 50 stops to apear and i got another errors:

Code: Select all

C:\server\L2Server\data\scripts\ai\PvpRewards\PvpRewards.pyTraceback (innermost last):  File "PvpRewards.py", line 53, in onAdvEventAttributeError: 'instance' object has no attribute 'exploitProtectTime'And this one:C:\server\L2Server\data\scripts\ai\PvpRewards\PvpRewards.pyTraceback (innermost last):  File "PvpRewards.py", line 68, in onDeathAttributeError: getQuestState
and he told me this:
"1.
you must define exploitProtectTime in __init__

2.
you must check if was killed by player and not by mob."

Im realy dont get what he means and try to do some thing my own i have added a line:
self.exploitProtectTime = []
Under the line:
self.exploitProtect = []

And after that the console stops to show me errors when im start the game and log in with an char.
And the script work with the reward it give adena sp and one item for every pvp and show messages like "you cannot get reward if you kill char with the same ip" and etc.
But... when im die (or whatever char) from and npc and not a from player i get this error in console:

Code: Select all

C:\server\L2Server\data\scripts\ai\PvpRewards\PvpRewards.pyTraceback (innermost last):  File "PvpRewards.py", line 69, in onDeathAttributeError: getQuestState
And if i kill the same char twice it must to show me a message: "You cannot kill the same player so soon to get another reward" but it not show the message and i get another one error:

Code: Select all

C:\server\L2Server\data\scripts\ai\PvpRewards\PvpRewards.pyTraceback (innermost last):  File "PvpRewards.py", line 86, in onDeathTypeError: range(): 1st arg can't be coerced to int
In my case the line 86 is:
if self.exploitProtectTime[victim][newName] in range((timeNow - 20000),(timeNow + 20000)):

Help me please i have stuck in these 2 errors and the onter work fine please help me.
Post Reply