08.11.2010, 15:51
Alright so, I have a big problem, and i can't understand it neither any of my friends, after the person finishes the race that means tries to go through the last race checkpoint, it does nothing at all leaves the checkpoint and reads no code, i did /* */ on the code which after doing it the code went through a bit, but then stops at if(finishcount cause of the disabled switch(..... I have windows 7, on the host it was Linux and it worked perfectly with no misunderstanding.
pawn Код:
if(Joined[playerid] == true)
{
if(CPProgess[playerid] == TotalCP -1)
{
new
string[256],
rFile[256],
pName2[MAX_PLAYER_NAME],
Prize[MAX_PLAYERS][2],
TempTotalTime,
TempTime[3]
;
new append[3];
Position++;
GetPlayerName(playerid, pName2, sizeof(pName2));
new path[64];
format(rFile, sizeof(rFile), "/Race/%s.txt", RaceName);
/* switch(Position)
{
case 1: Prize[playerid][0] = dini_Int(rFile,"rPrizeMoney")+(random(dini_Int(rFile,"rPrizeMoneyBonus")*10)), Prize[playerid][1] = dini_Int(rFile,"rPrizeExp")+(random(dini_Int(rFile,"rPrizeExpBonus")*10)), EndRaceCount = 60, EndRaceTimer = SetTimer("CountTillRaceEnd",999,1), dini_IntSet(path,"RaceFirst",dini_Int(path,"RaceFirst")+1),dUserSetINT(pName(playerid)).("RaceFirst",dUserINT(pName(playerid)).("RaceFirst")+1);
case 2: Prize[playerid][0] = dini_Int(rFile,"rPrizeMoney")+(random(dini_Int(rFile,"rPrizeMoneyBonus")*9)), Prize[playerid][1] = dini_Int(rFile,"rPrizeExp")+(random(dini_Int(rFile,"rPrizeExpBonus")*9)),dini_IntSet(path,"RaceSecond",dini_Int(path,"RaceSecond")+1),dUserSetINT(pName(playerid)).("RaceSecond",dUserINT(pName(playerid)).("RaceSecond")+1);
case 3: Prize[playerid][0] = dini_Int(rFile,"rPrizeMoney")+(random(dini_Int(rFile,"rPrizeMoneyBonus")*8)), Prize[playerid][1] = dini_Int(rFile,"rPrizeExp")+(random(dini_Int(rFile,"rPrizeExpBonus")*8)),dini_IntSet(path,"RaceThird",dini_Int(path,"RaceThird")+1),dUserSetINT(pName(playerid)).("RaceThird",dUserINT(pName(playerid)).("RaceThird")+1);
case 4: Prize[playerid][0] = dini_Int(rFile,"rPrizeMoney")+(random(dini_Int(rFile,"rPrizeMoneyBonus")*7)), Prize[playerid][1] = dini_Int(rFile,"rPrizeExp")+(random(dini_Int(rFile,"rPrizeExpBonus")*7)),dini_IntSet(path,"RaceOther",dini_Int(path,"RaceOther")+1);
case 5: Prize[playerid][0] = dini_Int(rFile,"rPrizeMoney")+(random(dini_Int(rFile,"rPrizeMoneyBonus")*6)), Prize[playerid][1] = dini_Int(rFile,"rPrizeExp")+(random(dini_Int(rFile,"rPrizeExpBonus")*6)),dini_IntSet(path,"RaceOther",dini_Int(path,"RaceOther")+1);
case 6: Prize[playerid][0] = dini_Int(rFile,"rPrizeMoney")+(random(dini_Int(rFile,"rPrizeMoneyBonus")*5)), Prize[playerid][1] = dini_Int(rFile,"rPrizeExp")+(random(dini_Int(rFile,"rPrizeExpBonus")*5)),dini_IntSet(path,"RaceOther",dini_Int(path,"RaceOther")+1);
case 7: Prize[playerid][0] = dini_Int(rFile,"rPrizeMoney")+(random(dini_Int(rFile,"rPrizeMoneyBonus")*4)), Prize[playerid][1] = dini_Int(rFile,"rPrizeExp")+(random(dini_Int(rFile,"rPrizeExpBonus")*4)),dini_IntSet(path,"RaceOther",dini_Int(path,"RaceOther")+1);
case 8: Prize[playerid][0] = dini_Int(rFile,"rPrizeMoney")+(random(dini_Int(rFile,"rPrizeMoneyBonus")*3)), Prize[playerid][1] = dini_Int(rFile,"rPrizeExp")+(random(dini_Int(rFile,"rPrizeExpBonus")*3)),dini_IntSet(path,"RaceOther",dini_Int(path,"RaceOther")+1);
case 9: Prize[playerid][0] = dini_Int(rFile,"rPrizeMoney")+(random(dini_Int(rFile,"rPrizeMoneyBonus")*2)), Prize[playerid][1] = dini_Int(rFile,"rPrizeExp")+(random(dini_Int(rFile,"rPrizeExpBonus")*2)),dini_IntSet(path,"RaceOther",dini_Int(path,"RaceOther")+1);
default: Prize[playerid][0] = dini_Int(rFile,"rPrizeMoney")+(random(dini_Int(rFile,"rPrizeMoneyBonus")*1)), Prize[playerid][1] = dini_Int(rFile,"rPrizeExp")+(random(dini_Int(rFile,"rPrizeExpBonus")*1)),dini_IntSet(path,"RaceOther",dini_Int(path,"RaceOther")+1);
}
switch(Position)
{
case 1: format(append, sizeof(append), "st");
case 2: format(append, sizeof(append), "nd");
case 3: format(append, sizeof(append), "rd");
default: format(append, sizeof(append), "th");
}
*/ format(string, sizeof(string), "*** '%s' finished the %d%s in the '%s' race. Time: %s ***", pName2, Position,append,RaceName,TimeConvert(RaceTime[playerid]));
SendClientMessageToAll(COLOR_ORANGE, string);
format(string, sizeof(string), "* You finished the %d%s in the '%s' race. Time: %s *", Position,append,RaceName,TimeConvert(RaceTime[playerid]));
SendClientMessage(playerid,COLOR_ORANGE, string);
format(string, sizeof(string), "* You won $%d and %d experience points *", Prize[playerid][0], Prize[playerid][1]);
SendClientMessage(playerid,COLOR_ORANGE, string);
if(FinishCount <= 5)
{
format(rFile, sizeof(rFile), "/Race/%s.txt", RaceName);
format(string, sizeof(string), "BestRacerTime_%d", TimeProgress);
TempTotalTime = dini_Int(rFile, string);
ConvertTime(var1, TempTotalTime, TempTime[0], TempTime[1], TempTime[2]);
if(RaceTime[playerid] < dini_Int(rFile, string) || TempTotalTime == 0)
{
dini_IntSet(rFile, string, RaceTime[playerid]);
format(string, sizeof(string), "BestRacer_%d", TimeProgress);
new append2[3];
switch(TimeProgress+1){
case 1: format(append2, sizeof(append2), "st");
case 2: format(append2, sizeof(append2), "nd");
case 3: format(append2, sizeof(append2), "rd");
default: format(append2, sizeof(append2), "th");
}
if(TempTotalTime != 0) format(string, sizeof(string), "*** '%s' broken the '%s' race record of '%s' [%s] in the %d%s place with time: %s ***", pName2,RaceName,dini_Get(rFile, string),TimeConvert(TempTotalTime), TimeProgress+1,append2,TimeConvert(RaceTime[playerid]));
else format(string, sizeof(string), "*** '%s' broken a new record in the %d%s place with time: %s ***", pName2, TimeProgress+1,append2,TimeConvert(RaceTime[playerid]));
SendClientMessageToAll(COLOR_ORANGE, " ");
SendClientMessageToAll(COLOR_ORANGE, string);
format(string, sizeof(string), "BestRacer_%d", TimeProgress);
dini_Set(rFile, string, pName2);
TimeProgress++;
}
}
GivePlayerMoney(playerid,Prize[playerid][0]);
dUserSetINT(pName(playerid)).("Experience",dUserINT(pName(playerid)).("Experience")+Prize[playerid][1]);
if(dUserINT(pName(playerid)).("VIP") == 1)
{
dUserSetINT(pName(playerid)).("Experience",dUserINT(pName(playerid)).("Experience")+Prize[playerid][1]/2);
format(string, sizeof(string),"[VIP PROCENTAI] Gavai papildomai %d patirties nes esi vip.",Prize[playerid][1]/2);
SendClientMessage(playerid,COLOR_ORANGE,string);
}
Joined[playerid] = false;
DestroyVehicle(CreatedRaceVeh[playerid]);
DisablePlayerRaceCheckpoint(playerid);
TextDrawHideForPlayer(playerid, RaceInfo[playerid]);
CPProgess[playerid] = 0;
KillTimer(InfoTimer[playerid]);
RaceTime[playerid]=0;
TogglePlayerControllable(playerid, true);
SetCameraBehindPlayer(playerid);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid,PInterior[playerid]);
KillTimer(ExitRaceTimer[playerid]);
JoinCount--;
FlipUsed[playerid] = 0;
RacePositions[PositionID[playerid]-1] = 0;
PositionID[playerid] = 0;
CheckPlayerLevel(playerid);
SetPlayerPos(playerid,dUserFLOAT(pName(playerid)).("PosX"),dUserFLOAT(pName(playerid)).("PosY"),dUserFLOAT(pName(playerid)).("PosZ"));
if(JoinCount <= 0)
{
format(string, sizeof(string), "** '%s' race ended **",RaceName);
SendClientMessageToAll(COLOR_ORANGE, string);
StopRace();
}
}
else
{
CPProgess[playerid]++;
CPCoords[CPProgess[playerid]][0]++;
RacePosition[playerid] = floatround(CPCoords[CPProgess[playerid]][0], floatround_floor);
SetCP(playerid, CPProgess[playerid], CPProgess[playerid]+1, TotalCP, RaceType);
PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
}
}