Jump to content

Question

Posted

Problema intalnita (descriere): Dupa fiecare restart se formeaza un bug prin care se poate intra in masinile personale chiar daca sunt incuiate. Daca intri intr-o masina personala si scrii /lock scrie ca s-a deblocat si se schimba culoarea de la "locked / unlocked", apoi daca o incui ramane incuiata. Cred ca la restart nu o mai recunoaste ca masina personala si trebuie sa intru in ea pentru a o incuia iar. Va rog sa va uitati mai jos la videoclip pentru a intelege exact care este problema.
Ero(area / rile) / warning-(ul / urile): Nu primesc erori sau warning-uri.
Liniile de cod / sursa / script-ul(obligatoriu):

OnVehicleSpawn:

public OnVehicleSpawn(vehicleid) {
	#if defined DEBUG
	    printf("[debug] OnVehicleSpawn(%d)", vehicleid);
	#endif
	
	switch(GetVehicleModel(vehicleid)) {
		case 427, 428, 432, 601, 528: SetVehicleHealth(vehicleid, 5000.0); // Enforcer, Securicar, Rhino, SWAT Tank, FBI truck - this is the armour plating dream come true.
	}
	Fuel[vehicleid] = 100;
	Radio[vehicleid] = 0;
	carboot[vehicleid] = 0;
	Bonnet[vehicleid] = 0;
	Trunk[vehicleid] = 0;
	if(vehicleVariables[vehicleid][vVehicleDS] == 1)
	{
		LinkVehicleToInterior(vehicleid, 1);
		SetVehicleVirtualWorld(vehicleid, 0);
	}
	return 1;
}

 

Comanda /lock:

CMD:lock(playerid, params[])
{
	new saveQuery[500];
	if(doesVehicleExist(playerVariables[playerid][pCarID]) && playerVariables[playerid][pCarModel] >= 1 || doesVehicleExist(playerVariables[playerid][pCarID2]) && playerVariables[playerid][pCarModel2] >= 1)
	{
		if(IsPlayerInRangeOfVehicle(playerid, playerVariables[playerid][pCarID], 5.0))
		{
			new string[256];
			if(playerVariables[playerid][pCarLock] == 0)
			{
					playerVariables[playerid][pCarLock] = 1;
					format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~%s ~r~locked", VehicleNames[playerVariables[playerid][pCarModel]-400]);
					GameTextForPlayer(playerid, string, 4000, 3);
					SetVehicleParamsEx(playerVariables[playerid][pCarID], 1, 0,0, 1, 0,0, 0);
					Engine[playerVariables[playerid][pCarID]] = 1;
			}
			else
			{
					playerVariables[playerid][pCarLock] = 0;
					format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~%s ~r~unlocked", VehicleNames[playerVariables[playerid][pCarModel]-400]);
					GameTextForPlayer(playerid, string, 4000, 3);
					SetVehicleParamsEx(playerVariables[playerid][pCarID], 1, 0,0, 0, 0,0, 0);
					Engine[playerVariables[playerid][pCarID]] = 1;
			}
			format(saveQuery, sizeof(saveQuery), "UPDATE playeraccounts SET playerCarLock = '%d' WHERE playerID = '%d'",playerVariables[playerid][pCarLock],playerVariables[playerid][pInternalID]);
			mysql_tquery(handle,saveQuery);
		}
		if(IsPlayerInRangeOfVehicle(playerid, playerVariables[playerid][pCarID2], 5.0))
		{
		    new string[256];
			if(playerVariables[playerid][pCarLock2] == 0)
			{
					playerVariables[playerid][pCarLock2] = 1;
					format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~%s ~r~locked", VehicleNames[playerVariables[playerid][pCarModel2]-400]);
					GameTextForPlayer(playerid, string, 4000, 3);
					SetVehicleParamsEx(playerVariables[playerid][pCarID2], 1, 0,0, 1, 0,0, 0);
					Engine[playerVariables[playerid][pCarID2]] = 1;
			}
			else
			{
					playerVariables[playerid][pCarLock2] = 0;
					format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~g~%s ~r~unlocked", VehicleNames[playerVariables[playerid][pCarModel2]-400]);
					GameTextForPlayer(playerid, string, 4000, 3);
					SetVehicleParamsEx(playerVariables[playerid][pCarID2], 1, 0,0, 0, 0,0, 0);
					Engine[playerVariables[playerid][pCarID2]] = 1;
			}
			format(saveQuery, sizeof(saveQuery), "UPDATE playeraccounts SET playerCarLock2 = '%d' WHERE playerID = '%d'", playerVariables[playerid][pCarLock2], playerVariables[playerid][pInternalID]);
			mysql_tquery(handle,saveQuery);
		}
	}
	return 1;
}


Imagini / Video (optional): https://youtu.be/vT-xu3kysl0
Ati incercat sa rezolvati singur?: Da, am incercat mai multe metode dar nici una nu a functionat.

2 answers to this question

Recommended Posts

  • 0
Posted

Problema ta este ca nu ai facut sa se salveze datele masinii -_-

Trebuie sa faci un sistem de salvare a datelor (de recomandat mysql) prin care fiecare masina si modificarile aduse ei sa se salveze in baza de date.

242086.png

Guest
This topic is now closed to further replies.
×
×
  • 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.