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: ....
}
}
}
}
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(CurrentCheckpoint == 1) // If the race checkpoint (current one) is 1
{
CurrentCheckpoint ++; // adds another number, its now 2.
}
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.
}
}
#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;
}