#1

Hello.
Guys i am trying to script somekind of race.
Actually what i want to do is....when a player telepports to a certain parkour ,after few seconds a checkpoint appears and when the player enters it a race starts. I mean it is counting in how many seconds the player will finish the parkour and saves it in a file.

Help me out a bit please.
Reply
#2

Bump? :S
Reply
#3

You can make the teleport using SetPlayerPos. (obviously herp-derp)
Create a new variable which will get the player's completion of the race.
new RaceStatuss[MAX_PLAYERS];
Once the player teleports there, show him the race CP with SetPlayerRaceCheckpoint and set the RaceStatuss[playerid] to 1.

Under OnPlayerEnterRaceCheckpoint(playerid) check if the RaceStatuss[playerid] is equal to 1. If it is, show him the next CP.
Reply
#4

Quote:
Originally Posted by Shetch
Посмотреть сообщение
You can make the teleport using SetPlayerPos. (obviously herp-derp)
-.- lol

and thanks for the rest...hmm
Reply
#5

https://sampwiki.blast.hk/wiki/YSI:Races
It has got everything you want. or else This
Reply
#6

Quote:
Originally Posted by Shetch
Посмотреть сообщение
You can make the teleport using SetPlayerPos. (obviously herp-derp)
Create a new variable which will get the player's completion of the race.
new RaceStatuss[MAX_PLAYERS];
Once the player teleports there, show him the race CP with SetPlayerRaceCheckpoint and set the RaceStatuss[playerid] to 1.

Under OnPlayerEnterRaceCheckpoint(playerid) check if the RaceStatuss[playerid] is equal to 1. If it is, show him the next CP.
HERP-DERP you forgot the time...

Inside of your player enum I would add (assuming you have a player enum, if not I would make one)...

pawn Код:
enum PlayerInfo
{
    bool:Finished, //true or false variable (like using 0 or 1 in a regular variable)
    StartTime, //We'll store the start time here (since we'll be using gettickcount() to get it)
    EndTime //Then we'll store the end time here
}
new Info[MAX_PLAYERS][PlayerInfo]; //just our array
Now when the race starts (well, starts for the player or whatever)

pawn Код:
Info[playerid][StartTime] = gettickcount();

//When the race ends (or when they cross the finish line)...

Info[playerid][Finished] = true;
Info[playerid][EndTime] = gettickcount();

//If you want to display it some where...

(Info[playerid][EndTime]-Info[playerid][StartTime])/1000 //will return in seconds how long it took, then you could divide by 60 to get minutes.
Reply
#7

Ok antonio,thanks for explaning that i will give it a shoot as soon as i get home.

Oh and actually i would like to save it in a FILE,the time i mean. And make like a Best 3 times

P.So you know Ph0eNiX? Just curious cuz ive seen a penix with the [ABK] tag :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)