Akselj Posted November 23, 2008 Author Share Posted November 23, 2008 I have an problem with an script I wrote; I want it to add an value if player is 50+ add 50 if level is 100 then 50 for lvl 50 and 50 for lvl 100 will be added and so on. This script is not complete, I just wonder why the putvar command on ifgetplayerlvl does not work.```Sub OnPVPDeath(Attacker, Victim) Call GiveCurrency(Attacker, 4, & GetVar("bounty.ini",GetPlayerName(Victim), "Bounty")) Call GlobalMsg(GetPlayerName(Victim) & " has been killed by " & GetPlayerName(Attacker), BRIGHTRED) Call PutVar("bounty.ini",GetPlayerName(Victim), "Bounty", "0") If GetPlayerLevel(Victim) >1999 then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", +"500" End If If GetPlayerLevel(Victim) >1499 then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", +"500" End If If GetPlayerLevel(Victim) >999 then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", +"250" End If If GetPlayerLevel(Victim) >749 then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", +"250" End If If GetPlayerLevel(Victim) >499 then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", +"250" End If If GetPlayerLevel(Victim) >249 then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", +"150" End If If GetPlayerLevel(Victim) >99 then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", +"50" End If If GetPlayerLevel(Victim) >49 then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", +"50" End IfEnd Sub```Any help would be appreciated.Thanks,AkselJ Link to comment Share on other sites More sharing options...
zade_o Posted November 24, 2008 Share Posted November 24, 2008 because the putvar command you're using makes absolutely no sense.This is how I would do it. Keep in mind idk if you want it to say +500 or you want to add 500…```Dim aa=GetVar("bounty.ini","" & GetPlayerName(Attacker),"Bounty")Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & a + 50)```or something like that. basicallly you can't have the + before the "50" and I'm not 100% sure if youc an just put GetPlayerName(Attacker) straight in there without a "" &. I do the "" & just to be sure. Link to comment Share on other sites More sharing options...
Akselj Posted November 24, 2008 Author Share Posted November 24, 2008 K thanx Ghost. This is one of my first scripts, and I really didn't understand how dim's work. Never thought I would use it. But you have proved me wrong… :PEDIT: Just tested it, still nothing comes into bounty.ini... Oh and I want it to add bounty, does that work if theres nothing there at all? Here's what my script looks like now: (I changed a to bounty)```Sub OnPVPDeath(Attacker, Victim) Call GiveCurrency(Attacker, 4, & GetVar("bounty.ini",GetPlayerName(Victim), "Bounty")) Call GlobalMsg(GetPlayerName(Victim) & " has been killed by " & GetPlayerName(Attacker), BRIGHTRED) Call PutVar("bounty.ini",GetPlayerName(Victim), "Bounty", "0") If GetPlayerLevel(Victim) >1999 then Dim bounty bounty=GetVar("bounty.ini","" & GetPlayerName(Attacker),"Bounty") Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 500) End If If GetPlayerLevel(Victim) >1499 then Dim bounty bounty=GetVar("bounty.ini","" & GetPlayerName(Attacker),"Bounty") Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 500) End If If GetPlayerLevel(Victim) >999 then Dim bounty bounty=GetVar("bounty.ini","" & GetPlayerName(Attacker),"Bounty") Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 500) End If If GetPlayerLevel(Victim) >749 then Dim bounty bounty=GetVar("bounty.ini","" & GetPlayerName(Attacker),"Bounty") Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 250) End If If GetPlayerLevel(Victim) >499 then Dim bounty bounty=GetVar("bounty.ini","" & GetPlayerName(Attacker),"Bounty") Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 250) End If If GetPlayerLevel(Victim) >249 then Dim bounty bounty=GetVar("bounty.ini","" & GetPlayerName(Attacker),"Bounty") Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 150) End If If GetPlayerLevel(Victim) >99 then Dim bounty bounty=GetVar("bounty.ini","" & GetPlayerName(Attacker),"Bounty") Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 50) End If If GetPlayerLevel(Victim) >49 then Dim bounty bounty=GetVar("bounty.ini","" & GetPlayerName(Attacker),"Bounty") Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 50) End If Call GobalMsg(GetPlayerName(attacker) & " has" &Getvar("bounty.ini",GetPlayerName(attacker),"Bounty") & " bounty"End Sub``` Link to comment Share on other sites More sharing options...
zade_o Posted November 24, 2008 Share Posted November 24, 2008 Okk…ummmm is bounty.ini in your server directory? Cus if it's in server->scripts then it should be```Call PutVar("scripts\bounty.ini", ""&GetPlayerName(Attacker),"Bounty", "" & bounty+50)``` Link to comment Share on other sites More sharing options...
Akselj Posted November 24, 2008 Author Share Posted November 24, 2008 It is in server, it created itself. Link to comment Share on other sites More sharing options...
zade_o Posted November 24, 2008 Share Posted November 24, 2008 Alright…umm...Try only dimming bounty once. Get rid of all the "Dim bounty"s in the if statements and put one Dim bounty as the first line of the sub. see if that works? Link to comment Share on other sites More sharing options...
Akselj Posted November 24, 2008 Author Share Posted November 24, 2008 Okay.. Still doesen't work :sad:Now my script is like this: (aslo removed bounty=, didn't work then either)```Sub OnPVPDeath(Attacker, Victim) Dim bounty bounty=GetVar("bounty.ini","" & GetPlayerName(Attacker),"Bounty") Call GiveCurrency(Attacker, 4, & GetVar("bounty.ini",GetPlayerName(Victim), "Bounty")) Call GlobalMsg(GetPlayerName(Victim) & " has been killed by " & GetPlayerName(Attacker), BRIGHTRED) Call PutVar("bounty.ini",GetPlayerName(Victim), "Bounty", "0") If GetPlayerLevel(Victim) >1999 then Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 500) End If If GetPlayerLevel(Victim) >1499 then Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 500) End If If GetPlayerLevel(Victim) >999 then Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 500) End If If GetPlayerLevel(Victim) >749 then Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 250) End If If GetPlayerLevel(Victim) >499 then Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 250) End If If GetPlayerLevel(Victim) >249 then Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 150) End If If GetPlayerLevel(Victim) >99 then Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 50) End If If GetPlayerLevel(Victim) >49 then Call PutVar("bounty.ini",""&GetPlayerName(Attacker),"Bounty","" & bounty + 50) End If Call GlobalMsg(GetPlayerName(attacker) & " has" &Getvar("bounty.ini",GetPlayerName(attacker),"Bounty") & " bounty"End Sub```Sometimes I wonder why I had to make my own script… :P Link to comment Share on other sites More sharing options...
zade_o Posted November 24, 2008 Share Posted November 24, 2008 Oh many this is really starting to stump me….. Could be that the bottom GlobalMsg is spelled wrong? You have Gobal not Global?... Try that. Link to comment Share on other sites More sharing options...
Akselj Posted November 24, 2008 Author Share Posted November 24, 2008 So that's why it never showed up…EDIT: Nope nothing... Link to comment Share on other sites More sharing options...
zade_o Posted November 24, 2008 Share Posted November 24, 2008 God dayum! lol…. ummm comment out the currency statement just for debugging and see if it works without it. Link to comment Share on other sites More sharing options...
Akselj Posted November 24, 2008 Author Share Posted November 24, 2008 Script updated: (Godlord gave me an new PutVar command, but didn't have more time)```Sub OnPVPDeath(Attacker, Victim) Dim bounty bounty=GetVar("bounty.ini","" & GetPlayerName(Attacker),"Bounty") Call GiveCurrency(Attacker, 4, & GetVar("bounty.ini",GetPlayerName(Victim), "Bounty")) Call GlobalMsg(GetPlayerName(Victim) & " has been killed by " & GetPlayerName(Attacker), BRIGHTRED) Call PutVar("bounty.ini",GetPlayerName(Victim), "Bounty", "0") If GetPlayerLevel(Victim) >1999 then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty)) + 5000)) End If If GetPlayerLevel(Victim) >1499 then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty)) + 5000)) End If If GetPlayerLevel(Victim) >999 then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty)) + 5000)) End If If GetPlayerLevel(Victim) >749 then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty)) + 2500)) End If If GetPlayerLevel(Victim) >499 then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty)) + 2500)) End If If GetPlayerLevel(Victim) >249 then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty)) + 1500)) End If If GetPlayerLevel(Victim) >99 then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty)) + 500)) End If If GetPlayerLevel(Victim) >49 then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty)) + 500)) End If Call GlobalMsg(GetPlayerName(attacker) & " has" &Getvar("bounty.ini",GetPlayerName(attacker),"Bounty") & " bounty"End Sub```Still does not work… I'll try removing Call GiveCurrency.EDIT: Nope, does not work now either... Link to comment Share on other sites More sharing options...
zade_o Posted November 24, 2008 Share Posted November 24, 2008 Omg this has me stumped… Link to comment Share on other sites More sharing options...
Akselj Posted November 24, 2008 Author Share Posted November 24, 2008 Yeah… This is getting really annoying... Link to comment Share on other sites More sharing options...
DarkMazer Posted November 24, 2008 Share Posted November 24, 2008 I removed all of the syntax errors, try it now:```Sub OnPVPDeath(Attacker, Victim) Dim bounty bounty=GetVar("bounty.ini","" & GetPlayerName(Attacker),"Bounty") Call GiveCurrency(Attacker, 4, GetVar("bounty.ini",GetPlayerName(Victim), "Bounty")) Call GlobalMsg(GetPlayerName(Victim) & " has been killed by " & GetPlayerName(Attacker), BRIGHTRED) Call PutVar("bounty.ini",GetPlayerName(Victim), "Bounty", "0") If GetPlayerLevel(Victim) >1999 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 5000)) End If If GetPlayerLevel(Victim) >1499 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 5000)) End If If GetPlayerLevel(Victim) >999 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 5000)) End If If GetPlayerLevel(Victim) >749 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 2500)) End If If GetPlayerLevel(Victim) >499 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 2500)) End If If GetPlayerLevel(Victim) >249 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 1500)) End If If GetPlayerLevel(Victim) >99 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 500)) End If If GetPlayerLevel(Victim) >49 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 500)) End If Call GlobalMsg(GetPlayerName(attacker) & " has" &Getvar("bounty.ini",GetPlayerName(attacker),"Bounty") & " bounty")End Sub``` Link to comment Share on other sites More sharing options...
zade_o Posted November 25, 2008 Share Posted November 25, 2008 Oh yeah, the extra "&" in the first globalmsg might have been causing it… Link to comment Share on other sites More sharing options...
DarkMazer Posted November 25, 2008 Share Posted November 25, 2008 @Gh0st:> Oh yeah, the extra "&" in the first globalmsg might have been causing it…Not to mention quite a few missing quotes… Link to comment Share on other sites More sharing options...
zade_o Posted November 25, 2008 Share Posted November 25, 2008 Ah well I don't really have the time go through and pick out that kind of stuff >.< Link to comment Share on other sites More sharing options...
Akselj Posted November 25, 2008 Author Share Posted November 25, 2008 Extra "&" in first Global Msg? Nope, it's the one that came with the basicc EE 2.7 script. But where's the missing quotes? Link to comment Share on other sites More sharing options...
DarkMazer Posted November 25, 2008 Share Posted November 25, 2008 There were a bunch of lines that said "Bounty)) + number, so there was a missing quote at the end of Bounty that probably caused a bunch of errors. And that extra & in the GiveCurrency sub was causing some problems, as well. (The one in GlobalMsg is fine) Link to comment Share on other sites More sharing options...
zade_o Posted November 25, 2008 Share Posted November 25, 2008 yeah nevermind i meant the one in givecurrency. sorry about that. Link to comment Share on other sites More sharing options...
Akselj Posted November 26, 2008 Author Share Posted November 26, 2008 I'll try fixing that, maybe it works then. Link to comment Share on other sites More sharing options...
Akselj Posted November 30, 2008 Author Share Posted November 30, 2008 Bump. Really need help, still does not work. Link to comment Share on other sites More sharing options...
balliztik1 Posted November 30, 2008 Share Posted November 30, 2008 How about this?```Sub OnPVPDeath(Attacker, Victim) Call GiveCurrency(Attacker, 4, CInt(GetVar("bounty.ini",GetPlayerName(Victim), "Bounty"))) Call GlobalMsg(GetPlayerName(Victim) & " has been killed by " & GetPlayerName(Attacker), BRIGHTRED) Call PutVar("bounty.ini", GetPlayerName(Victim), "Bounty", "0") bounty = GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty") If GetPlayerLevel(Victim) > 1999 Then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", bounty + 500) Exit Sub End If If GetPlayerLevel(Victim) > 1499 Then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", bounty + 500) Exit Sub End If If GetPlayerLevel(Victim) > 999 Then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", bounty + 250) Exit Sub End If If GetPlayerLevel(Victim) > 749 Then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", bounty + 250) Exit Sub End If If GetPlayerLevel(Victim) > 499 Then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", bounty + 250) Exit Sub End If If GetPlayerLevel(Victim) > 249 Then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", bounty + 150) Exit Sub End If If GetPlayerLevel(Victim) > 99 Then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", bounty + 50) Exit Sub End If If GetPlayerLevel(Victim) > 49 Then Call PutVar("bounty.ini",GetPlayerName(Attacker), "Bounty", bounty + 50) Exit Sub End If End Sub``` Link to comment Share on other sites More sharing options...
Akselj Posted December 1, 2008 Author Share Posted December 1, 2008 You didn't look at the other posts, did you Balliztik? Two reasons I figured that out; 1: You edited the script from my first post, updated lots of times. 2: I explained in one of the replies that I wanted the script to go through all ifs, so I guess the sub should not be exited then? I might be wrong, of course, but that is how I understand the command Exit Sub works. So you should look at the replies. But thanks anyway. I'm sure one of you Uber-scriptors will find out ;) Link to comment Share on other sites More sharing options...
zade_o Posted December 1, 2008 Share Posted December 1, 2008 ```Sub OnPVPDeath(Attacker, Victim) Dim bounty Dim reward bounty = GetVar("bounty.ini","" & GetPlayerName(Attacker),"Bounty") reward = GetVar("bounty.ini","" & GetPlayerName(Victim),"Bounty") Call GiveCurreny(Attacker,4,reward) Call GlobalMsg("" & GetPlayerName(Victim) & " has been killed by " & GetPlayerName(Attacker),12) Call PutVar("bounty.ini","" & GetPlayerName(Victim), "Bounty", "0") ''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''' Dim vlvl Dim attbounty vlvl=GetPlayerLevel(Victim) attbounty=GetVar("bounty.ini", "" & GetPlayerName(Attacker),"Bounty") If vlvl>1999 Then newbounty=newbounty+5000 End If If vlvl>1499 Then newbounty=newbounty+5000 End If If vlvl>999 Then newbounty=newbounty+5000 End If If Vlvl>749 Then newbounty=newbounty+2500 End If If vlvl>499 Then newbounty=newbounty+2500 End If If vlvl>249 Then newbounty=newbounty+1500 End If If vlvl>99 Then newbounty=newbounty+500 End If If vlvl>49 Then newbounty=newbounty+500 End If Call PutVar("bounty.ini", "" & GetPlayerName(Attacker),"Bounty", "" & newbounty) Call GlobalMsg("" & GetPlayerName(Attacker) & " has" & newbounty & " bounty.",12)End Sub```Try that. If it doesn't work, I'm 99% sure that the problem lies outside of that sub.Btw I did notice that the GlobaMsg just before the end sub didn't have a color after the text…not sure if that was it or not. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now