CreateDynamicRaceCP problem
#1

Hello people.
I have created a race system, works fine without any bugs except for one thing. For example, when race starts, there are, lets say, 20 checkpoints loaded, dynamic race checkpoints (incognitos streamer). The problem is, you don't have to enter all checkpoints, you just go to the last checkpoint and you win the race without picking up others. Here is the code:

pawn Код:
public StartRace()
{
    KillTimer(StartRaceTmr);
    Race = random(10);
    RaceActive = true;
   
    PutPlayerInRaceTmr = SetTimer("PutPlayerInRace", 20000, false);
    EndRaceTmr = SetTimer("EndRace", 140000, false);
   
    if(Race == 0 )
    {
        SendClientMessageToAll(-1, "Race 'Need4Speed' starts in 20 seconds, type /race to join.");
        CreateRace0CP[0] = CreateDynamicRaceCP(0, -2484.602783, -2417.871582, 32.702911, -2417.383544, -2578.697509, 54.198608, 10.0, 14, -1, -1, 300.0);
        CreateRace0CP[1] = CreateDynamicRaceCP(0, -2417.383544, -2578.697509, 54.198608, -2093.344970, -2684.317871, 53.607620, 10.0, 14, -1, -1, 300.0);
...
pawn Код:
public OnPlayerEnterDynamicRaceCP(playerid, checkpointid)
{
    if( Race == 0 )
    {
        if(checkpointid == CreateRace0CP[0] && PlayerJoined[playerid] == true)
        {
            TogglePlayerDynamicRaceCP(playerid, CreateRace0CP[0], 0);
            TogglePlayerDynamicRaceCP(playerid, CreateRace0CP[1], 1);
        }
        if(checkpointid == CreateRace0CP[1] && PlayerJoined[playerid] == true)
        {
            TogglePlayerDynamicRaceCP(playerid, CreateRace0CP[1], 0);
            TogglePlayerDynamicRaceCP(playerid, CreateRace0CP[2], 1);
        }
...
I don't know if I forgot to add something or maybe the way I scripted this won't work?
Reply
#2

it's simple, use a variable set it to 0 at the race start and then do variable[playerid]++; every time he picks up a checkpoint and just make that variable's value's control the checkpoint order and don't end the race unless variable ==20 (the checkpoints number) and that's pretty much about it.
Reply
#3

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
it's simple, use a variable set it to 0 at the race start and then do variable[playerid]++; every time he picks up a checkpoint and just make that variable's value's control the checkpoint order and don't end the race unless variable ==20 (the checkpoints number) and that's pretty much about it.
That's a good idea but the problem is that loaded checkpoints are still visible, for example, checkpoint 4 should be loaded only after player enters checkpoint 3. I will try to create checkpoint 2 only after checkpoint 1 is picked up and so on. Not sure if this is going to work but I will try.
Any other suggestions?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)