#1

Ok... i want to make a simple 2 checkpoint race... but idk where to start. i basically want it to be like this:

When the player drives into the checkpoint, it will tell him that there is a race. If he types /join while in the cp, he will join it. the race will start in 30 seconds. That cp will go bye bye and he will drive to the end cp. once he is there, he will get 75000 dollars if hes in 1st place, 50000 for second, and 25000 for third. PLEASE HELP!
Reply
#2

That is a FS also... Search ftw
Reply
#3

i have... i really cant fine a good one... for me anyway. and it could be in a gm. Please Someone Help Me CODE This!!! THANK YOU!!!
Reply
#4

hhhmm
take a idea

if you want multiple races
pawn Код:
new FirstRaceWinner, SecondRaceWinner, ThirdRaceWinner, CurrentRace;
new IsInRace[MAX_PLAYERS], RacerCount, CurrentCheckpoint;
new CurrentGo;

forward RaceStart();

forward RaceTimer();

public OnGameModeInit()
{
      FirstRaceWinner[MAX_RACES] = 0;
      SecondRaceWinner[MAX_RACES] = 0;
      ThirdRaceWinner[MAX_RACES] = 0;
      SetTimer("RaceTimer",30000,false);
      SendClientMessage(playerid,COLOR," ---- Race is starting in 30 seconds ---- ");
      SendClientMessage(playerid,COLOR," ---- Use /joinrace to join the current race! ----");
      return 1;
}

public RaceTimer()
{
    if(RacerCount < 2) return SendClientMessage(playerid,COLOR,"Race couldn't start, lower than 2 racers.);
    SetTimer("
RaceStart",1000,true);
}

public RaceStart()
{
    for(new 1=0; i<MAX_PLAYERS; i++)
    {
        if(IsInRace[i] == 1)
        {
             if(RacerCount < 2) return SendClientMessageToAll(COLOR,"
-Race finished ; Lower than 2 players."); SpawnPlayer(i);
            if(CurrentGo == 0) CurrentGo = 1; GameTextForPlayer(i,"
~b~1",1,2000);
            if(CurrentGo == 1) CurrentGo = 2; GameTextForPlayer(i,"
~y~2",1,2000);
            if(CurrentGo == 2) CurrentGo = 3; GameTextForPlayer(i,"
~g~3",1,2000);
            if(CurrentGo == 3) CurrentGo = 1; GameTextForPlayer(i,"
~r~GOGO",1,2000);
            switch(CurrentCheckpoint)
            {
                case 0: SetPlayerCheckpoint(....); CurrentCheckpoint ++;
                case 1: ....
            }
        }
    }
}
Hope you understanted atleast a BIT
Reply
#5

what does the CurrentCheckpoint ++ thing do? And... how do i get the winner...? I kind of get this... but i dont really... i want just 1 race... PLEASE HELP ME OUT... THX
Reply
#6

Quote:
Originally Posted by sciman001
Посмотреть сообщение
what does the CurrentCheckpoint ++ thing do? And... how do i get the winner...? I kind of get this... but i dont really... i want just 1 race... PLEASE HELP ME OUT... THX
If you dont like the work i did, it took me a while, ALSO i wont do a race FS in a single night.

CurrentCheckpoint ++; means adding a id to the current checkpoint so you can check..

e.g;
pawn Код:
if(CurrentCheckpoint == 1) // If the race checkpoint (current one) is 1
{
    CurrentCheckpoint ++; // adds another number, its now 2.
}
So you can use it this way
pawn Код:
switch(CurrentCheckpoint)
{
     case 0: // Case 0: means checkpoint id is 0 so here we add a checkpoint
     {
            ResetPlayerCheckpoints(playerid); // i think it was like this
            CreateCheckpoint(..);
            CurrentCheckpoint ++; // it was 0, now 1.
     }
     case 1: // Case 1: means the checkpoint id is 1 so here we add another checkpoint
     {
            ResetPlayerCheckpoints(playerid); // i think it was like this
            CreateCheckpoint(..);
            CurrentCheckpoint ++; // it was 1, now 2.
      }
}
and etc..
Reply
#7

srry... im just a bad coder and am a bit confused... i will try to code and see wat happens.
Reply
#8

hmmm... is there a function that checks if the player is near a point? ex.
IsPlayerNearPoint(playerid, x, y, z, distance);
Reply
#9

this is what i got so far... help me fix it up if u can. THX!

pawn Код:
#include <a_samp>

new FirstRaceWinner, SecondRaceWinner, ThirdRaceWinner, CurrentRace;
new IsInRace[MAX_PLAYERS], RacerCount, CurrentCheckpoint;
new CurrentGo;forward RaceStart();forward RaceTimer();

public OnFilterScriptInit()
{
    FirstRaceWinner[MAX_RACES] = 0;
    SecondRaceWinner[MAX_RACES] = 0;
    ThirdRaceWinner[MAX_RACES] = 0;
    SetTimer("RaceTimer",30000,false);
    SendClientMessage(playerid,COLOR," ---- Race is starting in 30 seconds ---- ");
    SendClientMessage(playerid,COLOR," ---- Use /joinrace to join the current race! ----");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}


main(){}

public RaceTimer()
{
    if(RacerCount < 2) return SendClientMessage(playerid,COLOR,"Race couldn't start, lower than 2 racers.);
    SetTimer("
RaceStart",1000,true);
}

public RaceStart()
{
    for(new 1=0; i<MAX_PLAYERS; i++)
    {
        if(IsInRace[i] == 1)
        {
            if(RacerCount < 2)
            {
                SendClientMessageToAll(COLOR,"
-Race finished ; Lower than 2 players.");
                SpawnPlayer(i);
            }
            if(CurrentGo == 0) CurrentGo = 1; GameTextForPlayer(i,"
~b~1",1,2000);
            if(CurrentGo == 1) CurrentGo = 2; GameTextForPlayer(i,"
~y~2",1,2000);
            if(CurrentGo == 2) CurrentGo = 3; GameTextForPlayer(i,"
~g~3",1,2000);
            if(CurrentGo == 3) CurrentGo = 1; GameTextForPlayer(i,"
~r~GOGO",1,2000);
            switch(CurrentCheckpoint)
            {
                case 0: SetPlayerCheckPoint(playerid, 1476.3525, 1243.6958, 10.8203, 5); CurrentCheckpoint ++; ResetPlayerCheckpoints(i);
                case 1: SetPlayerCheckPoint(playerid, 1477.5840, 1599.9865, 10.8125, 5);
            }
        }
    }
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("
/joinrace", cmdtext, true, 10) == 0)
    {
        IsInRace[playerid] = 1;
        return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)