Utrke Sistem

Započeo Plen Ki Mun
8. Jan. 2018. Zaključano
607
pregleda
4
postova
Mate
5
Underboss
8. Jan. 2018.
Detaljan opis problema: Koristim ryderov race system kao i svi drugi, ali muci me kada izvlaci igracevu poziciju, u skripti pise "has finished the race in position 1" i to sa brojem a ja zelim da to bude sa rijecima npr: Komsija has finished the race in first position i tako za druge pozicije a nezz kako da to uradim.
Dio skripte: //
Neke slike/video za lakse dobivanje pomoci(neobavezno): //

@Ino42O
@Butigan.MySql
@Bolex_
@CADILAB

public OnPlayerEnterRaceCheckpoint(playerid)
{
if(CPProgess == TotalCP -1)
{
new
    TimeStamp,
    TotalRaceTime,
    string,
    rFile,
    pName,
rTime,
Prize,
TempTotalTime,
TempTime
;
Position++;
GetPlayerName(playerid, pName, sizeof(pName));
TimeStamp = GetTickCount();
TotalRaceTime = TimeStamp - RaceTick;
ConvertTime(var, TotalRaceTime, rTime, rTime, rTime);
new DateTime, year, month, day, hour, minute, second;
getdate( year, month, day ); gettime( hour, minute, second );
format( DateTime, sizeof( DateTime ), "%d/%d/%d %d:%d:%d", day, month, year, hour, minute, second );
switch(Position)
{
    case 1: Prize = (random(random(5000)) + 10000), Prize = 10;
    case 2: Prize = (random(random(4500)) + 9000), Prize = 9;
    case 3: Prize = (random(random(4000)) + 8000), Prize = 8;
    case 4: Prize = (random(random(3500)) + 7000), Prize = 7;
    case 5: Prize = (random(random(3000)) + 6000), Prize = 6;
    case 6: Prize = (random(random(2500)) + 5000), Prize = 5;
    case 7: Prize = (random(random(2000)) + 4000), Prize = 4;
    case 8: Prize = (random(random(1500)) + 3000), Prize = 3;
    case 9: Prize = (random(random(1000)) + 2000), Prize = 2;
    default: Prize = random(random(1000)), Prize = 1;
}
format(string, sizeof(string), ">> \"%s\" has finished the race in position \"%d\".", pName, Position);
SendClientMessageToAll(WHITE, string);
format(string, sizeof(string), "    - Time: \"%d:%d.%d\".", rTime, rTime, rTime);
SendClientMessageToAll(WHITE, string);
format(string, sizeof(string), "    - Prize: \"$%d and +%d Score\".", Prize, Prize);
SendClientMessageToAll(WHITE, string);

if(FinishCount <= 5)
{
format(rFile, sizeof(rFile), "/xRaces/%s.RRACE", RaceName);
    format(string, sizeof(string), "BestRacerTime_%d", TimeProgress);
    TempTotalTime = dini_Int(rFile, string);
    ConvertTime(var1, TempTotalTime, TempTime, TempTime, TempTime);
    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\" has broken the record of \"%s\" with \"%d\" seconds faster on the \"%d\"'st/th place!", pName, dini_Get(rFile, string), -(rTime - TempTime), TimeProgress+1);
else format(string, sizeof(string), ">> \"%s\" has broken a new record of on the \"%d\"'st/th place!", 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);
SetPlayerScore(playerid, GetPlayerScore(playerid) + Prize);
DisablePlayerRaceCheckpoint(playerid);
CPProgess++;
if(FinishCount >= JoinCount) return StopRace();
    }
else
{
CPProgess++;
CPCoords[CPProgess]++;
RacePosition = floatround(CPCoords[CPProgess], floatround_floor);
    SetCP(playerid, CPProgess, CPProgess+1, TotalCP, RaceType);
    PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
}
    return 1;
}

Mate
5
Underboss
8. Jan. 2018.
Netko ?
Chezno
4
Enforcer
8. Jan. 2018.
Ne razumem sta je tu tesko.
Definises string, napravis proveru za poziciju i formatiras string i tjt.
new posname;
if(Position == 1) { posname = "first"; }
else if(Position == 2) { posname = "second"; }
else if(Position == 3) { posname = "third"; }
....

i onda
format(string, sizeof(string), ">> \"%s\" has finished the race in %s position".", pName, posname);
SendClientMessageToAll(WHITE, string);
ophion
5
OG Legend
13. Jan. 2018.


Prošlo 48h bez ikakvog odgovora na temu.

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava

© 2026 SmartShark. All rights reserved.

Powered by Momentum|v2026.3.001 Alpha