View Full Version : Speedtraps
Tur8o
26th July 2009, 17:35
i dont suppose anyone knows the way to put speed traps on the track?
thanks Tur8o
Yisc[NL]
26th July 2009, 18:38
i dont suppose anyone knows the way to put speed traps on the track?
thanks Tur8o
Speedtraps are included in the default script of Lapper.
Event OnLapperStart()
RegisterNodeAction( "BL1" , 140 , DisplaySpeed );
RegisterNodeAction( "BL1R" , 245 , DisplaySpeed );
RegisterZoneAction( "BL1" , -78,200, 5 , DisplaySpeed );
EndEvent
Sub DisplaySpeed( )
PrivMsg( langEngine( "%{main_speedtrap}%" , ToPlayerUnit( GetCurrentPlayerVar( "InstantSpeed" ) ),GetCurrentPlayerVar("UnitSpeed") ) );
EndSub
Marco1
26th July 2009, 20:58
and does anybody knows hot to add a Speedtrap in C#?:shrug:
regarts heiko
Gai-Luron
26th July 2009, 22:55
Why add it in c#?
Tur8o : To know the specific node of a track go to the point you want add a speedstrap and type in lfs !node to have the current node. Then add a registernodeaction for this specific node on the current track
Tur8o
27th July 2009, 16:51
OK i will try this :D
what is the "RegisterZoneAction"
i have RegisterNodeAction( "AS3" , 248 , DisplaySpeed );
RegisterNodeAction( "AS3" , 444 , DisplaySpeed );
or should it be RegisterNodeAction( "AS3" , 248 : 444 , DisplaySpeed );
Is this Correct? Sub DisplaySpeed( )
PrivMsg( langEngine( "%{main_speedtrap}%" , ToPlayerUnit( GetCurrentPlayerVar( "InstantSpeed" ) ),GetCurrentPlayerVar("UnitSpeed") ) );
EndSub
i would like it to show their current speed through trap and it comes up in both metric and imperial speeds
Thanks for all your help gai
Gai-Luron
27th July 2009, 17:57
RegisterNodeAction( "AS3" , 248 , DisplaySpeed );
RegisterNodeAction( "AS3" , 444 , DisplaySpeed );
it's ok if 248 and 444 is the nodes when you want to put your speedtrap for track AS3. The speed trap is displayed relative to unit of the player set in !myconfig ( km/h or mph )
Zone is a square zone in meter arround a point, node is a part of track. For speedtrap, Node is good, to do an action when you enter a special zone, like garahe in pit, use zone.
Gai-Luron
Tur8o
27th July 2009, 19:49
oh like you can name the roads of the track :D
could i get this speed to show up into a box Sub OnConnectClose( $KeyFlags,$id )
closePrivButton("welc&pos&clos&ref&welcbkgr");
openPrivButton( "pbbackgr",60,5,79,7,5,-1,16,"" );
openPrivButton( "pbbox1",61,6,12,5,5,-1,32,"^3" );
openPrivButton( "pbbox2",74,6,12,5,5,-1,32,"^3" );
openPrivButton( "pbbox3",87,6,12,5,5,-1,32,"^3" );
openPrivButton( "pbbox4",100,6,12,5,5,-1,32,"^3" );
openPrivButton( "pbbox5",113,6,12,5,5,-1,32,"^3" );
openPrivButton( "pbbox6",126,6,12,5,5,-1,32,"^3" );
IF ( $enable_pitboard == "true" )
THEN
OnConnectClose_Pitboard();
ENDIF
EndSub
to get it into pbbox6
thanks Tur8o
Tim NL
28th July 2009, 07:23
oh like you can name the roads of the track :D
could i get this speed to show up into a box Sub OnConnectClose( $KeyFlags,$id )
closePrivButton("welc&pos&clos&ref&welcbkgr");
openPrivButton( "pbbackgr",60,5,79,7,5,-1,16,"" );
openPrivButton( "pbbox1",61,6,12,5,5,-1,32,"^3" );
openPrivButton( "pbbox2",74,6,12,5,5,-1,32,"^3" );
openPrivButton( "pbbox3",87,6,12,5,5,-1,32,"^3" );
openPrivButton( "pbbox4",100,6,12,5,5,-1,32,"^3" );
openPrivButton( "pbbox5",113,6,12,5,5,-1,32,"^3" );
openPrivButton( "pbbox6",126,6,12,5,5,-1,32,"^3" );
IF ( $enable_pitboard == "true" )
THEN
OnConnectClose_Pitboard();
ENDIF
EndSub
to get it into pbbox6
thanks Tur8o
Hi,
Something like this.
openPrivButton( "pbbox6",126,6,12,5,5,-1,32,"^3" . ToPlayerUnit( GetCurrentPlayerVar( "InstantSpeed" ) ) . GetCurrentPlayerVar("UnitSpeed") );
I didnt test it but give it a try:D.
Tur8o
28th July 2009, 12:17
hey guys would this work or not?
to get the nickname to appear at the front of the privmsg
PrivMsg( langEngine( "%{main_speedtrap}%" , ToPlayerUnit( GetCurrentPlayerVar("NickName")) (GetCurrentPlayerVar( "InstantSpeed" ) ),GetCurrentPlayerVar("UnitSpeed") ) );
or should it be
PrivMsg( langEngine( "%{main_speedtrap}%" , ( GetCurrentPlayerVar("NickName")) ToPlayerUnit(GetCurrentPlayerVar( "InstantSpeed" ) ),GetCurrentPlayerVar("UnitSpeed") ) );
Thanks Tur8o
Gai-Luron
28th July 2009, 19:35
Yes,
If you change main_speedtrap id in language block to receive 3 args and not only 2 and if you don't forget the ',' after GetCurrentPlayerVar("NickName"). the double parentesis are not needed too
PrivMsg( langEngine( "%{main_speedtrap}%" , GetCurrentPlayerVar("NickName") , ToPlayerUnit(GetCurrentPlayerVar( "InstantSpeed" ) ),GetCurrentPlayerVar("UnitSpeed") ) );
main_speedtrap = "SpeedTrap for player {0} = {1} {2}";
Gai-Luron
Tur8o
28th July 2009, 22:06
thanks mate yeah i had done the extra argv just missed the "," how annoying :P
Thanks Tur8o
Tur8o
29th July 2009, 00:04
How can you limit it so it only shows you best :D
Thanks
Tim NL
29th July 2009, 08:24
How can you limit it so it only shows you best :D
Thanks
Store the top_speed in a var and compare everytime the stored top_speed with the current top_speed.
And when the current top_speed is faster then the stored top_speed then store the topspeed in the var and show the var with top_speed.
Tur8o
29th July 2009, 12:58
do you reckon you could help me with that in code?
SetCurrentPlayerVar( "points_total",getUserStoredValue( "points_total" ) ); #Get total points new database
SetCurrentPlayerVar( "tot_points",GetStoredValue( $Username . "tot_points" ) ); #Get total points old databsae
IF( GetCurrentPlayerVar( "tot_points" ) > GetCurrentPlayerVar( "points_total" ) ) #If old data is bigger then new data
THEN #Then set new data with the old data
SetCurrentPlayerVar( "points_total", GetCurrentPlayerVar( "tot_points" ) );
setUserStoredValue( "points_total", GetCurrentPlayerVar( "points_total" ) );
ENDIF
so similar to this?
Yisc[NL]
29th July 2009, 16:00
@Tur8o:
Nothing personal but what do you think to gain by asking everything you want on this forum? It would be better to ask someone to build a Lapper application for you where you give them a list of functions you want to have in that application. By building and trying it yourself you learn how Lapper needs to be coded, you learn have to trace your own bugs and you learn how to solve them. When you are really stuck you can always ask for help but at the moment you are asking almost everything here which isn't fair in my opinion.
Tur8o
29th July 2009, 17:46
im not asking everything but it is hard to to test whilst my server is always populated its not fair on the people on the server and if i were to mess it up people start to complain.. i try my hardest but im only limited to what i know :/
Yisc[NL]
29th July 2009, 19:02
im not asking everything but it is hard to to test whilst my server is always populated its not fair on the people on the server and if i were to mess it up people start to complain.. i try my hardest but im only limited to what i know :/
Then setup a server on your local computer and connect a Lapper to that one.
That's that way I'm doing all my testing and building.
Tur8o
29th July 2009, 19:37
i dont know how to put lapper on :/
Yisc[NL]
29th July 2009, 19:42
i dont know how to put lapper on :/
The same as on your server.
Sorry to say this but if you even don't know how to do that, then what are you messing around with scripts and all that stuff?
Just start LFS, click Multiplayer , select "Start new host", make selections you want and start it. Then type: /insim [portnummer you want Lapper to connect to]
for example: /insim 29999
Download Lapper to your pc, expand the files to a directory, make the needed changes in the configuration files and start Lapper.exe
Tur8o
4th August 2009, 15:47
im still having problems
SetCurrentPlayerVar( "top_speed",getUserStoredValue( "curr_speed" ) );
IF( GetCurrentPlayerVar( "curr_speed" ) > GetCurrentPlayerVar( "top_speed" ) )
THEN
SetCurrentPlayerVar( "top_speed", GetCurrentPlayerVar( "curr_speed" ) );
setUserStoredValue( "top_speed", GetCurrentPlayerVar( "top_speed" ) );
ENDIF
like this?
thanks
Tur8o
8th August 2009, 15:43
could someone tell me if im close with this please?
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.