Jump to content

enum (Pawn) to LUA [RESOLVED]


Recommended Posts

Hi,

Sorry for my English (I use Google translation)

I am again MTA: DM, after a few tests, I still can not put an "array".

In fact, I coded PAWN and I adapt my script LUA. I will show you the table PAWN:

enum vInfo 
{ 
      id, 
      Float:pos_x, 
      Float:pos_y, 
      Float:pos_z, 
      Float:pos_za, 
      color1, 
      color2, 
}; 
new VehicleInfo[700][infoVeh]; 

I would like to adapt it to LUA.

Thank you in advance for your reply.

Edited by Guest
Link to comment

I guess you could do something like this

InfoVeh = { id, pos_x, pos_y, pos_z, pos_za, color1, color2 } 
VehicleInfo = {} 
for i=1,700 do -- from VehicleInfo[1] to VehicleInfo[700] 
    VehicleInfo[i] = InfoVeh 
end 

And later set the value like this:

VehicleInfo[13].id = 12 

Link to comment

Okay, thank's a lot Siyo ^^.

I'll try it now.

EDIT: I've got an error, but I don't found it:

line 4: VehInfo = {Model, Float:Pos_X, Float:Pos_Y, Float:Pos_Z, Float:Pos_ZA, Couleur1, Couleur2, Proprio, NomVehicule, Vendu} 
VehicleInfo = {} 

[01:22:42] SCRIPT ERROR: ...Bureau/Nouveau dossier (2)/mods/deathmatch/resourcecache/broph/broph.lua:4: function arguments expected near ','
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...