Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: Chezor on September 06, 2008, 06:45:16 pm

Title: Distance-PM
Post by: Chezor on September 06, 2008, 06:45:16 pm
I need help with scripting the following:
If i want to script.

Chezor: /c eat
All others who are near me by distance 5, will only get a PM. Suppose 1 and 2 are players. Then 1 is standing close to my by distance 5 and 2 is standing away from me. So 1 will only get the pm saying i m eating food. And 2 will not get the pm.
PM to 1: Chezor is eating food

got it ?.. but i dont know how to make it. I tried several times...


Title: Re: Distance-PM
Post by: Intruder on September 06, 2008, 09:07:22 pm
basically like local chat so only ppl near you can see what ya writen?
Title: Re: Distance-PM
Post by: Chezor on September 07, 2008, 06:50:12 am
yes
Title: Re: Distance-PM
Post by: thijn on September 07, 2008, 12:51:28 pm
I tried several times...
What code?
Title: Re: Distance-PM
Post by: Chezor on September 07, 2008, 03:34:14 pm
I tried several times...
What code?

I tried the following..

Code: [Select]
on *:SIGNAL:vcmp.command2:{
  var %id = $1
  var %name = $vcmp.name($1)
if ($2 == l) {
    var %b = $vcmp.getid($1)
    var %c = $vcmp.distince(%id,%b)
if ($3 == $null) vcmp.msg %id Please enter text, Cmd: /c l [Text]
elseif (%c <= 6) vcmp.msg %b >>localchat - %name says $3
}
}

thats only 1 example :/ i tried experimenting various codes however i was not successful so you thought its now better that i could get some tips from you guys.
Title: Re: Distance-PM
Post by: thijn on September 07, 2008, 09:04:18 pm
try something like:
Code: [Select]
if ($2 == l) {
var %b = 0
if ($3 == $null) vcmp.msg %id Please enter text, Cmd: /c l [Text]
else {
while (%b <= 50) {
if ($vcmp.distance(%id,%b) <= 5) {
vcmp.msg %b Localchat - %name says: $3-
}
}
}
}
Title: Re: Distance-PM
Post by: szostol on September 07, 2008, 10:56:34 pm
And what's distance alias?
Title: Re: Distance-PM
Post by: Chezor on September 08, 2008, 07:34:12 am
try something like:
Code: [Select]
if ($2 == l) {
var %b = 0
if ($3 == $null) vcmp.msg %id Please enter text, Cmd: /c l [Text]
else {
while (%b <= 50) {
if ($vcmp.distance(%id,%b) <= 5) {
vcmp.msg %b Localchat - %name says: $3-
}
}
}
}

that code is crashing my mIRC. when i go ingame and use /c l text
It turns mIRC to non responding program.

And what's distance alias?

its this..
Code: [Select]
alias vcmp.distince {
  var %id1 = $1
  var %id2 = $2
  var %x = $abs($calc($vcmp.location(%id1,x) - $vcmp.location(%id2,x)))
  var %y = $abs($calc($vcmp.location(%id1,y) - $vcmp.location(%id2,y)))
  var %z = $abs($calc($vcmp.location(%id1,z) - $vcmp.location(%id2,z)))
  !return $round($calc($calc(%x + %y + %z) / 2),1)
}
Title: Re: Distance-PM
Post by: Force on September 08, 2008, 06:10:19 pm
try something like:
Code: [Select]
if ($2 == l) {
var %b = 0
if ($3 == $null) vcmp.msg %id Please enter text, Cmd: /c l [Text]
else {
while (%b <= 50) {
if ($vcmp.distance(%id,%b) <= 5) {
vcmp.msg %b Localchat - %name says: $3-
}
}
}
}

that code is crashing my mIRC. when i go ingame and use /c l text
It turns mIRC to non responding program.


I can immediately see why, he hasn't put an !inc %b in, the revised script should look something like:

Code: [Select]
if ($2 == l) {
  var %b = 0
  if ($3 == $null) vcmp.msg %id Please enter text, Cmd: /c l [Text]
  else {
    while (%b <= 50) {
      if ($vcmp.distance(%id,%b) <= 5) {
        vcmp.msg %b Localchat - %name says: $3-
      }
      !inc %b
    }
  }
}
Title: Re: Distance-PM
Post by: Chezor on September 08, 2008, 07:17:40 pm
oh what a fool i am, i didnt see that..  ;D
Title: Re: Distance-PM
Post by: thijn on September 08, 2008, 09:56:39 pm
Acctually i forgot it ;D :D
Anyways does it works now?
Title: Re: Distance-PM
Post by: Chezor on September 09, 2008, 11:15:17 am
Acctually i forgot it ;D :D
Anyways does it works now?
yep