Author Topic: Writing ini in one line + 1 new question  (Read 5114 times)

0 Members and 2 Guests are viewing this topic.

szostol

  • Guest
Writing ini in one line + 1 new question
« on: August 16, 2008, 12:56:07 pm »
Guys, I have some problem. I hadn't got !mycars command and yesterday I tried to make it. I thought it's working per 100% but there's some problem...

It shows only car wich was bought last time... I need to know how can I make that script writes texts in one line. If you don't understand:

!buycar

(file)

szostol=141 Infernus

!mycars

Your vehicles: 141 Infernus

!buycar

(file)

szostol=141 Infernus
szostol=129 Marquis


!mycars

Your vehicles 129 Marquis

When I added myself in ini file

szostol=141 Infernus 129 Marquis


!mycars

Your vehicles: 141 Infernus 129 Marquis


PS:

I'm basing on gus.
« Last Edit: August 16, 2008, 06:28:11 pm by szostol »

szostol

  • Guest
Re: Writing ini in one line
« Reply #1 on: August 16, 2008, 06:27:57 pm »
And one more question:

How can I send message to all palyers in one moment?

Offline Force

  • LU Developer
  • Made Man
  • *
  • Posts: 242
    • View Profile
Re: Writing ini in one line + 1 new question
« Reply #2 on: August 16, 2008, 08:46:47 pm »
Just use a simple loop  8)

Code: [Select]
elseif ($2 == annall) {
  if (!$3-) vcmp.msg %id Missing Information /c $2 <Message>
  else {
    var %a = 0
    while (%a <= 50) {
      vcmp.announce %a $3-
      !inc %a
    }
    vcmp.msg %id Announcement $3- has been sent to all players
  }
}

Hope that help's, if mIRC crashes then its my fault :x, just remove it and let me know that mIRC crashed.

szostol

  • Guest
Re: Writing ini in one line + 1 new question
« Reply #3 on: August 16, 2008, 09:26:07 pm »
I've modified it a bit and it works.

Quote
  if ($2 == annall) {
  if ($vcmp.cmdcheck(!annall,%id) == fail) !halt
  if (!$3-) vcmp.msg %id Invalid command usage
  else {
    var %a = 0
    while (%a <= 50) {
      vcmp.announce %a $3-
      !inc %a
    }
    vcmp.msg %id You have sent announce to all players
  }
}

It works per 100%


How can I send it to players who's nicks are written in ini file? And do you have any idea about mycars? Anyway thank you very much for it.

Offline Force

  • LU Developer
  • Made Man
  • *
  • Posts: 242
    • View Profile
Re: Writing ini in one line + 1 new question
« Reply #4 on: August 16, 2008, 10:28:08 pm »
Nope, ini files will overwrite something that they find so if u had bob=test in an ini and you told it to write bob=yay in the same one it would overwrite bob=test.

Offline VRocker

  • LU Developer
  • Wiseguy
  • *
  • Posts: 63
    • View Profile
    • Liberty Unleashed - GTA3 Multiplayer Mod
Re: Writing ini in one line + 1 new question
« Reply #5 on: August 17, 2008, 12:21:51 am »
Just knocked up a quick script which will do this for you :)
Its been optimised for speed so it may look a tad complicated but its really easy :)

Heres the script:

Code: [Select]
alias CalcOwnedCars {
  var %a = 1, %b, %id = 0
  var %name = $vcmp.name(%a)

  while ( %a < $ini( CarOwners.ini, CarOwners, 0 ) ) {
    %id = $ini( CarOwners.ini, CarOwners, %a )
    if ( %id ) {
      if ( $readini( CarOwners.ini, CarOwners, %id ) == %name ) {

        ; You may want to modify the %id bit below for vehicle names
        if ( %b ) %b = %b $+ , %id
        else %b = %id
      }
    }
    !inc %a
  }

  writeini "CarOwners.ini" ReadableCarOwners %name %b
}

on *:SIGNAL:vcmp.command:{
  var %name = $left($1,-1)
  var %id = $vcmp.getid(%name)
  var %a = $iif($3,$iif($3 !isnum,$iif($vcmp.getid($3) != Unknown,$v1,-1),$iif($vcmp.name($3) != Unknown,$3,-1)),%id)

  if ( $2 == !buycar ) {

    ; DO YOUR FUNKY BUYCAR STUFF HERE

    var %vehicleid = $vcmp.vehicle(%a,id)
    ; Lets store it in an internal format. This will be used for calculating other stuff aswell as selling
    writeini "carowners.ini" CarOwners %vehicleid %name

    CalcOwnedCars %id

  }
  elseif ( $2 == !sellcar ) {

    ; DO YOUR SELL CAR STUFF HERE!

    var %vehicleid = $vcmp.vehicle(%a,id)
    ; Lets store it in an internal format. This will be used for calculating other stuff aswell as selling
    remini "carowners.ini" CarOwners %vehicleid

    CalcOwnedCars %id
  }

  elseif ( $2 == !mycars ) {

    ; DO SOME CHECKING N OTHER FUNKEH STUFF

    ; NOTE - The next line will only output owned vehicle ID's, change it to add names
    ; NOTE 2 - To change it for names, modify the CalcOwnedCars alias!
    vcmp.msg %id Your Vehicles: $readini( CarOwners.ini, ReadableCarOwners, %name )

  }
}

Although its not been tested... it should work fine. Lemme know if it doesn't work


szostol

  • Guest
Re: Writing ini in one line + 1 new question
« Reply #6 on: August 17, 2008, 01:26:34 am »
Hymm... doesn't work for me... maybe it's wrong... maybe I don't understand (probably)... anyway doesn't work.

Your vehicles:

and thats it...

EDIT:

Mkay, I invated how to make it myself but now players will be able to have only 2 vehicles (they could have 3).
« Last Edit: August 17, 2008, 12:20:32 pm by szostol »

Offline bazza

  • Street Thug
  • *
  • Posts: 18
    • View Profile
Re: Writing ini in one line + 1 new question
« Reply #7 on: August 17, 2008, 06:15:39 pm »
ask rulk

Offline K.I.S.S

  • Street Thug
  • *
  • Posts: 16
    • View Profile
Re: Writing ini in one line + 1 new question
« Reply #8 on: August 17, 2008, 07:50:44 pm »
yea rulk showed me how to use hash tables! rulk rules!

szostol

  • Guest
Re: Writing ini in one line + 1 new question
« Reply #9 on: August 17, 2008, 08:06:19 pm »
My idead doesn't work I dunno why...

Do you guys have rulk's msn?

szostol

  • Guest
Re: Writing ini in one line + 1 new question
« Reply #10 on: August 18, 2008, 12:42:21 pm »
Yeah! I've done it myself! Ok topic can be locked.

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: Writing ini in one line + 1 new question
« Reply #11 on: August 18, 2008, 06:39:54 pm »
U can lock it by urself, click on "Lock Topic" in the left corner ;)