Posts: 117
Threads: 26
Joined: Jan 2016
Hello all. i am trying to make a dynamic tree system for decoration in house using mysql. i am just learning mysql.
so can you tell me what to do after i do select * from tree? how do i use variables to set
TreeInfo[treeid][tPosX] , [PosY] etc... from my database when filterscript starts. and then createobject(id, posx, posy....) please help me.
thank you
Posts: 1
Threads: 0
Joined: Mar 2017
Reputation:
0
Depends on version of your MySQL Plugin, U must load your values in variables
Posts: 582
Threads: 18
Joined: Jul 2010
Reputation:
0
Yes, you could ask someone to tell you how to do it, or, you could go on ****** and search for information where millions of threads already exist and have what you are looking for.
Posts: 117
Threads: 26
Joined: Jan 2016
i am using MySQL R5. i didnot find it on SAMP Wiki thats why i asked here. please help me.
Posts: 117
Threads: 26
Joined: Jan 2016
help me..........................
Posts: 117
Threads: 26
Joined: Jan 2016
I Need Help. please do it fast. i know the syntax but how do i use it in loop?
i mean, i know that i can use mysql_fetch_row(or something like this) to store it in variable. now how do i createobject because how do i use it in loop? and for how long should i run the loop..... so that i can create object with each number of rows.
please help me.
Posts: 117
Threads: 26
Joined: Jan 2016
Thank you very much for a example.
ill will reply back ASAP after testing. thanks.
Posts: 117
Threads: 26
Joined: Jan 2016
Can you give a example on how to store PositionX from database into a variable and use it to create Object?
Posts: 117
Threads: 26
Joined: Jan 2016
i found a tutorial on forus, will that be good for me? please check.
here is Object loading code:
Code:
orward LoadObjects(limit);
public LoadObjects(limit)
{
new count, rows, fields, data[50];
cache_get_data(rows, fields);
for(new i; i < rows; i++)
{
if(count > limit)
{
printf("Number of objects exceeded limit!");
break;
}
for(new h; h < sizeof(object); h++)
{
if(object[h][ScriptID] == 0)
{
cache_get_field_content(i, "ScriptID", data); object[h][ScriptID] = strval(data);
cache_get_field_content(i, "ModelID", data); object[h][ModelID] = strval(data);
cache_get_field_content(i, "X", data); object[h][X] = floatstr(data);
cache_get_field_content(i, "Y", data); object[h][Y] = floatstr(data);
cache_get_field_content(i, "Z", data); object[h][Z] = floatstr(data);
cache_get_field_content(i, "rX", data); object[h][rX] = floatstr(data);
cache_get_field_content(i, "rY", data); object[h][rY] = floatstr(data);
cache_get_field_content(i, "rZ", data); object[h][rZ] = floatstr(data);
CreateDynamicObject(object[h][ModelID], object[h][X], object[h][Y], object[h][Z], object[h][rX], object[h][rY], object[h][rZ]);
count++;
break;
}
}
}
printf("Current objects on the server: %d",CountDynamicObjects());
return 1;
}