Author Topic: Distance-PM  (Read 7256 times)

0 Members and 1 Guest are viewing this topic.

Offline Chezor

  • Wiseguy
  • **
  • Posts: 90
  • RPG Planet Scripter
    • View Profile
    • RPG Planet
Distance-PM
« 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...



Scripts: Fuel system in vehicles, Speedometer, Spawnback, Improved Copwork, Improved Jailing, Improved phone with sms, and many more. Coming soon..

Offline Intruder

  • Street Thug
  • *
  • Posts: 24
    • View Profile
Re: Distance-PM
« Reply #1 on: September 06, 2008, 09:07:22 pm »
basically like local chat so only ppl near you can see what ya writen?

Offline Chezor

  • Wiseguy
  • **
  • Posts: 90
  • RPG Planet Scripter
    • View Profile
    • RPG Planet
Re: Distance-PM
« Reply #2 on: September 07, 2008, 06:50:12 am »
yes

Scripts: Fuel system in vehicles, Speedometer, Spawnback, Improved Copwork, Improved Jailing, Improved phone with sms, and many more. Coming soon..

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: Distance-PM
« Reply #3 on: September 07, 2008, 12:51:28 pm »

Offline Chezor

  • Wiseguy
  • **
  • Posts: 90
  • RPG Planet Scripter
    • View Profile
    • RPG Planet
Re: Distance-PM
« Reply #4 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.

Scripts: Fuel system in vehicles, Speedometer, Spawnback, Improved Copwork, Improved Jailing, Improved phone with sms, and many more. Coming soon..

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: Distance-PM
« Reply #5 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-
}
}
}
}
« Last Edit: September 07, 2008, 09:08:01 pm by thijn »

szostol

  • Guest
Re: Distance-PM
« Reply #6 on: September 07, 2008, 10:56:34 pm »
And what's distance alias?

Offline Chezor

  • Wiseguy
  • **
  • Posts: 90
  • RPG Planet Scripter
    • View Profile
    • RPG Planet
Re: Distance-PM
« Reply #7 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)
}

Scripts: Fuel system in vehicles, Speedometer, Spawnback, Improved Copwork, Improved Jailing, Improved phone with sms, and many more. Coming soon..

Offline Force

  • LU Developer
  • Made Man
  • *
  • Posts: 242
    • View Profile
Re: Distance-PM
« Reply #8 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
    }
  }
}

Offline Chezor

  • Wiseguy
  • **
  • Posts: 90
  • RPG Planet Scripter
    • View Profile
    • RPG Planet
Re: Distance-PM
« Reply #9 on: September 08, 2008, 07:17:40 pm »
oh what a fool i am, i didnt see that..  ;D

Scripts: Fuel system in vehicles, Speedometer, Spawnback, Improved Copwork, Improved Jailing, Improved phone with sms, and many more. Coming soon..

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: Distance-PM
« Reply #10 on: September 08, 2008, 09:56:39 pm »
Acctually i forgot it ;D :D
Anyways does it works now?

Offline Chezor

  • Wiseguy
  • **
  • Posts: 90
  • RPG Planet Scripter
    • View Profile
    • RPG Planet
Re: Distance-PM
« Reply #11 on: September 09, 2008, 11:15:17 am »
Acctually i forgot it ;D :D
Anyways does it works now?
yep

Scripts: Fuel system in vehicles, Speedometer, Spawnback, Improved Copwork, Improved Jailing, Improved phone with sms, and many more. Coming soon..