PDA

View Full Version : vehicle loading


ShoortyFl
04/05/2016, 10:37 AM
I have a problem with loading vehicles, they spawn underground and idk what is the problem, loading;

case THREAD_UCITAJMOTORE:
{
if(szRows)
{
new temp[130];
for(new i = 0; i < cache_get_row_count(); i++)
{
cache_get_field_content(i, "Vlasnik", temp);
format(MoInfo[i][Vlasnik], 50, "%s", temp);

MoInfo[i][ID] = cache_get_field_content_int(i, "ID");
MoInfo[i][PozX] = cache_get_field_content_int(i, "PozX");
MoInfo[i][PozY] = cache_get_field_content_int(i, "PozY");
MoInfo[i][PozZ] = cache_get_field_content_int(i, "PozZ");
MoInfo[i][PozA] = cache_get_field_content_int(i, "PozA");
MoInfo[i][Model] = cache_get_field_content_int(i, "Model");
MoInfo[i][Cena] = cache_get_field_content_int(i, "Cena");
MoInfo[i][VW] = cache_get_field_content_int(i, "VW");
MoInfo[i][Interior] = cache_get_field_content_int(i, "Interior");
MoInfo[i][Zakljucan] = cache_get_field_content_int(i, "Zakljucan");
MoInfo[i][Boja1] = cache_get_field_content_int(i, "Boja1");
MoInfo[i][Boja2] = cache_get_field_content_int(i, "Boja2");
MoInfo[i][ImaVlasnika] = cache_get_field_content_int(i, "ImaVlasnika");

MoInfo[i][mOwned] = CreateVehicle_H(MoInfo[i][Model], MoInfo[i][PozX], MoInfo[i][PozY], MoInfo[i][PozZ]+0.2, MoInfo[i][PozA], 0, 0, 1000);
}
SpawnedMotora = szRows;
}
}

Dayrion
04/05/2016, 10:53 AM
They spawn underground at the correct coordinates ?

ShoortyFl
04/05/2016, 10:56 AM
Village

http://i.imgur.com/gqr7dhp.jpg

Nin9r
04/05/2016, 11:55 AM
That is the 0 point on the map. Maybe you put in database the default value on 0 for PosX,PosY,PosZ and you didn't park any car in another place to change these positions.

ShoortyFl
04/05/2016, 12:03 PM
I dont know, what i know is that i have a huge problem, i fixed spawn, buy keys are not working, i mean its not loading them right, ID of vehicles are the IDs saved player variables, which is fine, but i thing that it's mixing the models, cant tell why, something is off, please look at my code:

Loading motors:

case THREAD_UCITAJMOTORE:
{
if(szRows)
{
new temp[130];
for(new i = 0; i < cache_get_row_count(); i++)
{
cache_get_field_content(i, "Vlasnik", temp);
format(MoInfo[i][Vlasnik], 50, "%s", temp);

MoInfo[i][ID] = cache_get_field_content_int(i, "ID");
MoInfo[i][PozX] = cache_get_field_content_float(i, "PozX");
MoInfo[i][PozY] = cache_get_field_content_float(i, "PozY");
MoInfo[i][PozZ] = cache_get_field_content_float(i, "PozZ");
MoInfo[i][PozA] = cache_get_field_content_float(i, "PozA");
MoInfo[i][Model] = cache_get_field_content_int(i, "Model");
MoInfo[i][Cena] = cache_get_field_content_int(i, "Cena");
MoInfo[i][VW] = cache_get_field_content_int(i, "VW");
MoInfo[i][Interior] = cache_get_field_content_int(i, "Interior");
MoInfo[i][Zakljucan] = cache_get_field_content_int(i, "Zakljucan");
MoInfo[i][Boja1] = cache_get_field_content_int(i, "Boja1");
MoInfo[i][Boja2] = cache_get_field_content_int(i, "Boja2");
MoInfo[i][ImaVlasnika] = cache_get_field_content_int(i, "ImaVlasnika");

MoInfo[i][mOwned] = CreateVehicle_H(MoInfo[i][Model], MoInfo[i][PozX], MoInfo[i][PozY], MoInfo[i][PozZ]+0.2, MoInfo[i][PozA], 0, 0, 1000);
}
printf("Elite Team - Server je ucitao %d motora u vlasnistvu", szRows);
SpawnedMotora = szRows;
}
}

it loads them fine, but,

MoInfo[i][mOwned] = CreateVehicle_H

is making a problem, it's mixing vehicles, i mean models, and ids,

so when i do

if(GetPlayerVehicleID(playerid) != MoInfo[i][mOwned])
{
SCM(playerid, ERRORCOLOR, "[ERROR]: You're not in your vehicle.");
return 1;
}

its not working, when i locate my moto id points me to the other one :S

Nin9r
04/05/2016, 12:10 PM
This is because you didn't set the carsonserver number. I guess that you are using a older vehsystem and you have to count all the vehicles on your server and put LOADCARS(); on ONGAMEMODEINIT below them.

ShoortyFl
04/05/2016, 12:24 PM
Can it be because CreateVehicle ?

Because i want them to stay permanently, i will try with addstaticvehicleex

Nin9r
04/05/2016, 12:32 PM
It has no sense... Where are you using THREAD_UCITAJMOTORE ?

ShoortyFl
04/05/2016, 12:37 PM
ongamemodeinit

format(gQuery, 1500, "SELECT * FROM `Motori`");
mysql_function_query(konekt, gQuery, true, "OnQueryFinish", "i", THREAD_UCITAJMOTORE);

Nin9r
04/05/2016, 12:50 PM
ongamemodeinit

format(gQuery, 1500, "SELECT * FROM `Motori`");
mysql_function_query(konekt, gQuery, true, "OnQueryFinish", "i", THREAD_UCITAJMOTORE);

Ok, are you using it before or after the rest of vehicles? I mean, the vehicles from ONGAMEMODEINIT.

ShoortyFl
04/05/2016, 12:53 PM
before all vehicles

ShoortyFl
04/05/2016, 03:32 PM
Anyone ?

ShoortyFl
04/05/2016, 05:27 PM
Tried to debug it, loading vehicles mess samp vehicle ids,

for example

i sit on my bike and i did a debug it says

GetPlayerVehicleID - 455
Bike ID - 456