• Welcome to Vice City Multiplayer.
 

[help]Can some1 give Spidometer code?

Started by hinto, January 12, 2009, 11:44:27 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hinto

Can someone give me a Spidometer code for server ?

thijn




youlikethaaaat

#3
Quote from: thijn on January 12, 2009, 04:36:51 PM
U mean like in NoN :o
lol.. =RM= done it originally, justy we give the user the choice to have it on and what unit to use with the !speedo command

dont know why NoN copy my scripts -_-

heres how we've done it:
1) have a timer launching a while loop every second
2) the while loop calculates the distance between the current loc and the loc from previous loop
3) the loc is in mps, so we use a few basic formulas to convert to things such as mp/h and kmph
4) does an announcement to each player if they have it enabled, using the unit they have chose (mps/mph/kmph)
4) then stores the loc

VRocker

Depending what base script you are using, this is fairly easy...

Any script based on my dll will give you access to vcmp.speed. This does all the calculations for you and returns in meters per second. This is easily converted to mph or kmh.

Simplest way is just to throw it on a timer every second or so to check and update the players speed.


thijn

Or just use ur great vcmp.player.move signal, And check in that signal, if the player is in a vehicel ;D


Zack

Quote from: rulk on February 07, 2009, 09:38:41 AM
Like Thijn said, their is a much simpler way to accomplish this.

Anyone using Vrockers new DLL (advised) has the ability to use the player.move signal.

Here is a cut down version mine.

Note: I have removed most checks relevant to my server, including, spawn checking, Killed in vehicle checking and a few others.

It is probably best if you add these in, for those wary of timers, all can be accomplished without using one.

Nether the less, here is what people want, a speedometer at the bottom of the display in an announce.

http://www.vcmp-toolz.co.nr/speedo.zip

Kind Regards

Luke Rudge

I want too a speedometer, but where did i have to add that script?
I have my own Hamachi server.
I am not allowed to portforward.

Tamas

Add it under:
on *:SIGNAL:vcmp.player.move:{

Zack

Quote from: [SRS]Tomi on February 09, 2009, 07:32:55 PM
Add it under:
on *:SIGNAL:vcmp.player.move:{
Sorry, but where can i find that then?
I have my own Hamachi server.
I am not allowed to portforward.

thijn

Sorry, This script is only for the new DLL, And you use the old DLL, So this wont work for you :-\


Zack

Quote from: thijn on February 10, 2009, 08:52:48 PM
Sorry, This script is only for the new DLL, And you use the old DLL, So this wont work for you :-\

Can i upgrade to a new DLL?
I have my own Hamachi server.
I am not allowed to portforward.

thijn

Yes, You can, But you need to rescript all things :'(


[AoD]NC

#12
I modified the sample script from rulk, it took an hour to do this. Well it works good.

on *:SIGNAL:vcmp.player.move:{
  if ($vcmp.vehicle($1, $2) > 0) {
    if ($vcmp.speed($1, $2) > 10) {
    vcmp.announce $1 $2                    ~o~ $round($calc($vcmp.speed($1, $2) * 3.1), 0) ~x~ kmh $chr(10)  $chr(10)
    }
  }
  else {
  }
  !.signal vcmp.playermove $1-
}


Where  is a special letter, that ur web-browser doesn't display ;p.

The original convert from MPS [?] to KMH => MPS * 3,6 = speed in KMH. I don't used 3,6, only 3,1. I even don't think, that a PCJ can have more than 200 KMH speed :D so i changed it.

I know, this script made by me is not 100% correctly ;) but
* it's only displaying if the player is sitting in a car [vehicle]
* and it's displaying only, if the player is driving faster than 30 km/h. I made this so, cause while a player enter a car, i made a announce, which displays the car health.

For all those, who hasn't a move signal: u can simply add them :). I'm using and modifying FBS, i haven't a MOVE signal there, but i created it and it works :).

Ah and my good question :D : i gotta a 1MBps internet connection. I don't think it's a slow connection, but the speedometer for 1 person is a long combination of commands... Will it lag  :P ?

[XT]ariel[X]

Clic in image from enter in my web :D