mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2005
Posts: 30
_
_DuDe_ Offline OP
Ameglian cow
OP Offline
Ameglian cow
_
Joined: Jun 2005
Posts: 30
Ok, I am like so getting everything wrong on this script. This time I made a section that when the user types !battlefield, it will show all the users.

Code:
on *:TEXT:!battlefield*:*:{
  if ($2 != $null) {
    /msg $nick  $+ $2 $+ 's $+  Gold is: $readini( $2 $+ .ini, THINGS, gold) | /msg $nick  $+ $2 $+ 's $+  Strike is: $readini( $2 $+ .ini, THINGS, Strike) | /msg $nick  $+ $2 $+ 's $+  Defense is: $readini( $2 $+ .ini, THINGS, Defense)
  }
  if ($2 == $null) {
    /msg $nick Players: $readini( players.ini, USERS, NICKS ) 
  }
}


Please feel free to write a better version, as I can't seem to get this right. It makes me mad, because I had it all working, then I decided to make it Multi player, cause facing my self was not fun, and now I seem to have forgotten what an mIRC script is.

Please Help Me.

~_DuDe~

Joined: Jun 2005
Posts: 16
T
Pikka bird
Offline
Pikka bird
T
Joined: Jun 2005
Posts: 16
u r no noob i got lost in that script i wish i could help u but im a real noob


-tyler
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
maybe you could show the command you use to add a user?
My guess is you are replacing the nicks data with the new nick, not adding to it.

alias addnicks {
var %nicks = $readini(players.ini, users, nicks) $$1
writeini players.ini users nicks %nicks
}
useage /addnicks (nick you want to add)

removing a nick might look like this

alias remnicks {
var %nicks = $remove( $readini(players.ini, users, nicks), $$1)
writeini players.ini users nicks %nicks
}
useage /remnicks (nick you want to remove)

I did not test this, but should work

Joined: Jun 2005
Posts: 30
_
_DuDe_ Offline OP
Ameglian cow
OP Offline
Ameglian cow
_
Joined: Jun 2005
Posts: 30
I have it on creation of a user account, | writeini players.ini USERS NICKS $2 | is one of the things it does.

That section of the script is as follows.

Code:
on *:TEXT:!create*:*:{
  if ( $2- == $null ) { /msg $nick To create an account please type !create <nick> <pass> }
  if ( $2 == $null ) && ( $3- != $null ) { /msg $nick Please enter a valid nickname }
  if ( $2 != $null ) && ( $3- == $null ) { /msg $nick Please enter a valid password }
  if ( $2- != $null ) { writeini players.ini USERS NICKS $2 | writeini $nick $+ .ini NICK USER $2 | writeini $nick $+ .ini NICK PASS $3- | writeini $nick $+ .ini THINGS GOLD 10000 | writeini $nick $+ .ini THINGS UP 1 | writeini $nick $+ .ini THINGS SA 0 | writeini $nick $+ .ini THINGS DA 0 | writeini $nick $+ .ini THINGS strike 1000 | writeini $nick $+ .ini THINGS defense 1000 | writeini $nick $+ .ini THINGS soldiers 10 | writeini $nick $+ .ini THINGS excalibur 0 | writeini $nick $+ .ini THINGS dragonskin 0 | writeini $nick $+ .ini THINGS shield 0 | writeini $nick $+ .ini THINGS sword 0 | /msg $nick Your registration was sucessfull. }
}

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
writeini players.ini USERS NICKS $2
that would overwrite whatever nick was in the ini, right?
/run notepad players.ini
take a look

Joined: Jun 2005
Posts: 30
_
_DuDe_ Offline OP
Ameglian cow
OP Offline
Ameglian cow
_
Joined: Jun 2005
Posts: 30
Lmao, yes it is. OoPs.

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
k, just for fun add this alias
Code:
alias addnicks {
var %nicks = $readini(players.ini, users, nicks) $$1
writeini players.ini users nicks %nicks
}
; change the add line you have now to use the alias:

if ( $2- != $null ) { [color:red]addnicks[/color] $2 | writeini $nick $+ .ini NICK USER $2 | writeini $nick $+ .ini NICK PASS $3- | writeini $nick $+ .ini THINGS GOLD 10000 | writeini $nick $+ .ini THINGS UP 1 | writeini $nick $+ .ini THINGS SA 0 | writeini $nick $+ .ini THINGS DA 0 | writeini $nick $+ .ini THINGS strike 1000 | writeini $nick $+ .ini THINGS defense 1000 | writeini $nick $+ .ini THINGS soldiers 10 | writeini $nick $+ .ini THINGS excalibur 0 | writeini $nick $+ .ini THINGS dragonskin 0 | writeini $nick $+ .ini THINGS shield 0 | writeini $nick $+ .ini THINGS sword 0 | /msg $nick Your registration was sucessfull. }

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
writeini players.ini USERS NICKS $2


Shouldnt this be
writeini players.ini USERS NICKS $nick
????

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Quote:
removing a nick might look like this

alias remnicks {
var %nicks = $remove( $readini(players.ini, users, nicks), $$1)
writeini players.ini users nicks %nicks
}
useage /remnicks (nick you want to remove)


That's not a brilliant way of doing it because if "MikeChat" and "Mike" were both in the nickname list and you wanted to remove "Mike", "MikeChat" would be changed to just "Chat"

I'd use something like this:

Code:
alias addnick { writeini players.ini users nicks $addtok($readini(players.ini,users,nicks),$?1="Who would you like to add?",32) }
alias remnick { writeini players.ini users nicks $remtok($readini(players.ini,users,nicks),$?1="Who would you like to remove?",1,32) }


New username: hixxy
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Quote:

Shouldnt this be
writeini players.ini USERS NICKS $nick


didnt he have the nick as a required parameter?
if ( $2- == $null ) { /msg $nick To create an account please type !create <nick> <pass> }

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
Quote:

That's not a brilliant way of doing it because if "MikeChat" and "Mike" were both in the nickname list and you wanted to remove "Mike", "MikeChat" would be changed to just "Chat"


you are right, also he has <password> going in the add section and I didn't look to see where that is handled.

In any case the adding of nicks to the ini was overwriting whatever was there before and I hope all of this has steered him on to working that part out.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
didnt he have the nick as a required parameter?
if ( $2- == $null ) { /msg $nick To create an account please type !create <nick> <pass> }


I asked becuase after "meaning to add" $2 as the nick to the list of nicks he then does these writeini $nick $+ .ini , so i assummed he would be using $2 $+ .ini

Maybe im wrong, thats why i asked?

Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
oh, well I was just thinking of the art that wasn't working


Link Copied to Clipboard