Jump to content

Question

Posted

Salut, curand am schimbat intreg sistemul de trucker iar la selectarea unei rute nu i se ataseaza remorca.. ce ii pot face?

 

case 0:
			{
				new randomix = random(sizeof(gRandomTruck));
				SetPlayerCheckpoint(playerid, gRandomTruck[randomix][0],gRandomTruck[randomix][1],gRandomTruck[randomix][2], 4.0);
				Trailer[playerid] = CreateVehicle(435, pX+6, pY+6, pZ+6, vA, -1, -1, -1, 0);
				AttachTrailerToVehicle(Trailer[playerid], JobVehicle[playerid]);
				Trailer[playerid] = 1;
				SendClientMessage(playerid, -1, "{008080}TRUCKER >>{FFFFFF} Selected category: clothes {EEC271}(skill 1). {FFFFFF}Go to the checkpoint to deliver the cargo.");
			}

 

5 answers to this question

Recommended Posts

  • 0
Posted

Salut @GEORGIKAA,

Pai nu e ok, pentru ca in momentul in care tu opresti jobul, acea remorca o sa trebuiasca sa fie distrusa, si in loc sa fie distrus vehiculul cu id-ul remorcii, o sa fie distrus vehiculul cu id 1 de pe server.

Iar pentru problema cu remorca, am impresia ca trebuie sa o pui intr-un timer si sa o atasezi acolo. Parca era problema asta pe sa-mp.

Mai verifica daca nu cumva resetezi si variabila JobVehicle atunci cand dai iti creaza vehiculul de la job (/work sau ce ai tu). In cazul in care iti seteaza iar id 1, stergi si de acolo.

Daca te-am ajutat =>

spacer.png

  • 0
Posted
Acum 15 minute, shane a spus:

Mai verifica daca nu cumva resetezi si variabila JobVehicle atunci cand dai iti creaza vehiculul de la job (/work sau ce ai tu). In cazul in care iti seteaza iar id 1, stergi si de acolo.

Nu, nu am resetat-o in comanda work.

 

Acum 15 minute, shane a spus:

Iar pentru problema cu remorca, am impresia ca trebuie sa o pui intr-un timer si sa o atasezi acolo. Parca era problema asta pe sa-mp.

 

nu stiu cum as putea sa setez timerul, gen cand selecteaza ceva din dialogul ala doar atunci sa ii ataseze remorca de tir.

  • 0
Posted (edited)

@GEORGIKAA

Daca folosesti Y_Timers, timerul arata in felul urmator:

timer Attach_Trailer[ 1000 ]( playerid, trailerid ) {
	if( !IsPlayerInVehicle( playerid, JobVehicle[ playerid ] ) ) return true;
	new Float: pX, Float: pY, Float: pZ, Float: vX, Float: vY, Float: vZ;
	GetPlayerPos( playerid, pX, pY, pZ ), GetVehiclePos( trailerid, vX, vY, vZ );
	if( ( floatabs( pX - vX ) < 100.0 ) && ( floatabs( pY - vY ) < 100.0 ) && ( floatabs( pZ - vZ ) < 100.0 ) && ( trailerid != GetPlayerVehicleID( playerid ) ) )  AttachTrailerToVehicle( trailerid, GetPlayerVehicleID( playerid ) );
	return true; }

// in dialogul tau, cand selectezi cursa, adaugi ->
defer Attach_Trailer( playerid, Trailer[ playerid ] );

Daca ai timerele default, procedezi in felul urmator:

function Attach_Trailer( playerid ) {
	if( !IsPlayerInVehicle( playerid, JobVehicle[ playerid ] ) ) return true;
	new Float: pX, Float: pY, Float: pZ, Float: vX, Float: vY, Float: vZ;
	GetPlayerPos( playerid, pX, pY, pZ ), GetVehiclePos( Trailer[ playerid ], vX, vY, vZ );
	if( ( floatabs( pX - vX ) < 100.0 ) && ( floatabs( pY - vY ) < 100.0 ) && ( floatabs( pZ - vZ ) < 100.0 ) && ( Trailer[ playerid ] != GetPlayerVehicleID( playerid ) ) )  AttachTrailerToVehicle( Trailer[ playerid ], GetPlayerVehicleID( playerid ) );
	return true; }

// in dialogul tau, cand selectezi cursa, adaugi ->
SetTimerEx( "Attach_Trailer", 1000, false, "i", playerid );

 

Edited by shane
  • Thanks 1

Daca te-am ajutat =>

spacer.png

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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.