Whats the Problem with this script?
#1

Код:
enum VehInfo
{
    Name[24],
    Model,
    C1,
    C2,
    Locked,
    Float:vehix,
    Float:vehiy,
    Float:vehiz,
}
Код:
new VInfo[MAX_VEH][VehInfo];
Код:
AddVeh(vehiid, modelid, Float:vehiX, Float:vehiY, Float:vehiZ, color1, color2)
{
    new vehi[256];
    format(vehi, sizeof(vehi), "Vehicles/vehiid%d",vehiid);
    if(dini_Exists(vehi))
    {
      if(dini_Int(vehi, "Model")==0)
        {
          dini_IntSet(vehi, "Model", modelid);
          VInfo[vehiid][Model] = modelid;
          VInfo[vehiid][vehix] = vehiX;
          VInfo[vehiid][vehiy] = vehiY;
          VInfo[vehiid][vehiz] = vehiZ;
          dini_FloatSet(vehi, "vehix", vehiX);
          dini_FloatSet(vehi, "vehiy", vehiY);
          dini_FloatSet(vehi, "vehiz", vehiZ);
          VInfo[vehiid][C1] = color1;
          VInfo[vehiid][C2] = color2;
          dini_IntSet(vehi, "C1", color1);
          dini_IntSet(vehi, "C2", color2);
          VInfo[vehiid] = CreateVehicle(VInfo[vehiid][Model], vehiX, vehiY, vehiZ, 0.0, color1, color2);
          	print("-");
          print("--------------Vehicle Created--------------");
          printf("- Modelid: %d", modelid);
          printf("- Color 1: %d", color1);
          printf("- Color 2: %d", color2);
          print("---------------------------------------");
          print("-");
        }
        else
        {
          VInfo[vehiid][Model] = dini_Int(vehi, "Model");
        }
      	VInfo[vehiid][vehix] = dini_Int(vehi, "vehix");
      VInfo[vehiid][vehiy] = dini_Int(vehi, "vehiy");
      VInfo[vehiid][vehiz] = dini_Int(vehi, "vehiz");
      VInfo[vehiid][C1] = dini_Int(vehi, "C1");
      VInfo[vehiid][C2] = dini_Int(vehi, "C2");
      VInfo[vehiid] = CreateVehicle(VInfo[vehiid][Model], vehiX, vehiY, vehiZ, 0.0, color1, color2);
    }
}

And I get these errors/warnings:

Код:
C:\DOCUME~1\Jermaine\MYDOCU~1\OUTRAG~1\GAMEMO~1\ORP.pwn(4876) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jermaine\MYDOCU~1\OUTRAG~1\GAMEMO~1\ORP.pwn(4876) : error 033: array must be indexed (variable "VInfo")
C:\DOCUME~1\Jermaine\MYDOCU~1\OUTRAG~1\GAMEMO~1\ORP.pwn(4894) : warning 202: number of arguments does not match definition
C:\DOCUME~1\Jermaine\MYDOCU~1\OUTRAG~1\GAMEMO~1\ORP.pwn(4894) : error 033: array must be indexed (variable "VInfo")
Reply
#2

One thing :

pawn Код:
new VInfo[MAX_VEHICLES][VehInfo];
Reply
#3

Doesnt make a difference. =|
Reply
#4

Doesnt make a difference. =|
Reply
#5

No needed for Name[24] because you dont use it, like i see.
pawn Код:
enum VehInfo
{
    Model,
    C1,
    C2,
    Locked,
    Float:vehix,
    Float:vehiy,
    Float:vehiz
}

new VInfo[MAX_VEHICLES][VehInfo];
AddVeh last line
pawn Код:
CreateVehicle(VInfo[vehiid][Model], vehiX, vehiY, vehiZ, 0.0, color1, color2);

Reply
#6

did you try
pawn Код:
new Vinfo[MAX_VEHICLES][VehInfo];
enum VehInfo[7]
{
     Model,
     C1,
     C2,
     Locked,
     Float:vehix,
     Float:vehiy,
     Float:vehiz
}
I havent worked with enumerations in a while, but try that and let me know what happens.
I put 7 because there are 7 parts that are there, you would put more if there were more parts..

also, if you get the error saying expected ; but found {, by the [7], put a ; after the closing part.
Reply
#7

Parameters:
CreateVehicle(modelid, Float, Float:y,Float:z, Float:angle, color1, color2, respawn_delay)

Wrong
Код:
VInfo[vehiid] = CreateVehicle(VInfo[vehiid][Model], vehiX, vehiY, vehiZ, 0.0, color1, color2);
Correct
Код:
VInfo[vehiid][???] = CreateVehicle(VInfo[vehiid][Model], vehiX, vehiY, vehiZ, 0.0, color1, color2, ???);
VInfo is a two dimensional array, which cell are you accessing? Also CreateVehicle has 8 arguments, not 7. Just put the respawn delay in the last argument.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)