Author Topic: [RESOLVED] Speedlimit  (Read 3439 times)

0 Members and 1 Guest are viewing this topic.

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
[RESOLVED] Speedlimit
« on: June 29, 2008, 01:16:43 pm »
How can i make a command that checks the speed, and if the speed is over 220 then he autowarn the user. I thought that i can use !speed to calculate the speed, but i dont know i i can check if the speed is over 220.
Can someone help me?

Alias:
Quote
alias vcmp.speed {
  var %x = $vcmp.location($1,x),%y = $vcmp.location($1,y),%z = $vcmp.location($1,z),%a = $calc(%x - $2),%b = $calc(%y - $3),%c = $calc(%z - $4),%d = $round($sqrt($calc(%a * %a + %b * %b + %c * %c)),2)
  vcmp.say $vcmp.name($1) - Speed: $round($calc(%d / 0.27777778),2) Kilometers Per Hour
  if $round($calc(%d / 0.27777778),2) is higher then 200 {
  vcmp.warn .....

  }
}
« Last Edit: June 30, 2008, 10:58:35 pm by thijn »

Offline GTA-Roloboy

  • Made Man
  • ***
  • Posts: 135
    • View Profile
Re: Speedlimit
« Reply #1 on: June 29, 2008, 04:33:59 pm »
Quote
alias vcmp.speed {
  var %x = $vcmp.location($1,x),%y = $vcmp.location($1,y),%z = $vcmp.location($1,z),%a = $calc(%x - $2),%b = $calc(%y - $3),%c = $calc(%z - $4),%d = $round($sqrt($calc(%a * %a + %b * %b + %c * %c)),2)
  vcmp.say $vcmp.name($1) - Speed: $round($calc(%d / 0.27777778),2) Kilometers Per Hour
  if ($round($calc(%d / 0.27777778),2) > 200) {
  vcmp.warn .....
  }
}

That should work...
« Last Edit: June 29, 2008, 04:35:34 pm by GTA-Roloboy »

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: Speedlimit
« Reply #2 on: June 29, 2008, 05:31:16 pm »
ok thank you, but when i have this code:
Quote
alias vcmp.speed {
  var %name = $vcmp.name($1)
  var %x = $vcmp.location($1,x),%y = $vcmp.location($1,y),%z = $vcmp.location($1,z),%a = $calc(%x - $2),%b = $calc(%y - $3),%c = $calc(%z - $4),%d = $round($sqrt($calc(%a * %a + %b * %b + %c * %c)),2)
  vcmp.say $vcmp.name($1) - Speed: $round($calc(%d / 0.27777778),2) Kilometers Per Hour
  if $round($calc(%d / 0.27777778),2) > 200 {
    vcmp.warn %name Server To high speed
  }
it says (when im driving to fast):Unknow - New Warns: 1/3 , Reason: to hight speed , By Admin: thijn
Why can't he know the name?
but when "unknow" have 3 warnings, i was kicked??
so he know that its me that's speeding but he dont show it ??? ???

Offline AdTec_224

  • Administrator
  • Street Thug
  • *****
  • Posts: 30
    • View Profile
Re: Speedlimit
« Reply #3 on: June 29, 2008, 05:35:09 pm »
dont think you need %name should be:

Code: [Select]
alias vcmp.speed {
  var %x = $vcmp.location($1,x),%y = $vcmp.location($1,y),%z = $vcmp.location($1,z),%a = $calc(%x - $2),%b = $calc(%y - $3),%c = $calc(%z - $4),%d = $round($sqrt($calc(%a * %a + %b * %b + %c * %c)),2)
  vcmp.say $vcmp.name($1) - Speed: $round($calc(%d / 0.27777778),2) Kilometers Per Hour
  if ($round($calc(%d / 0.27777778),2) > 200) {
    vcmp.warn $1 Server To high speed
  }
}

Note: UNTESTED!

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: Speedlimit
« Reply #4 on: June 30, 2008, 10:58:17 pm »
TESTED, it works
Thanks