mIRC Homepage
Posted By: _DuDe_ Oh my god, I feel like a n00b. - 25/06/05 12:25 AM
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~
Posted By: tyler22 Re: Oh my god, I feel like a n00b. - 25/06/05 02:52 AM
u r no noob i got lost in that script i wish i could help u but im a real noob
Posted By: MikeChat Re: Oh my god, I feel like a n00b. - 25/06/05 03:28 AM
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
Posted By: _DuDe_ Re: Oh my god, I feel like a n00b. - 25/06/05 03:55 AM
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. }
}
Posted By: MikeChat Re: Oh my god, I feel like a n00b. - 25/06/05 03:58 AM
writeini players.ini USERS NICKS $2
that would overwrite whatever nick was in the ini, right?
/run notepad players.ini
take a look
Posted By: _DuDe_ Re: Oh my god, I feel like a n00b. - 25/06/05 04:01 AM
Lmao, yes it is. OoPs.
Posted By: MikeChat Re: Oh my god, I feel like a n00b. - 25/06/05 04:24 AM
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. }
Posted By: DaveC Re: Oh my god, I feel like a n00b. - 25/06/05 08:19 AM
Quote:
writeini players.ini USERS NICKS $2


Shouldnt this be
writeini players.ini USERS NICKS $nick
????
Posted By: tidy_trax Re: Oh my god, I feel like a n00b. - 25/06/05 11:52 AM
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) }
Posted By: MikeChat Re: Oh my god, I feel like a n00b. - 25/06/05 03:24 PM
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> }
Posted By: MikeChat Re: Oh my god, I feel like a n00b. - 25/06/05 03:32 PM
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.
Posted By: DaveC Re: Oh my god, I feel like a n00b. - 26/06/05 12:24 AM
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?
Posted By: MikeChat Re: Oh my god, I feel like a n00b. - 26/06/05 01:29 AM
oh, well I was just thinking of the art that wasn't working
© mIRC Discussion Forums