Vice City Multiplayer
VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: szostol 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.
-
And one more question:
How can I send message to all palyers in one moment?
-
Just use a simple loop 8)
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.
-
I've modified it a bit and it works.
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.
-
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.
-
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:
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
-
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).
-
ask rulk
-
yea rulk showed me how to use hash tables! rulk rules!
-
My idead doesn't work I dunno why...
Do you guys have rulk's msn?
-
Yeah! I've done it myself! Ok topic can be locked.
-
U can lock it by urself, click on "Lock Topic" in the left corner ;)