parameters error is coming

Started by kokia, Oct 21, 2015, 07:12 AM

Previous topic - Next topic

kokia

function LoadBases()
{
local i = 0;
while (i < 35)
{
Bases[i] = BaseClass();
local p = i.tostring();
Bases[i].Name = ReadIniString("bases.ini", p, "name");
Bases[i].CP = ReadIniString("bases.ini", p, "cp");
Bases[i].AttackSpawn = ReadIniString("bases.ini", p, "att");
Bases[i].DefenseSpawn = ReadIniString("bases.ini", p, "def");
i++;
}
}
function LoadPickups()
{
local i = 0;
while (i < 35)
{
local x = (GetTok(Bases[i].CP, ",", 1)).tostring(),
  y = (GetTok(Bases[i].CP, ",", 2)).tofloat(),
      z = (GetTok(Bases[i].CP, ",", 3)).tofloat();
CreatePickup(382, Vector(x, y, z));
i++;
}
 print("Loaded")
}
onserverstart
Bases <- array(35, null);
[spoiler=inifile]
[0]
cp=124.0107,-339.4061,36.2330
def=120.7456,-383.3260,36.3595
att=482.0498,835.1406,25.5501
name=Demolition Man
[1]
cp=345.0126,-276.5771,35.8813
def=297.7665,-209.5041,11.5254
att=482.0498,835.1406,25.5501
name=Construction Yard
[2]
cp=386.1981,-506.6573,9.3983
def=407.4069,-459.3660,10.1193
att=482.0498,835.1406,25.5501
name=VCPD
[3]
cp=-71.3566,83.0857,9.6832
def=-71.3566,83.0857,9.6832
att=482.0498,835.1406,25.5501
name=Bottom of Bridge
[4]
cp=54.5636,-937.9831,24.5730
def=54.5636,-937.9831,24.5730
att=482.0498,835.1406,25.5501
name=South Point Mall
[5]
cp=308.9213,1161.0549,22.7474
def=312.7891,1194.6662,22.7474
att=482.0498,835.1406,25.5501
name=Carpark
[6]
cp=-1066.7570,349.5940,11.2630
def=-1085.2926,331.3790,11.2630
att=482.0498,835.1406,25.5501
name=Phil's place
[7]
cp=-988.8309,263.8112,8.8125
def=-959.3351,267.9018,11.2630
att=482.0498,835.1406,25.5501
name=Printer near taxis
[8]
cp=-1188.9954,74.7693,11.1281
def=-1168.4934,85.5627,11.1279
att=482.0498,835.1406,25.5501
name=Haitian Drugbase
[9]
cp=-597.7075,634.2572,11.6765
def=-597.6194,657.0229,11.0739
att=482.0498,835.1406,25.5501
name=Biker Bar
[10]
cp=-562.0619,699.9868,20.7011
def=-588.0886,712.8249,20.5550
att=482.0498,835.1406,25.5501
name=Skumole Shack
[11]
cp=-568.9291,787.7806,22.8768
def=-567.8622,785.5654,22.8768
att=482.0498,835.1406,25.5501
name=Lower Office Building
[12]
cp=77.3401,1103.0327,32.6039
def=74.0175,1073.6988,15.3328
att=482.0498,835.1406,25.5501
name=Prawn Mansion
[13]
cp=-91.2452,932.5880,10.8337
def=-60.0477,936.3361,10.9401
att=482.0498,835.1406,25.5501
name=Film Studios
[14]
cp=558.8398,17.6127,52.7511
def=552.4447,-3.3015,14.3036
att=482.0498,835.1406,25.5501
name=WK Chariots Hotel
[15]
cp=230.3209,-1264.7224,20.1123
def=218.7902,-1285.2108,12.0829
att=482.0498,835.1406,25.5501
name=Ocean View Hotel
[16]
cp=114.3444,-1226.5134,24.5424
def=144.4494,-1224.7324,24.5424
att=482.0498,835.1406,25.5501
name=Carpark 2
[17]
cp=63.2068,-1449.0851,10.5656
def=82.0413,-1457.6528,11.6068
att=482.0498,835.1406,25.5501
name=Stripclub
[18]
cp=-1697.9498,-182.1340,23.8613
def=-1712.9678,-184.1474,14.8683
att=482.0498,835.1406,25.5501
name=Army
[19]
cp=-1440.1986,-883.8117,20.8979
def=-1440.1860,-883.6504,20.8979
att=482.0498,835.1406,25.5501
name=Airport
[20]
cp=-1192.3033,-1351.3890,11.4304
def=-1195.7324,-1328.7297,14.9360
att=482.0498,835.1406,25.5501
name=Airport Jetty
[21]
cp=-890.3447,-524.9782,29.2181
def=-913.7552,-559.6531,14.5553
att=482.0498,835.1406,25.5501
name=Cherry Poppers
[22]
cp=-663.1713,-1476.4097,13.8016
def=-684.4316,-1467.2001,11.8480
att=482.0498,835.1406,25.5501
name=Dock
[23]
cp=-1111.4783,-182.0833,23.0943
def=-1065.9365,-253.5378,18.1968
att=482.0498,835.1406,25.5501
name=Printworks
[24]
cp=-1262.6262,143.5957,26.5652
def=-1306.7770,170.5839,11.4814
att=482.0498,835.1406,25.5501
name=Junkyard
[25]
cp=-378.6839,-597.8572,9.9623
def=-378.5836,-598.4525,9.9623
att=482.0498,835.1406,25.5501
name=Vercetti Mansion Back
[26]
cp=-1116.7987,-606.7387,26.0573
def=-1122.4690,-659.9838,16.2525
att=482.0498,835.1406,25.5501
name=Robinas Cafe
[27]
cp=-694.9564,-1219.5049,16.3084
def=-678.5285,-1252.9448,35.2674
att=482.0498,835.1406,25.5501
name=Sailor Ship
[28]
cp=-847.0101,-71.5965,11.5386
def=-851.5379,-92.6048,11.1033
att=482.0498,835.1406,25.5501
name=Pharmacy
[29]
cp=-1046.6473,-516.2407,20.2994
def=-1046.6473,-516.2407,20.2994
att=482.0498,835.1406,25.5501
name=Rooftops Near CherryPoppers
[30]
cp=-975.7707,-830.8890,6.8009
def=-975.7707,-830.8890,6.8009
att=482.0498,835.1406,25.5501
name=Sunshine Autos
[31]
def=-664.5581,-1637.6881,18.5661
cp=-678.7174,-1631.8532,20.9614
att=-809.1567,1261.5865,24.7142
name=Far Ship
[32]
def=607.8477,-225.6814,13.8289
cp=623.9960,-267.4936,13.8289
name=Beach Resort
att=482.7106,835.3045,25.5501
[33]
cp=-274.7500,-300.4642,10.2977
def=-270.2983,-343.7532,11.0799
name=Starfish Mansion
att=482.0498,835.8213,25.5501
[34]
def=510.1350,-99.9183,10.5468
cp=464.6095,-54.3270,15.7037
name=Malibu
att=481.5668,835.6203,25.5501
int=17
[/spoiler]
error :
AN ERROR HAS OCCURED [parameter 1 has an invalid type 'null' ; expected: 'string']

CALLSTACK
*FUNCTION [GetTok()] functions.nut line [602]
*FUNCTION [LoadPickups()] functions.nut line [23]
*FUNCTION [onScriptLoad()] Main.nut line [56]

LOCALS
[m] 1
[vargv] ARRAY
[n] 1
[separator] ","
[string] NULL
[this] TABLE
0
[this] TABLE
[this] TABLE
function GetTok(string, separator, n, ...)
{
   line 602 local m = vargv.len() > 0 ? vargv[0] : n,
        tokenized = split(string, separator),
        text = "";
   
   if (n > tokenized.len() || n < 1) return null;
   for (; n <= m; n++)
   {
      text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];
   }
   return text;
}
line 23 in loadpickups            y = (GetTok(Bases.CP, ",", 2)).tofloat(),
line 57    LoadPickups();
and one more error input line too long in ini (176)

.

#1
Quote from: kokia on Oct 21, 2015, 07:12 AM...
error :
AN ERROR HAS OCCURED [parameter 1 has an invalid type 'null' ; expected: 'string']
...

What's so hard to understand about that :-\ Just read it. Seriously. READ IT!
.