SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 02/11/2015, 04:15 AM   #31
n0minal
High-roller
 
n0minal's Avatar
 
Join Date: Mar 2013
Location: Rio de Janeiro
Posts: 4,046
Reputation: 789
Default Re: All GTA SA Object Array

Edit (02/11/2015) - 06:11PM: Updated

I edited my version of this script, it compiles now really really fast and the whole San Andreas structure is loaded when the gamemode is started (takes 2 or 3 seconds to be fully loaded), so if you're going to use it, make sure that you'll place the read function on the top of your "OnGameModeInit" callback.

Example:

Code:
public OnGameModeInit()
{
  Read_SA_MAP();//reads the array of all gta:sa objects
  return 1;
}
File parser and structure (I changed the name of them but you can easily change it by yourself):

Code:
#define MAX_SA_OBJECTS  44764//updated

enum SA_MAP_INFO
{
  SA_MAP_Model,
  SA_MAP_LODModel,
  SA_MAP_Model_Name[32],
  Float:SA_MAP_X,
  Float:SA_MAP_Y,
  Float:SA_MAP_Z,
  Float:SA_MAP_RX,
  Float:SA_MAP_RY,
  Float:SA_MAP_RZ
};

new SA_MAP_Object[MAX_SA_OBJECTS][SA_MAP_INFO];

stock Read_SA_MAP()
{
  print("Parsing GTA:SA objects array.");
  new index, line[256], File:file_ptr;

  file_ptr = fopen("sanandreasarray.db", filemode:io_read);

  if(!file_ptr) return print("Error, server could not find SanAndreasArray.db");

  while(fread(file_ptr, line) > 0)
  {
    if(!sscanf(line, "p<,>dds[32]ffffff",
    SA_MAP_Object[index][SA_MAP_Model], SA_MAP_Object[index][SA_MAP_LODModel], SA_MAP_Object[index][SA_MAP_Model_Name],
    SA_MAP_Object[index][SA_MAP_X], SA_MAP_Object[index][SA_MAP_Y], SA_MAP_Object[index][SA_MAP_Z],
    SA_MAP_Object[index][SA_MAP_RX], SA_MAP_Object[index][SA_MAP_RY], SA_MAP_Object[index][SA_MAP_RZ]))
    {
      index++;
    }
  }
  fclose(file_ptr);
  printf("Server sucessfully parsed %d GTA:SA objects data.", index);
  return 1;
}
And last but not least, place the array database file on your scriptfiles folder:

Database download link (updated)

This process will save you too much time for compiling your script, you won't have to wait so much time to use this array anymore, all credits goes to Pottus, have fun

Last edited by n0minal; 02/11/2015 at 07:18 PM.
n0minal is offline   Reply With Quote
Old 02/11/2015, 04:51 AM   #32
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,885
Reputation: 1337
Default Re: All GTA SA Object Array

I am pretty sure this array is fucked up I need to update it I have a much better version in Texture Studio.
Pottus is offline   Reply With Quote
Old 02/11/2015, 04:55 AM   #33
s0nny
Banned
 
Join Date: Oct 2015
Posts: 19
Reputation: 8
Default Re: All GTA SA Object Array

Quote:
Originally Posted by Pottus View Post
I am pretty sure this array is fucked up I need to update it I have a much better version in Texture Studio.
Please give me the new array, I need to use accurate data on my script D:
s0nny is offline   Reply With Quote
Old 02/11/2015, 05:02 AM   #34
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,885
Reputation: 1337
Default Re: All GTA SA Object Array

Quote:
Originally Posted by s0nny View Post
Please give me the new array, I need to use accurate data on my script D:
The updated version has been uploaded check the first page.
Pottus is offline   Reply With Quote
Old 02/11/2015, 02:08 PM   #35
s0nny
Banned
 
Join Date: Oct 2015
Posts: 19
Reputation: 8
Default Re: All GTA SA Object Array

Quote:
Originally Posted by Pottus View Post
The updated version has been uploaded check the first page.
Thanks for sharing
s0nny is offline   Reply With Quote
Old 03/11/2015, 04:50 AM   #36
codectile
Huge Clucker
 
codectile's Avatar
 
Join Date: Jul 2014
Posts: 248
Reputation: 116
Default Re: All GTA SA Object Array

I don't think those rotation data are good enough. GTA SA follows a very weird rotation format. I am sure that you use quaternion - euler conversions, but those rotations should be not considered as x,y,z. The rotation here should be considered as yaw(z axis, should be inverted i.e. -yaw), pitch(y axis), roll(x axis). Believe me I tried your conversion algorithm but it didn't worked out well(for me, maybe), there could be a fault in my part as well. This is why I want you to try out the rotations conversions and apply them once again.

Last edited by codectile; 03/11/2015 at 09:59 AM. Reason: grammatical mistake
codectile is offline   Reply With Quote
Old 03/11/2015, 01:55 PM   #37
n0minal
High-roller
 
n0minal's Avatar
 
Join Date: Mar 2013
Location: Rio de Janeiro
Posts: 4,046
Reputation: 789
Default Re: All GTA SA Object Array

Quote:
Originally Posted by codectile View Post
I don't think those rotation data are good enough. GTA SA follows a very weird rotation format. I am sure that you use quaternion - euler conversions, but those rotations should be not considered as x,y,z. The rotation here should be considered as yaw(z axis, should be inverted i.e. -yaw), pitch(y axis), roll(x axis). Believe me I tried your conversion algorithm but it didn't worked out well(for me, maybe), there could be a fault in my part as well. This is why I want you to try out the rotations conversions and apply them once again.
I think it's good enough for the main purpose of it, remove objects, but yeah quaternions improvement would be really nice.
n0minal is offline   Reply With Quote
Old 03/11/2015, 02:11 PM   #38
codectile
Huge Clucker
 
codectile's Avatar
 
Join Date: Jul 2014
Posts: 248
Reputation: 116
Default Re: All GTA SA Object Array

Quote:
Originally Posted by ipsLeon View Post
I think it's good enough for the main purpose of it, remove objects, but yeah quaternions improvement would be really nice.
While developing cimulator I needed a function to convert quat-euler angles to simulate object rotation in SanAndreas and I implemented the conversion algorithm from ColAndreas(I was too lazy to code on my own) and believe me the result was not at all good. I resolved my problem by doing some research on GTA angles and used bullet's in built mechanism to generate accurate euler rotations. As I've previously said there could be a fault on my side, to be sure I want him to test it again.
codectile is offline   Reply With Quote
Old 05/12/2015, 10:44 PM   #39
IllidanS4
Huge Clucker
 
IllidanS4's Avatar
 
Join Date: Feb 2013
Posts: 200
Reputation: 275
Default Re: All GTA SA Object Array

So is there finally an object array both having correct angles and containing all the objects?
IllidanS4 is offline   Reply With Quote
Old 05/12/2015, 11:23 PM   #40
n0minal
High-roller
 
n0minal's Avatar
 
Join Date: Mar 2013
Location: Rio de Janeiro
Posts: 4,046
Reputation: 789
Default Re: All GTA SA Object Array

Quote:
Originally Posted by sprtik View Post
So is there finally an object array both having correct angles and containing all the objects?
Ofcourse, this include contains it, not a hundred percent but it's pretty much accurate.
n0minal is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
EditDynamicObject & Array of object ID [Help] Marricio Scripting Help 1 16/08/2012 09:07 AM
(dFile) error 047: array sizes do not match, or destination array is too small Jack_Leslie Scripting Help 0 06/09/2011 01:20 AM
[SOLVED]error 047: array sizes do not match, or destination array is too small help! Help Archive 7 18/06/2011 08:09 PM
[Sloved]error 047: array sizes do not match, or destination array is too small CoaPsyFactor Help Archive 1 09/06/2011 08:27 PM
<Php> 'Cannot use object of type stdClass as array' DeathOnaStick Help Archive 2 20/09/2010 04:48 PM


All times are GMT. The time now is 05:55 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.