Jump to content
  • 0

Problema comanda /park


Claudiu2015

Question

Problema intalnita (descriere):Cand dau /park la masina personala nu se salveaza pozitia .
Ero(area / rile) / warning-(ul / urile):Nici-un warning/eroare doar ca nu se salveaza pozitia .
Liniile de cod / sursa / script-ul(obligatoriu):CMD:park ( playerid , params [ ] ) {

if ( IsPlayerConnected ( playerid ) ) {
   new
       Float: VPos [ 4 ] ,
key , HouseKey = PlayerInfo [ playerid ] [ pHouseKey ] ;
   if ( PlayerInfo [ playerid ] [ pPlayerConnected ] == 0 ) return SCM ( playerid , -1 , IsNotConnected ) ;
   if ( VPersSpawned [ playerid ] == MAX_PERSONALCARS ) return SCM ( playerid , -1 , ""ALB"You need a car so you can park visible." ) ;
   if ( IsPlayerInAnyVehicle ( playerid ) && ( VPersSpawned [ playerid ] == GetPlayerVehicleID ( playerid ) ) && ( GetPlayerState ( playerid ) == PLAYER_STATE_DRIVER ) ) {
if ( ( PlayerInfo [ playerid ] [ pHouseKey ] != MAX_HOUSES ) && ( PlayerToPoint ( 30 , playerid , HouseInfo [ HouseKey ] [ hIntrare ] [ 0 ] , HouseInfo [ HouseKey ] [ hIntrare ] [ 1 ] , HouseInfo [ HouseKey ] [ hIntrare ] [ 2 ] ) ) ) {
GetVehiclePos ( GetPlayerVehicleID ( playerid ) , VPos [ 0 ] , VPos [ 1 ] , VPos [ 2 ] ) ;
GetVehicleZAngle ( GetPlayerVehicleID ( playerid ) , VPos [ 3 ] ) ;
if ( SlotUSED [ playerid ] == 1 ) { key = PlayerInfo [ playerid ] [ pCarKey1 ] ; }
else if ( SlotUSED [ playerid ] == 2 ) { key = PlayerInfo [ playerid ] [ pCarKey2 ] ; }
else if ( SlotUSED [ playerid ] == 3 ) { key = PlayerInfo [ playerid ] [ pCarKey3 ] ; }
CarInfo [ key ] [ cLocation ] [ 0 ] = VPos [ 0 ] ;
CarInfo [ key ] [ cLocation ] [ 1 ] = VPos [ 1 ] ;
CarInfo [ key ] [ cLocation ] [ 2 ] = VPos [ 2 ] ;
CarInfo [ key ] [ cAngle ] = VPos [ 3 ] ;
mysql_format( gHandle, SQLString, sizeof( SQLString ), "UPDATE `%s` SET `LocationX` = '%f', `LocationY` = '%f', `LocationZ` = '%f', `Angle` = '%f' WHERE `CarID` = '%d' LIMIT 1",
DBNAME_PCARS,
CarInfo[ key ][ cLocation ][ 0 ],
CarInfo[ key ][ cLocation ][ 1 ],
CarInfo[ key ][ cLocation ][ 2 ],
CarInfo[ key ][ cAngle ],
key
);
mysql_tquery( gHandle, SQLString, "", "" );
SCM ( playerid , -1 , ""ALBASTRU"[ INFO ] The car was parked successful in this location." ) ;
}
else {
   if ( PlayerTicket [ playerid ] == false ) return SCM ( playerid , -1 , ""ALB"Need parking ticket from 24 / 7 to park the car." ) ;
                GetVehiclePos ( GetPlayerVehicleID ( playerid ) , VPos [ 0 ] , VPos [ 1 ] , VPos [ 2 ] ) ;
GetVehicleZAngle ( GetPlayerVehicleID ( playerid ) , VPos [ 3 ] ) ;
if ( SlotUSED [ playerid ] == 1 ) { key = PlayerInfo [ playerid ] [ pCarKey1 ] ; }
else if ( SlotUSED [ playerid ] == 2 ) { key = PlayerInfo [ playerid ] [ pCarKey2 ] ; }
else if ( SlotUSED [ playerid ] == 3 ) { key = PlayerInfo [ playerid ] [ pCarKey3 ] ; }
CarInfo [ key ] [ cLocation ] [ 0 ] = VPos [ 0 ] ;
CarInfo [ key ] [ cLocation ] [ 1 ] = VPos [ 1 ] ;
CarInfo [ key ] [ cLocation ] [ 2 ] = VPos [ 2 ] ;
CarInfo [ key ] [ cAngle ] = VPos [ 3 ] ;
mysql_format( gHandle, SQLString, sizeof( SQLString ), "UPDATE `%s` SET `LocationX` = '%f', `LocationY` = '%f', `LocationZ` = '%f', `Angle` = '%f' WHERE `CarID` = '%d' LIMIT 1",
DBNAME_PCARS,
CarInfo[ key ][ cLocation ][ 0 ],
CarInfo[ key ][ cLocation ][ 1 ],
CarInfo[ key ][ cLocation ][ 2 ],
CarInfo[ key ][ cAngle ],
key
);
mysql_tquery( gHandle, SQLString, "", "" );
SCM ( playerid , -1 , ""ALBASTRU"[ INFO ] The car was parked successful in this location , parking ticket was used." ) ;
PlayerTicket [ playerid ] = false ;
}
   }
   else return SCM ( playerid , -1 , ""ALB"To park your car must be driving them." ) ;
}
return 1 ;
}

Imagini / Video (optional):
Ati incercat sa rezolvati singur?:Am incercat sa inlocui ceva dar nu mi-a reusit .

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

Foloseste asa cand faci update:

 

mysql_format(gHandle, SQLString, "UPDATE `%s` SET `LocationX`='%f' WHERE `CarID`='%d'",DBNAME_PCARS,CarInfo[ key ][ cLocation ][ 0 ],key);
mysql_tquery(gHandle, SQLString, "", "" ) ;

Pune ca prima data sa distruga masina unde se afla jucatorul, dupa sa o creeze si sa-l bage inauntru. Folosestete de functiile astea:

DestroyVehicle
PutPlayerInVehicle
CreateVehicle
Edited by andy47
Link to comment
Share on other sites

  • 0

Incearca asa:

CMD:park ( playerid , params [ ] )
{
	if ( IsPlayerConnected ( playerid ) )
	{
		new Float: VPos [ 4 ] ,
			key ,
			HouseKey = PlayerInfo [ playerid ] [ pHouseKey ] ;

		if ( PlayerInfo [ playerid ] [ pPlayerConnected ] == 0 )
			return SCM ( playerid , -1 , IsNotConnected ) ;

		if ( VPersSpawned [ playerid ] == MAX_PERSONALCARS )
			return SCM ( playerid , -1 , ""ALB"You need a car so you can park visible." ) ;

		if ( IsPlayerInAnyVehicle ( playerid ) && ( VPersSpawned [ playerid ] == GetPlayerVehicleID ( playerid ) ) && ( GetPlayerState ( playerid ) == PLAYER_STATE_DRIVER ) )
		{
			GetVehiclePos ( GetPlayerVehicleID ( playerid ) , VPos [ 0 ] , VPos [ 1 ] , VPos [ 2 ] ) ;
			GetVehicleZAngle ( GetPlayerVehicleID ( playerid ) , VPos [ 3 ] ) ;
			if ( SlotUSED [ playerid ] == 1 ) { key = PlayerInfo [ playerid ] [ pCarKey1 ] ; }
			else if ( SlotUSED [ playerid ] == 2 ) { key = PlayerInfo [ playerid ] [ pCarKey2 ] ; }
			else if ( SlotUSED [ playerid ] == 3 ) { key = PlayerInfo [ playerid ] [ pCarKey3 ] ; }
			CarInfo [ key ] [ cLocation ] [ 0 ] = VPos [ 0 ] ;
			CarInfo [ key ] [ cLocation ] [ 1 ] = VPos [ 1 ] ;
			CarInfo [ key ] [ cLocation ] [ 2 ] = VPos [ 2 ] ;
			CarInfo [ key ] [ cAngle ] = VPos [ 3 ] ;
			DestroyVehicle( GetPlayerVehicleID( playerid ) ) ;
			new car = CreateVehicle(CarInfo[key][ cModel ],CarInfo[key][cLocation][0],CarInfo[key][cLocation][1],CarInfo[key][cLocation][2]+1.0,CarInfo[key][cAngle],CarInfo[key][cColorOne],CarInfo[key][cColorTwo],500000);
            PutPlayerInVehicle( playerid, car, 0 ) ;
			mysql_format( gHandle, SQLString, 256, "UPDATE `%s` SET `LocationX`='%f',`LocationY`='%f',`LocationZ`='%f',`Angle`='%f' WHERE `CarID`='%d'",
			DBNAME_PCARS,
			CarInfo[ key ][ cLocation ][ 0 ],
			CarInfo[ key ][ cLocation ][ 1 ],
			CarInfo[ key ][ cLocation ][ 2 ],
			CarInfo[ key ][ cAngle ],
			key
			);
			mysql_tquery( gHandle, SQLString, "", "" );
			SCM ( playerid , -1 , ""ALBASTRU"[ INFO ] The car was parked successful in this location." ) ;
		}
	}
	return 1 ;
}
Link to comment
Share on other sites

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.