Getting errors from a function
#1

So, this will be called by a timer for starting a new random race automatically.
pawn Код:
function StartNewRace()
{
    if(RaceBusy == 0)
    {
        LoadRaceNames();
        LoadRace(RaceNames[random(TotalRaces)]); // LINE 2548
    }
    return 1;
}
The errors are
Код:
C:\Users\Matt\Desktop\samp03z_svr_R1_win32\gamemodes\istunting.pwn(2548) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Reply
#2

Anyone? It's getting delayed.
Reply
#3

Show the random(TotalRaces)
Reply
#4

According to the error, the first argument in LoadRace is not an array. It might be the raceid (integer) so check it out and change it.
Reply
#5

This isn't a dynamic race system. It just runs a single race at a time.

LoadRaceNames function -
pawn Код:
function LoadRaceNames()
{
    new
        rNameFile[64],
        string[64]
    ;
    format(rNameFile, sizeof(rNameFile), "/RaceNames/RaceNames.txt");
    TotalRaces = dini_Int(rNameFile, "TotalRaces");
    Loop(x, TotalRaces)
    {
        format(string, sizeof(string), "Race_%d", x), strmid(RaceNames[x], dini_Get(rNameFile, string), 0, 20, sizeof(RaceNames));
        printf(">> Loaded Races: %s", RaceNames[x]);
    }
    return 1;
}
There isn't a stock / function for "random(TotalRaces)". / TotalRaces
Reply
#6

The error was given in line that uses LoadRace - that's the one you should search for.

random is a function by core.inc and TotalRaces is a variable so the problem has nothing to do with those two.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)