21.09.2016, 19:54
hey guys i have a event race sistem and i want to do , if you finish the race on last CP to teleport you on a zone and i added some settings anyway , where should i add this
i added under this , it works, but the funny thing is , every time when some1 else end's the race it's respawning me and everyone who end the race
this is the final CP
Код HTML:
TogglePlayerControllable(playerid, true); SetCameraBehindPlayer(playerid); SetPlayerPos(playerid, 902.0040, -937.6181, 42.6619); SetPlayerFacingAngle(playerid, 193.1544); SendClientMessage(playerid, COLOR_SYN2, "(!) Ai fost adus inapoi in fata cladiri de Event!");
Код HTML:
format(string, sizeof(string), "(!) \"%s\" a terminat cursa pe locul \"%d\".", pName, Position); SendClientMessageToAll(WHITE, string); format(string, sizeof(string), "(!) Timp: \"%d:%d.%d\".", rTime[0], rTime[1], rTime[2]); SendClientMessageToAll(WHITE, string); format(string, sizeof(string), "(!) Premiu: \"$%d si +%d Scor\".", Prize[0], Prize[1]); SendClientMessageToAll(WHITE, string);
Код HTML:
if(CPProgess[playerid] == TotalCP -1)
{
new
TimeStamp,
TotalRaceTime,
string[256],
rFile[256],
pName[MAX_PLAYER_NAME],
rTime[3],
Prize[2],
TempTotalTime,
TempTime[3]
;
Position++;
GetPlayerName(playerid, pName, sizeof(pName));
TimeStamp = GetTickCount();
TotalRaceTime = TimeStamp - RaceTick;
ConvertTime(var, TotalRaceTime, rTime[0], rTime[1], rTime[2]);
switch(Position)
{
case 1: Prize[0] = (random(random(5000)) + 10000), Prize[1] = 10;
case 2: Prize[0] = (random(random(4500)) + 9000), Prize[1] = 9;
case 3: Prize[0] = (random(random(4000)) + 8000), Prize[1] = 8;
case 4: Prize[0] = (random(random(3500)) + 7000), Prize[1] = 7;
case 5: Prize[0] = (random(random(3000)) + 6000), Prize[1] = 6;
case 6: Prize[0] = (random(random(2500)) + 5000), Prize[1] = 5;
case 7: Prize[0] = (random(random(2000)) + 4000), Prize[1] = 4;
case 8: Prize[0] = (random(random(1500)) + 3000), Prize[1] = 3;
case 9: Prize[0] = (random(random(1000)) + 2000), Prize[1] = 2;
default: Prize[0] = random(random(1000)), Prize[1] = 1;
}
format(string, sizeof(string), "(!) \"%s\" a terminat cursa pe locul \"%d\".", pName, Position);
SendClientMessageToAll(WHITE, string);
format(string, sizeof(string), "(!) Timp: \"%d:%d.%d\".", rTime[0], rTime[1], rTime[2]);
SendClientMessageToAll(WHITE, string);
format(string, sizeof(string), "(!) Premiu: \"$%d si +%d Scor\".", Prize[0], Prize[1]);
SendClientMessageToAll(WHITE, string);
DestroyVehicle(CreatedRaceVeh[playerid]);
DisablePlayerRaceCheckpoint(playerid);
TextDrawHideForPlayer(playerid, RaceInfo[playerid]);
CPProgess[playerid] = 0;
KillTimer(InfoTimer[playerid]);
SendClientMessage(playerid, COLOR_SYN2, "(!) Asteapta sa termine toti cursa sau sa treaca timpu!");
SetPlayerVirtualWorld(playerid, 0);
if(FinishCount <= 5)
{
format(rFile, sizeof(rFile), "/rRaceSystem/%s.RRACE", RaceName);
format(string, sizeof(string), "BestRacerTime_%d", TimeProgress);
TempTotalTime = dini_Int(rFile, string);
ConvertTime(var1, TempTotalTime, TempTime[0], TempTime[1], TempTime[2]);
if(TotalRaceTime <= dini_Int(rFile, string) || TempTotalTime == 0)
{
dini_IntSet(rFile, string, TotalRaceTime);
format(string, sizeof(string), "BestRacer_%d", TimeProgress);
if(TempTotalTime != 0) format(string, sizeof(string), "(!) \"%s\" a spart recordul de \"%s\" Timp: \"%d\" minute mai rapid , pe locul \"%d\"", pName, dini_Get(rFile, string), -(rTime[1] - TempTime[1]), TimeProgress+1);
else format(string, sizeof(string), "(!) \"%s\" a spart un nou record, Timp: \"%d\"", pName, TimeProgress+1);
SendClientMessageToAll(GREEN, " ");
SendClientMessageToAll(GREEN, string);
SendClientMessageToAll(GREEN, " ");
format(string, sizeof(string), "BestRacer_%d", TimeProgress);
dini_Set(rFile, string, pName);
TimeProgress++;
}
}
FinishCount++;
GivePlayerMoney(playerid, Prize[0]);
SetPlayerScore(playerid, GetPlayerScore(playerid) + Prize[1]);
DisablePlayerRaceCheckpoint(playerid);
CPProgess[playerid]++;
if(FinishCount >= JoinCount) return StopRace();
}
else
{
CPProgess[playerid]++;
CPCoords[CPProgess[playerid]][3]++;
RacePosition[playerid] = floatround(CPCoords[CPProgess[playerid]][3], floatround_floor);
SetCP(playerid, CPProgess[playerid], CPProgess[playerid]+1, TotalCP, RaceType);
PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
}