Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: Tamas on November 19, 2008, 06:58:25 pm

Title: Counting
Post by: Tamas on November 19, 2008, 06:58:25 pm
Somebody knows how can i count a specific name value inside the ini file?
For example if the ini file containes 200 names and i want to count only the xy* name, than return the total value of that names.
Title: Re: Counting
Post by: Mex on November 21, 2008, 01:38:37 am
try this

Code: [Select]
var %a = 1, %b = $ini(filename.ini,section,0), %c = 0
while (%a <= %b) {
  if (xy* iswm $ini(filename.ini,section,%a)) { !inc %c }
  !inc %a
}
!echo -a total items in section that match xy*: %c

[edit]
the above code is for if the ini layout is like:
[section]
xy1=value
xy2=value
xy3=value
etc

if your ini layout is like:
[section]
item=xy1
item2=xy2
item3=xy3

then try this:
Code: [Select]
var %a = 1, %b = $ini(filename.ini,section,0), %c, %d = 0
while (%a <= %b) {
  %c = $ini(filename.ini,section,%a)
  if (xy* iswm $readini(filename.ini,n,section,%c)) { !inc %d }
  !inc %a
}
!echo -a total values in section that match xy*: %d