SA-MP Forums Archive
vehicle loading - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: vehicle loading (/showthread.php?tid=606428)



vehicle loading - ShoortyFl - 04.05.2016

I have a problem with loading vehicles, they spawn underground and idk what is the problem, loading;

pawn Код:
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;
            }
        }



Re: vehicle loading - Dayrion - 04.05.2016

They spawn underground at the correct coordinates ?


Re: vehicle loading - ShoortyFl - 04.05.2016

Village

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


Re: vehicle loading - Nin9r - 04.05.2016

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.


Re: vehicle loading - ShoortyFl - 04.05.2016

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:

pawn Код:
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

pawn Код:
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


Re: vehicle loading - Nin9r - 04.05.2016

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.


Re: vehicle loading - ShoortyFl - 04.05.2016

Can it be because CreateVehicle ?

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


Re: vehicle loading - Nin9r - 04.05.2016

It has no sense... Where are you using THREAD_UCITAJMOTORE ?


Re: vehicle loading - ShoortyFl - 04.05.2016

ongamemodeinit

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


Re: vehicle loading - Nin9r - 04.05.2016

Quote:
Originally Posted by ShoortyFl
Посмотреть сообщение
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.