0 Members and 1 Guest are viewing this topic.
You can do something like this in AppOnIdle: the checkpoints should be made of 2 points - the points will create a line segment. 2 player positions, from previous AppOnIdle and current AppOnIdle, will create the second line segment. Check if the line segments intersect, if true, the player passed the checkpoint. Though I dunno if it won't be to slow.
Well right now I'm rewriting the code, making it clean cause it was a mess. I'll try how it works doing the loop in AppOnIdle without considering the time resolution.
Maybe it's not so bad, the problem comes when 2 or more players go together, the one with lower ID will win I guess.
And also I made this script having in mind making it save the best lap times, and 1 second resolution would suck for that.
The weapons idea would screw up the race because sometimes you have to stop in order to take the weapon, and also there are some checkpoints in the air.
Then I calculate the angle between those 2 lines, if it's greater than 90° it means you crossed the checkpoint. I still have to think about it, I'm not so sure about this
function angle( v1x, v1y, v2x, v2y: single ): single;var cosangle: single; dist: single;begin dist := ( distance( 0, 0, v1x, v1y ) * distance( 0, 0, v2x, v2y ) ); cosangle := ( v1x * v2x + v1y * v2y ) / dist; if dist = 0 then begin result := -1; exit; end result := 90 - 720 * ( arctan( cosangle / ( 1 + sqrt( 1 - cosangle * cosangle ) ) ) ) / (2 * pi);end;
First of all you must download the dedicated server, which you can downlaod >here< (it's not the one that comes with soldat)Then, you unzip that somewhere and unzip PerroRACE.zip in the same somewhere.You can edit the file soldat.ini to set the server options, but it's not really necessary.If the race won't start use the command "/recompile race". That will reload the script. Other than that use the commands I posted in the first post. Remember that you have to use some of the maps I included (rc_Airpirates, rc_Bigfalls, rc_Arena) or set the checkpoints on your own if you want to play in another map.