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:
Although its not been tested... it should work fine. Lemme know if it doesn't work
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