Race control point count - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Race control point count (
/showthread.php?tid=468434)
Race control point count -
RK-2fast4u - 08.10.2013
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
Re: Race control point count -
EiresJason - 08.10.2013
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);
Re: Race control point count -
RK-2fast4u - 08.10.2013
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
Re: Race control point count -
EiresJason - 08.10.2013
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);
Re: Race control point count -
RK-2fast4u - 08.10.2013
Thanks man thats saved me a massive head ache.. +rep for you
Re: Race control point count -
EiresJason - 08.10.2013
Np