Getting errors from a function - 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: Getting errors from a function (
/showthread.php?tid=504466)
Getting errors from a function -
biker122 - 04.04.2014
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
Re: Getting errors from a function -
biker122 - 04.04.2014
Anyone? It's getting delayed.
Re: Getting errors from a function -
Lidor124 - 04.04.2014
Show the random(TotalRaces)
Re: Getting errors from a function -
Konstantinos - 04.04.2014
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.
Re: Getting errors from a function -
biker122 - 04.04.2014
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
Re: Getting errors from a function -
Konstantinos - 04.04.2014
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.