Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: thijn on June 29, 2008, 01:16:43 pm

Title: [RESOLVED] Speedlimit
Post by: thijn 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 .....

  }
}
Title: Re: Speedlimit
Post by: GTA-Roloboy 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...
Title: Re: Speedlimit
Post by: thijn 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 ??? ???
Title: Re: Speedlimit
Post by: AdTec_224 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!
Title: Re: Speedlimit
Post by: thijn on June 30, 2008, 10:58:17 pm
TESTED, it works
Thanks