• All Entities have an index of 0?
    2 replies, posted
So I am trying to get the shipment data. No luck so far. Weird thing is all the shipments I spawn have an ENT Index of 0. I save the table to a file so there isn't a problem in actually reading the table. I tried getting GetTable Keyvalues SaveTable Etc. Not sure what to do. The shipments I spawn are the ones I buy in the F4 menu. Some screenshots of the code [IMG]https://i.gyazo.com/fba660f1a3ca85c54fa528513b55da60.png[/IMG] [IMG]https://i.gyazo.com/67cafb38f9e7067d21f3b45f75e09a75.png[/IMG] Update* It seems the problem is that all my entities all have the Ent Index of 0. I don't know why. Anyone have this problem before? Update* Every entity does show the unique ID when I print out tostring(ent). But there is no index whenever I do tostring(ent.EntIndex)
You're doing this: [code] ent.EntIndex() [/code] While you should be doing either of these: [code] ent:EntIndex() ent.EntIndex(ent) [/code]
[QUOTE=mijyuoon;51133440]You're doing this: [code] ent.EntIndex() [/code] While you should be doing either of these: [code] ent:EntIndex() ent.EntIndex(ent) [/code][/QUOTE] Why? Isn't ent already defined so EntIndex knows what the ent is? I didn't realize EntIndex took parameters. Edit* Question still stands, I see now you replaced . with : which I get the syntax error but why define ent as a paramaeter in the second example you gave me? Not sure if I am right here but is it because ent:EntIndex() calls the action on the ent and ent.EntIndex is just the path for that action without actually calling it since there is no parameter? Like table.subtable() wouldn't work? [editline]30th September 2016[/editline] [QUOTE=mijyuoon;51133440]You're doing this: [code] ent.EntIndex() [/code] While you should be doing either of these: [code] ent:EntIndex() ent.EntIndex(ent) [/code][/QUOTE] I guess I kinda answered my own question. Another question for DarkRp, I was trying to get the shipment table so the code can tell what shipment it was but for some reason I can't find any code to be able to do that. I tried the keyvalues() the table(), savetable() pretty much a bunch of stuff on gmod wiki. Do you have any ideas on how I could do it?
Sorry, you need to Log In to post a reply to this thread.