Race control point count
#1

Hi

Sorry if this has been asking already but I am running a race server but what i'd like is the server to display how many CP's are left.

so the race starts with 50 CP's so at the start you would see 50/50 or 0/50

i've had a search on the forum but cant seem to find what I'm looking for, is this easy to do or can someone point me in the right direction I'm currently using Adrenaline game mode

Thanks in advance
Reply
#2

New global variable
pawn Код:
new RaceCPsLeft[MAX_PLAYERS];
When they start the race.
pawn Код:
RaceCPsLeft[playerid] = 50;
when they enter a RaceCheckPoint
pawn Код:
new string[25];
RaceCPsLeft[playerid]--;
format(string,sizeof(string),"Checkpoints left: %i.",RaceCPsLeft[playerid]);
GameTextForPlayer(playerid,string,3000,3);
Reply
#3

Wow thanks

One question more if you dont mind EiresJason,

Quote:
Originally Posted by EiresJason
Посмотреть сообщение
New global variable
pawn Код:
RaceCPsLeft[playerid] = 50;
does this reference the CP count? if so can it be dynamic as not all races have the same amount of CP's

sorry to be a pain
Reply
#4

Yeah.
pawn Код:
#define MAX_RACES 5
//change '5' to whatever you want.
#define RACE0CPs 50
#define RACE1CPs 25
//make more '#define RACE[number]CPs [number of checkpoints]' when you need them.
new RaceCPsLeft[MAX_RACES][MAX_PLAYERS];
When they start the race.
pawn Код:
/*make sure the number inside RaceCPsLeft[HERE][playerid] is always the proper Race id
and also 'variable' is always the one assoicated with the race id - Make sure the RaceCPsLeft[RACEID][playerid]='variable'.
EG: RaceCPsLeft[3][playerid] SHOULD equal = RACE3CPs.

*/

RaceCPsLeft[0][playerid] = RACE0CPs;
//or
RaceCPsLeft[1][playerid] = RACE1CPs;
When a player enters a race checkpoint.
pawn Код:
new string[25];
RaceCPsLeft[0][playerid]--;
format(string,sizeof(string),"Checkpoints left: %i.",RaceCPsLeft[0][playerid]);
GameTextForPlayer(playerid,string,3000,3);
Reply
#5

Thanks man thats saved me a massive head ache.. +rep for you
Reply
#6

Np
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)