Jump to content
Autentificarea cu Google și Facebook nu mai este disponibilă. ×
  • 0

Question

Posted (edited)

Salut,

Deci, nici mie nu imi vine sa cred, ca pun astfel de intrebare, dar.. se mai intampla :)). 

Deci, folosesc sistemul de masini personale din GM-ul Burned. Problema este, cand te deconectezi de pe server, nu dispar masiniile. 

functia pentru despawnare este: DestroyPlayerCar, din cate am inteles eu. Daca stie cineva solutia, as aprecia mult daca ma poate ajuta.

Multumesc anticipat!

Edited by Hudson.

9 answers to this question

Recommended Posts

  • 0
Posted (edited)

Din cate stiu la sistemul de vehicule de la burned este buguit

A 2-a problema ti se respawneaza vehiculele la 2 minute , chit ca este vehiculul ocupat chit ca nu .

Functiile pentru vehicule sunt acestea .

function DespawnVehicle(carid) {
	new dbid = FindSpawnID(carid);
	if(CarInfo[dbid][Spawned] != 0) DestroyPlayerCar(dbid);
	printf("Vehicle %d despawned. [db: %d]", carid, dbid);
	return 1;
}
stock DestroyPlayerCar(dbid) {
	if(CarInfo[dbid][Spawned] == 0) return 1;
	
	VehicleOwned[CarInfo[dbid][Spawned]] = 0;
	VehicleSQL[CarInfo[dbid][Spawned]] = 0;
		
	new Float: Pos[3];
	GetVehiclePos(CarInfo[dbid][Spawned], Pos[0], Pos[1], Pos[2]);
	if(CarInfo[dbid][cNeon] != 0) {
		DestroyDynamicObject(neon[0][CarInfo[dbid][Spawned]]);
		DestroyDynamicObject(neon[1][CarInfo[dbid][Spawned]]);
		neon[0][CarInfo[dbid][Spawned]] = 0;
		neon[1][CarInfo[dbid][Spawned]] = 0;	
	}
	if(strlen(CarInfo[dbid][cText]) >= 3) DestroyDynamicObject(nameobject[CarInfo[dbid][Spawned]]);
	CarInfo[dbid][cFuel] = Gas[CarInfo[dbid][Spawned]];
	new query[256];
	format(query, sizeof(query), "UPDATE `cars` SET `Fuel`='%d' WHERE `ID`='%d'", CarInfo[dbid][cFuel], dbid);
	mysql_query(SQL, query);
	
	CarInfo[dbid][cLastPos][0] = Pos[0];
	CarInfo[dbid][cLastPos][1] = Pos[1];
	CarInfo[dbid][cLastPos][2] = Pos[2];	
		
	DestroyVehicle(CarInfo[dbid][Spawned]);
	CarInfo[dbid][Spawned] = 0;
	new string[180];
	mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Spawned='%d' WHERE ID=%d", CarInfo[dbid][Spawned], dbid);
	mysql_tquery(SQL, string, "", "");
	return 1;
}

 

Edited by Marlboro

 

vldgIri.png

YouTube : Click Redirect Channel

Discord : Arabu#9330

Canal Discord : Click To Join

Facebook : Click Facebook

Instagram : Click Instagram

Skype : Mita.Official

Respectă și vei fi respectat !

  • 0
Posted (edited)

          

Citat

A 2-a problema ti se respawneaza vehiculele la 2 minute , chit ca este vehiculul ocupat chit ca nu .

 pentru problema asta, stergi randurile astea.

new carid = FindSpawnID(gLastCar[playerid]);
 if(carid != 0) VehicleTimer[gLastCar[playerid]] = SetTimerEx("DespawnVehicle", 60000*20, 0, "d", gLastCar[playerid]);

 

------------------------------------------

Am folosit la OnPlayerDisconect:

new cars = ?
DespawnVehicle(cars);

 

Edited by Hudson.
  • 0
Posted
new idd;
sVehicle[5][playerid] = idd;
new vsid = sVehicle[5][playerid];
DestroyPlayerCar(vsid);

Incearca.

  • 0
Posted
Acum 3 ore, Meneaito a spus:

new idd;
sVehicle[5][playerid] = idd;
new vsid = sVehicle[5][playerid];
DestroyPlayerCar(vsid);

Incearca.

Am mai încercat și așa, nu mergea. 

Insta am făcut alta chestie. Mulțumesc oricum.

T/C

  • 0
Posted
	if(PlayerInfo[playerid][pCarKey][0] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][0]);
	if(PlayerInfo[playerid][pCarKey][1] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][1]);
	if(PlayerInfo[playerid][pCarKey][2] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][2]);
	if(PlayerInfo[playerid][pCarKey][3] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][3]);
	if(PlayerInfo[playerid][pCarKey][4] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][4]);
	if(PlayerInfo[playerid][pCarKey][5] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][5]);
	if(PlayerInfo[playerid][pCarKey][6] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][6]);
	if(PlayerInfo[playerid][pCarKey][7] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][7]);
	if(PlayerInfo[playerid][pCarKey][8] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][8]);
	if(PlayerInfo[playerid][pCarKey][9] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][9]);

asta e si eu am avut aceasta problema si mi-o mers si ca sa nu se despawneze masinile in timp ce mergi:

ilocuiesti funcita ta cu asta

}
function DespawnVehicle(carid) {
	new dbid = FindSpawnID(carid);
	if(IsVehicleOccupied(CarInfo[carid][Spawned])) return 1;
	if(CarInfo[dbid][Spawned] != 0) DestroyPlayerCar(dbid);
	printf("Vehicle %d despawned. [db: %d]", carid, dbid);
	return 1;
}

practic ce e adaugat e verificarea ca daca masina e ocupata sa nu se despawneze nu iti recomand sa stergi timerul!

 

  • 0
Posted (edited)
Acum 1 minut, caltabos a spus:

	if(PlayerInfo[playerid][pCarKey][0] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][0]);
	if(PlayerInfo[playerid][pCarKey][1] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][1]);
	if(PlayerInfo[playerid][pCarKey][2] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][2]);
	if(PlayerInfo[playerid][pCarKey][3] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][3]);
	if(PlayerInfo[playerid][pCarKey][4] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][4]);
	if(PlayerInfo[playerid][pCarKey][5] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][5]);
	if(PlayerInfo[playerid][pCarKey][6] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][6]);
	if(PlayerInfo[playerid][pCarKey][7] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][7]);
	if(PlayerInfo[playerid][pCarKey][8] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][8]);
	if(PlayerInfo[playerid][pCarKey][9] != 0) DestroyPlayerCar(PlayerInfo[playerid][pCarKey][9]);

astea le pui la onplayerdisconnect

Edited by caltabos

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.