Jump to content

Recommended Posts

Posted

	function LoadSVehicles() {
    new Cache: db = mysql_query (SQL, "SELECT * FROM `svehicles` ORDER BY `svehicles`.`vID` ASC");
    new x, servervehs = 0, result[256];
     for (new i, j = cache_get_row_count (); i != j; ++i) {
        servervehs ++;
           cache_get_field_content(i, "vID", result);                 x = strval(result);
           ServerVehicles[x][vID] = x;
           cache_get_field_content(i, "vModel", result);             ServerVehicles[x][vModel] = strval(result);
         cache_get_field_content(i, "LocationX", result);         ServerVehicles[x][vLocation][0] = floatstr(result);
          cache_get_field_content(i, "LocationY", result);         ServerVehicles[x][vLocation][1] = floatstr(result);
           cache_get_field_content(i, "LocationZ", result);         ServerVehicles[x][vLocation][2] = floatstr(result);
           cache_get_field_content(i, "Angle", result);             ServerVehicles[x][vAngle] = floatstr(result);
           cache_get_field_content(i, "Color1", result);             ServerVehicles[x][vColor][0] = strval(result);
          cache_get_field_content(i, "Color2", result);             ServerVehicles[x][vColor][1] = strval(result);
         cache_get_field_content(i, "Faction", result);             ServerVehicles[x][vFaction] = strval(result);
          cache_get_field_content(i, "Rank", result);             ServerVehicles[x][vRank] = strval(result);
        cache_get_field_content(i, "Virtual", result);             ServerVehicles[x][vVirtual] = strval(result);
	        if(ServerVehicles[x][vModel] >= 400 && ServerVehicles[x][vModel] <= 611) {
            ServerVehicles[x][vSpawned] = CreateVehicleEx(ServerVehicles[x][vModel], ServerVehicles[x][vLocation][0], ServerVehicles[x][vLocation][1], ServerVehicles[x][vLocation][2], ServerVehicles[x][vAngle], ServerVehicles[x][vColor][0], ServerVehicles[x][vColor][1], -1);
            new idd = ServerVehicles[x][vSpawned];
            SetVehicleVirtualWorld(idd, ServerVehicles[idd][vVirtual]);
            if(ServerVehicles[idd][vFaction] != 0) {
                if(ServerVehicles[idd][vModel] == 411) {
                    new policecar = CreateObject(19327, 1534.2373, -1643.2886, 5.9373, -87.6999, 90.4001, -87.1805);
                    SetObjectMaterialText(policecar, "POLICE", 0, 50, "Arial", 25, 1, -16777216, 0, 1);
                    new lspdcar = CreateObject(19419,0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);
                    AttachObjectToVehicle(policecar, idd, 0.0, -1.9, 0.3, 270.0, 0.0, 0.0);
                    AttachObjectToVehicle(lspdcar, idd, 0.0646, 0.1661, 0.6957, 0.0000, 0.0000, 0.0000);
                }
                if(ServerVehicles[idd][vModel] == 560) {
                    if(ServerVehicles[idd][vFaction] == 12 || ServerVehicles[idd][vFaction] == 13) {
                        new taiddiobj = CreateObject(19308, 0.00000, 0.00000, 0.00000,0.00000, 0.00000, 0.00000);
                        AttachObjectToVehicle(taiddiobj, idd, -0.00930, -0.23880, 0.92300,0.00000, 0.00000, 0.00000);
                    }
                }
                if(ServerVehicles[idd][vModel] == 541) {
                    if(ServerVehicles[idd][vFaction] == 2) {
                        new object1 = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                        new object2 = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                        AttachObjectToVehicle(object1, idd, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
                        AttachObjectToVehicle(object2, idd, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
                    }   
            }
    
            new str[64];
            if(ServerVehicles[idd][vFaction] != 0) format(str, 64, "F%d %d", ServerVehicles[idd][vFaction], idd);
            else format(str, sizeof(str), "RO-0%d", ServerVehicles[x][vSpawned]);
            SetVehicleNumberPlate(idd, str);
        }
    }
    printf("Server vehicles: %d", servervehs);
    cache_delete(db);
    return 1;

Ce nu imi iese de patesc asta, ce am gresit ?

poze - https://imgur.com/a/FUEfZsb

Posted
Acum 1 oră, [N]IZANNN a spus:

 


	function LoadSVehicles() {
    new Cache: db = mysql_query (SQL, "SELECT * FROM `svehicles` ORDER BY `svehicles`.`vID` ASC");
    new x, servervehs = 0, result[256];
     for (new i, j = cache_get_row_count (); i != j; ++i) {
        servervehs ++;
           cache_get_field_content(i, "vID", result);                 x = strval(result);
           ServerVehicles[x][vID] = x;
           cache_get_field_content(i, "vModel", result);             ServerVehicles[x][vModel] = strval(result);
         cache_get_field_content(i, "LocationX", result);         ServerVehicles[x][vLocation][0] = floatstr(result);
          cache_get_field_content(i, "LocationY", result);         ServerVehicles[x][vLocation][1] = floatstr(result);
           cache_get_field_content(i, "LocationZ", result);         ServerVehicles[x][vLocation][2] = floatstr(result);
           cache_get_field_content(i, "Angle", result);             ServerVehicles[x][vAngle] = floatstr(result);
           cache_get_field_content(i, "Color1", result);             ServerVehicles[x][vColor][0] = strval(result);
          cache_get_field_content(i, "Color2", result);             ServerVehicles[x][vColor][1] = strval(result);
         cache_get_field_content(i, "Faction", result);             ServerVehicles[x][vFaction] = strval(result);
          cache_get_field_content(i, "Rank", result);             ServerVehicles[x][vRank] = strval(result);
        cache_get_field_content(i, "Virtual", result);             ServerVehicles[x][vVirtual] = strval(result);
	        if(ServerVehicles[x][vModel] >= 400 && ServerVehicles[x][vModel] <= 611) {
            ServerVehicles[x][vSpawned] = CreateVehicleEx(ServerVehicles[x][vModel], ServerVehicles[x][vLocation][0], ServerVehicles[x][vLocation][1], ServerVehicles[x][vLocation][2], ServerVehicles[x][vAngle], ServerVehicles[x][vColor][0], ServerVehicles[x][vColor][1], -1);
            new idd = ServerVehicles[x][vSpawned];
            SetVehicleVirtualWorld(idd, ServerVehicles[idd][vVirtual]);
            if(ServerVehicles[idd][vFaction] != 0) {
                if(ServerVehicles[idd][vModel] == 411) {
                    new policecar = CreateObject(19327, 1534.2373, -1643.2886, 5.9373, -87.6999, 90.4001, -87.1805);
                    SetObjectMaterialText(policecar, "POLICE", 0, 50, "Arial", 25, 1, -16777216, 0, 1);
                    new lspdcar = CreateObject(19419,0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);
                    AttachObjectToVehicle(policecar, idd, 0.0, -1.9, 0.3, 270.0, 0.0, 0.0);
                    AttachObjectToVehicle(lspdcar, idd, 0.0646, 0.1661, 0.6957, 0.0000, 0.0000, 0.0000);
                }
                if(ServerVehicles[idd][vModel] == 560) {
                    if(ServerVehicles[idd][vFaction] == 12 || ServerVehicles[idd][vFaction] == 13) {
                        new taiddiobj = CreateObject(19308, 0.00000, 0.00000, 0.00000,0.00000, 0.00000, 0.00000);
                        AttachObjectToVehicle(taiddiobj, idd, -0.00930, -0.23880, 0.92300,0.00000, 0.00000, 0.00000);
                    }
                }
                if(ServerVehicles[idd][vModel] == 541) {
                    if(ServerVehicles[idd][vFaction] == 2) {
                        new object1 = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                        new object2 = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                        AttachObjectToVehicle(object1, idd, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
                        AttachObjectToVehicle(object2, idd, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
                    }   
            }
    
            new str[64];
            if(ServerVehicles[idd][vFaction] != 0) format(str, 64, "F%d %d", ServerVehicles[idd][vFaction], idd);
            else format(str, sizeof(str), "RO-0%d", ServerVehicles[x][vSpawned]);
            SetVehicleNumberPlate(idd, str);
        }
    }
    printf("Server vehicles: %d", servervehs);
    cache_delete(db);
    return 1;

 

Ce nu imi iese de patesc asta, ce am gresit ?

poze - https://imgur.com/a/FUEfZsb

Trebuie sa rescrii tot sistemul de factiuni !

Posted (edited)

nu trebuie totul tine de asta la

function LoadSVehicles()

nu am scris eu bine aici ceva...

 

oriiiii e ca tine =D

 

Edited by [N]IZANNN
Posted

Adauga la inceput asta:

 

new     // Police Department Vehicle Objects
		SirenaPD[MAX_VEHICLES],
		pd_car_obj_a,
		pd_car_obj_b,
		pd_car_obj_c,
		pd_car_obj_d,
		pd_car_obj_e,
		pd_car_obj_f;

Cauta primary key de la fiecare masina de politie si inlocuieste-le in codul asta:

if((newkeys & KEY_CROUCH)&&(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)) {
   	    new this_vehicle_id = GetPlayerVehicleID(playerid);
   	    if(this_vehicle_id == policecar[12])
 		{
   	        if(SirenaPD[policecar[12]] == 0) {
   	            SirenaPD[policecar[12]] = 1;
   	            DestroyObject(pd_car_obj_e);
   	            pd_car_obj_e = CreateObject(19419, 0, 0, 0, 0, 0, 0, 1000);
   	            AttachObjectToVehicle(pd_car_obj_c, policecar[12], -0.015000, -0.000000, 0.709999, 0.000000, 0.000000, 0.000000);
			}
			else
			{
   				SirenaPD[policecar[12]] = 0;
   	            DestroyObject(pd_car_obj_c);
   	            pd_car_obj_c = CreateObject(19420, 0, 0, 0, 0, 0, 0, 1000);
   	            AttachObjectToVehicle(pd_car_obj_e, policecar[12], -0.015000, -0.000000, 0.709999, 0.000000, 0.000000, 0.000000);
			}
		}
		else if(this_vehicle_id == policecar[13])
		{
   	        if(SirenaPD[policecar[13]] == 0) {
   	            SirenaPD[policecar[13]] = 1;
   	            DestroyObject(pd_car_obj_f);
   	            pd_car_obj_f = CreateObject(19419, 0, 0, 0, 0, 0, 0, 1000);
   	            AttachObjectToVehicle(pd_car_obj_d, policecar[13], -0.015000, -0.000000, 0.709999, 0.000000, 0.000000, 0.000000);
			}
			else
			{
   				SirenaPD[policecar[13]] = 0;
   	            DestroyObject(pd_car_obj_d);
   	            pd_car_obj_d = CreateObject(19420, 0, 0, 0, 0, 0, 0, 1000);
   	            AttachObjectToVehicle(pd_car_obj_f, policecar[13], -0.015000, -0.000000, 0.709999, 0.000000, 0.000000, 0.000000);
			}
		}
	}

Apoi asta:

	pd_car_obj_a = CreateObject(2659, 0, 0, 0, 0, 0, 0, 1000);
	pd_car_obj_b = CreateObject(2659, 0, 0, 0, 0, 0, 0, 1000);
 	pd_car_obj_c = CreateObject(19419, 0, 0, 0, 0, 0, 0, 1000);
	pd_car_obj_d = CreateObject(19419, 0, 0, 0, 0, 0, 0, 1000);
	pd_car_obj_e = CreateObject(19420, 0, 0, 0, 0, 0, 0, 1000);
	pd_car_obj_f = CreateObject(19420, 0, 0, 0, 0, 0, 0, 1000);

	SetObjectMaterialText(pd_car_obj_a, "{000000}POLICE", 0, 40, "Bold", 33, 1, 0xFFFFFFAA, 0, 1);
	SetObjectMaterialText(pd_car_obj_b, "{000000}POLICE", 0, 40, "Bold", 33, 1, 0xFFFFFFAA, 0, 1);

	AttachObjectToVehicle(pd_car_obj_a, policecar[12], 0.000000, -1.929998, 0.259999, -85.424964, 0.000000, 0.000000);
	AttachObjectToVehicle(pd_car_obj_b, policecar[13], 0.000000, -1.929998, 0.259999, -85.424964, 0.000000, 0.000000);

	AttachObjectToVehicle(pd_car_obj_e, policecar[12], -0.015000, -0.000000, 0.709999, 0.000000, 0.000000, 0.000000);
    AttachObjectToVehicle(pd_car_obj_f, policecar[13], -0.015000, -0.000000, 0.709999, 0.000000, 0.000000, 0.000000);

 

Acum pentru taxi, adauga asta:

new     // Taxi Cab Company Vehicle Objects
		taxi_car_obj_a,
		taxi_car_obj_b;

Apoi asta:

    taxi_car_obj_a = CreateObject(19308, 0.00, -0.22, 0.93,   0.00, 0.00, 0.00);
    taxi_car_obj_b = CreateObject(19308, 0.00, -0.22, 0.93,   0.00, 0.00, 0.00);

    AttachObjectToVehicle(taxi_car_obj_a, taxicar[19], 0.00, -0.22, 0.93, 0.00, 0.00, 0.00);
    AttachObjectToVehicle(taxi_car_obj_b, taxicar[20], 0.00, -0.22, 0.93, 0.00, 0.00, 0.00);

 

Nu stiu daca am omis ceva, da cred ca din tot codul asta il poti rescrie tu in asa fel incat sa functioneze.

Nu e facut de mine, l-am extras din alt GM.

  • 5 months later...
Posted

probabil nu se incarca obiectele acelea, verifica samp-server.exe sau log ul sa vezi daca se incarca

Posted

Problema asta o am si eu ..Am rescris de 3 ori functia LoadSVehicles dar degeaba ..

Totul a inceput de acum o luna cand am cumparat Sistemun Clan_Vehicles de la Edison si a trebuit sa imi scoata Functia asta si sa o mute pe Include..Cand am depistat Problema am bagat tot Include in GM si deloc ..Am luat un GM mai vechi sa vad cum are ,Am verificat tot ..Pana la sfarsit am facut Problema ..Dupa 2 Saptamani am luat o pauza la Gm ala ..Si hai sa ma reapuc de el ..Problema era alta ..Nu gaseam Versiunea in care era problema rezolvata..Si acum ma lupt iar cu asa ceva si nu imi dau seama!!

Dupa mine este ceva care opreste Obiectele sa apara ..Daca gasesc problema o postez aici !

Posted
On 7/23/2019 at 8:53 PM, [N]IZANNN said:

 


	function LoadSVehicles() {
    new Cache: db = mysql_query (SQL, "SELECT * FROM `svehicles` ORDER BY `svehicles`.`vID` ASC");
    new x, servervehs = 0, result[256];
     for (new i, j = cache_get_row_count (); i != j; ++i) {
        servervehs ++;
           cache_get_field_content(i, "vID", result);                 x = strval(result);
           ServerVehicles[x][vID] = x;
           cache_get_field_content(i, "vModel", result);             ServerVehicles[x][vModel] = strval(result);
         cache_get_field_content(i, "LocationX", result);         ServerVehicles[x][vLocation][0] = floatstr(result);
          cache_get_field_content(i, "LocationY", result);         ServerVehicles[x][vLocation][1] = floatstr(result);
           cache_get_field_content(i, "LocationZ", result);         ServerVehicles[x][vLocation][2] = floatstr(result);
           cache_get_field_content(i, "Angle", result);             ServerVehicles[x][vAngle] = floatstr(result);
           cache_get_field_content(i, "Color1", result);             ServerVehicles[x][vColor][0] = strval(result);
          cache_get_field_content(i, "Color2", result);             ServerVehicles[x][vColor][1] = strval(result);
         cache_get_field_content(i, "Faction", result);             ServerVehicles[x][vFaction] = strval(result);
          cache_get_field_content(i, "Rank", result);             ServerVehicles[x][vRank] = strval(result);
        cache_get_field_content(i, "Virtual", result);             ServerVehicles[x][vVirtual] = strval(result);
	        if(ServerVehicles[x][vModel] >= 400 && ServerVehicles[x][vModel] <= 611) {
            ServerVehicles[x][vSpawned] = CreateVehicleEx(ServerVehicles[x][vModel], ServerVehicles[x][vLocation][0], ServerVehicles[x][vLocation][1], ServerVehicles[x][vLocation][2], ServerVehicles[x][vAngle], ServerVehicles[x][vColor][0], ServerVehicles[x][vColor][1], -1);
            new idd = ServerVehicles[x][vSpawned];
            SetVehicleVirtualWorld(idd, ServerVehicles[idd][vVirtual]);
            if(ServerVehicles[idd][vFaction] != 0) {
                if(ServerVehicles[idd][vModel] == 411) {
                    new policecar = CreateObject(19327, 1534.2373, -1643.2886, 5.9373, -87.6999, 90.4001, -87.1805);
                    SetObjectMaterialText(policecar, "POLICE", 0, 50, "Arial", 25, 1, -16777216, 0, 1);
                    new lspdcar = CreateObject(19419,0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);
                    AttachObjectToVehicle(policecar, idd, 0.0, -1.9, 0.3, 270.0, 0.0, 0.0);
                    AttachObjectToVehicle(lspdcar, idd, 0.0646, 0.1661, 0.6957, 0.0000, 0.0000, 0.0000);
                }
                if(ServerVehicles[idd][vModel] == 560) {
                    if(ServerVehicles[idd][vFaction] == 12 || ServerVehicles[idd][vFaction] == 13) {
                        new taiddiobj = CreateObject(19308, 0.00000, 0.00000, 0.00000,0.00000, 0.00000, 0.00000);
                        AttachObjectToVehicle(taiddiobj, idd, -0.00930, -0.23880, 0.92300,0.00000, 0.00000, 0.00000);
                    }
                }
                if(ServerVehicles[idd][vModel] == 541) {
                    if(ServerVehicles[idd][vFaction] == 2) {
                        new object1 = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                        new object2 = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
                        AttachObjectToVehicle(object1, idd, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
                        AttachObjectToVehicle(object2, idd, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
                    }   
            }
    
            new str[64];
            if(ServerVehicles[idd][vFaction] != 0) format(str, 64, "F%d %d", ServerVehicles[idd][vFaction], idd);
            else format(str, sizeof(str), "RO-0%d", ServerVehicles[x][vSpawned]);
            SetVehicleNumberPlate(idd, str);
        }
    }
    printf("Server vehicles: %d", servervehs);
    cache_delete(db);
    return 1;

 

Ce nu imi iese de patesc asta, ce am gresit ?

poze - https://imgur.com/a/FUEfZsb

vezi la ongamemodeinit daca e LoadSVehicles, si cand pornesti sv, uita te in consola de la samp-server sa vezi daca se incarca.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.