26.08.2010, 19:40
Hello,I insert car in server with "staticvehicles" Then i go to server but into my car can enter anybody.Bu i'm cop i need others players cant enter the PD car.What's wrong here ? HELP ME PLS
Код:
#if defined __vehicles__included #endinput #endif #define __vehicles__included #define TYPE_NONE 0 #define TYPE_POLICE 1 #define TYPE_MEDIC 2 #define TYPE_TV 3 #define TYPE_INSTR 4 #define TYPE_GOV 5 #define TYPE_FARM 6 #define TYPE_SWEEP 7 #define TYPE_BUS 8 #define TYPE_TAXI 9 new totalstaticvehicles, totalownablevehicles; stock NullVehicleVariables( ) { // Funkcija: NullVehicleVariables( ) for ( new i = 0; i < MAX_VEHICLES; i++ ) { Gas [ i ] = 100; Engine [ i ] = false; Window [ i ] = false; CarAlarm[ i ] = 0; for ( new slot = 0; slot < MAX_TRUNK_SLOTS; slot++ ) { vehTrunkWep [ i ][ slot ] = 0; vehTrunkAmmo [ i ][ slot ] = 0; } vehTrunkArmor[ i ] = 0; vehType [ i ] = 0; } } stock NullOwnableVehicleVariables( playerid ) { // Funkcija: NullOwnableVehicleVariables( playerid ) for ( new i = 0; i < MAX_OWNABLE_VEHICLES; i++ ) NullOwnableVehicleVariablesEx( playerid, i ); } stock NullOwnableVehicleVariablesEx( playerid, i ) { // Funkcija: NullOwnableVehicleVariablesEx( playerid, i ) VehInfo[ playerid ][ i ][ vDBID ] = 0; VehInfo[ playerid ][ i ][ vModel ] = 0; VehInfo[ playerid ][ i ][ vPos_x ] = 0.00000; VehInfo[ playerid ][ i ][ vPos_y ] = 0.00000; VehInfo[ playerid ][ i ][ vPos_z ] = 0.00000; VehInfo[ playerid ][ i ][ vAngle ] = 0.00000; VehInfo[ playerid ][ i ][ vColor1 ] = 0; VehInfo[ playerid ][ i ][ vColor2 ] = 0; VehInfo[ playerid ][ i ][ vSpawned ] = false; VehInfo[ playerid ][ i ][ vDestroys ] = 0; for ( new slot = 0; slot < MAX_TRUNK_SLOTS; slot++ ) { VehInfo[ playerid ][ i ][ vTrunkWep ][ slot ] = 0; VehInfo[ playerid ][ i ][ vTrunkAmmo ][ slot ] = 0; } VehInfo[ playerid ][ i ][ vTrunkArmor ] = 0; VehInfo[ playerid ][ i ][ vLock ] = 0; VehInfo[ playerid ][ i ][ vInsur ] = 0; VehInfo[ playerid ][ i ][ vImmob ] = 0; format( VehInfo[ playerid ][ i ][ vPlate ], 7, "Nera" ); VehInfo[ playerid ][ i ][ vAlarm ] = false; VehInfo[ playerid ][ i ][ vGas ] = 100; for ( new z = 0; z < 14; z++ ) VehInfo[ playerid ][ i ][ vMod ][ z ] = 0; } stock DublicateVehicleInfo( playerid, slot1, id, slot2 ) { // Funkcija: DublicateVehicleInfo( playerid, slot1, id, slot2 ) VehInfo[ playerid ][ slot1 ][ vDBID ] = VehInfo[ id ][ slot2 ][ vDBID ]; VehInfo[ playerid ][ slot1 ][ vModel ] = VehInfo[ id ][ slot2 ][ vModel ]; VehInfo[ playerid ][ slot1 ][ vPos_x ] = VehInfo[ id ][ slot2 ][ vPos_x ]; VehInfo[ playerid ][ slot1 ][ vPos_y ] = VehInfo[ id ][ slot2 ][ vPos_y ]; VehInfo[ playerid ][ slot1 ][ vPos_z ] = VehInfo[ id ][ slot2 ][ vPos_z ]; VehInfo[ playerid ][ slot1 ][ vAngle ] = VehInfo[ id ][ slot2 ][ vAngle ]; VehInfo[ playerid ][ slot1 ][ vColor1 ] = VehInfo[ id ][ slot2 ][ vColor1 ]; VehInfo[ playerid ][ slot1 ][ vColor2 ] = VehInfo[ id ][ slot2 ][ vColor2 ]; VehInfo[ playerid ][ slot1 ][ vSpawned ] = VehInfo[ id ][ slot2 ][ vSpawned ]; VehInfo[ playerid ][ slot1 ][ vDestroys ] = VehInfo[ id ][ slot2 ][ vDestroys ]; for ( new i = 0; i < MAX_TRUNK_SLOTS; i++ ) { VehInfo[ playerid ][ slot1 ][ vTrunkWep ][ i ] = VehInfo[ id ][ slot2 ][ vTrunkWep ][ i ]; VehInfo[ playerid ][ slot1 ][ vTrunkAmmo ][ i ] = VehInfo[ id ][ slot2 ][ vTrunkAmmo ][ i ]; } VehInfo[ playerid ][ slot1 ][ vTrunkArmor ] = VehInfo[ id ][ slot2 ][ vTrunkArmor ]; VehInfo[ playerid ][ slot1 ][ vLock ] = VehInfo[ id ][ slot2 ][ vLock ]; VehInfo[ playerid ][ slot1 ][ vInsur ] = VehInfo[ id ][ slot2 ][ vInsur ]; VehInfo[ playerid ][ slot1 ][ vImmob ] = VehInfo[ id ][ slot2 ][ vImmob ]; VehInfo[ playerid ][ slot1 ][ vPlate ] = VehInfo[ id ][ slot2 ][ vPlate ]; VehInfo[ playerid ][ slot1 ][ vAlarm ] = VehInfo[ id ][ slot2 ][ vAlarm ]; VehInfo[ playerid ][ slot1 ][ vGas ] = VehInfo[ id ][ slot2 ][ vGas ]; for ( new i = 0; i < 14; i++ ) VehInfo[ playerid ][ slot1 ][ vMod ][ i ] = VehInfo[ id ][ slot2 ][ vMod ][ i ]; } stock NullSOVehicleVar( vehid ) { // Funkcija: NullSOVehicleVar( vehid ) SVehInfo[ vehid ][ vDBID ] = 0; SVehInfo[ vehid ][ vOwner ] = 0; SVehInfo[ vehid ][ vLock ] = 0; SVehInfo[ vehid ][ vImmob ] = 0; SVehInfo[ vehid ][ vAlarm ] = false; Engine[ vehid ] = false; Window[ vehid ] = false; Gas [ vehid ] = 100; for ( new i = 0; i < MAX_TRUNK_SLOTS; i++ ) { vehTrunkWep [ vehid ][ i ] = 0; vehTrunkAmmo[ vehid ][ i ] = 0; } vehTrunkArmor[ vehid ] = 0; } //****************************************************************************** // SA:MP callbackai //****************************************************************************** public OnVehicleSpawn( vehicleid ) { // Callback: OnVehicleSpawn( vehicleid ) return true; } public OnVehicleStreamIn( vehicleid, forplayerid ) { // Callback: OnVehicleStreamIn( vehicleid ) if ( SVehInfo[ vehicleid ][ vLock ] > 0 ) SetVehicleParamsForPlayer( vehicleid, forplayerid, 0, 1 ); return true; } public OnVehicleDeath( vehicleid, killerid ) { // Callback: OnVehicleDeath( vehicleid, killerid ) if ( SVehInfo[ vehicleid ][ vDBID ] > 0 ) { new bool:save = true, playerid = GetPlayerIDBySQLID( SVehInfo[ vehicleid ][ vOwner ] ); if ( IsPlayerConnected( playerid ) ) { new slot = GetSlotOfCarID( playerid, vehicleid ); if ( slot < MAX_OWNABLE_VEHICLES ) { VehInfo[ playerid ][ slot ][ vDestroys ]++; new metai, menesis, diena, valanda, minute, sekunde; getdate( metai, menesis, diena ); gettime( valanda, minute, sekunde ); FixHour( valanda ); if ( VehInfo[ playerid ][ slot ][ vDestroys ] > VehInfo[ playerid ][ slot ][ vInsur ] ) { new string[ 158 ]; format( string, 158, "~w~Jusu transporto priemone nutempta \ i lauzyna. Jos daugiau draudimas nekompensuos.~n~_~n~Tr. pr. pav: ~g~%s~n~~w~Da\ ta: ~g~%d-%02d-%02d %d:%02d", GetVehicleName( VehInfo[ playerid ][ slot ][ vModel ] ), metai, menesis, diena, valanda, minute ); ShowInfoText ( playerid, string, 6000 ); DropVehicleRow( SVehInfo[ vehicleid ][ vDBID ] ); save = false; } else { new string[ 163 ]; format( string, 163, "~w~Jusu transporto priemonei prideta\ s vienas sunaikinimo taskas.~n~_~n~Tr. pr. pav: ~g~%s~n~~w~Data: ~g~%d-%02d-\ %02d %d:%02d~n~~w~Isv sunaik.: ~g~%d", GetVehicleName( VehInfo[ playerid ][ slot ][ vModel ] ), metai, menesis, diena, valanda, minute, VehInfo[ playerid ][ slot ][ vDestroys ] ); ShowInfoText( playerid, string, 5000 ); } } } DespawnOwnableVehicle( vehicleid, save ); } return true; } public OnPlayerEnterVehicle( playerid, vehicleid, ispassenger ) { // Callback: OnPlayerEnterVehicle( playerid, vehicleid, ispassenger ) foreach (Player, i) { if ( Spectate[ i ] == playerid ) PlayerSpectateVehicle( i, vehicleid ); } if ( !ispassenger ) { if ( !PlayerHasAccessToVehicle( playerid, vehicleid ) ) { new Float:x, Float:y, Float:z; GetPlayerPos( playerid, x, y, z ); SetPlayerPos( playerid, x, y, z ); } if ( !TLesson[ playerid ] ) { new model = GetVehicleModel( vehicleid ); if ( !PlayerInfo[ playerid ][ pFlyingLic ] && IsAPlane( model ) ) { new Float:x, Float:y, Float:z; GetPlayerPos( playerid, x, y, z ); SetPlayerPos( playerid, x, y, z ); SendClientMessage( playerid, COLOR_GREY, " Jūs dar nemokate skraidyti." ); } if ( !PlayerInfo[ playerid ][ pBoatLic ] && IsABoat( model ) ) { new Float:x, Float:y, Float:z; GetPlayerPos( playerid, x, y, z ); SetPlayerPos( playerid, x, y, z ); SendClientMessage( playerid, COLOR_GREY, " Jūs dar nemokate vairuoti katerio/laivo." ); } } } return true; } public OnPlayerExitVehicle( playerid, vehicleid ) { // Callback: OnPlayerExitVehicle( playerid, vehicleid ) foreach (Player, i) { if ( Spectate[ i ] == playerid ) PlayerSpectatePlayer( i, playerid ); } return true; } public OnVehicleMod( playerid, vehicleid, componentid ) { // Callback: OnVehicleMod( playerid, vehicleid, componentid ) if ( IsPlayerConnected( playerid ) ) BanPlayer( "Skujus", playerid, "Tr. priemonių tiuningavimo čytas" ); // Vehicle mod anti-crash (sukūrė Crack, Davee ir 0xF29323) // Uћkomentuojame dėl vehicle mod anti-čyto /*new model = GetVehicleModel( vehicleid ); switch( componentid ) { case 1000: { switch( model ) { case 589, 492, 516, 404, 547, 489, 505, 405, 421: return true; } } case 1001: { switch( model ) { case 496, 401, 518, 527, 415, 585, 546, 410, 603, 426, 436, 405, 580, 439, 550, 549, 420, 540, 529: return true; } } case 1002: { switch( model ) { case 496, 546, 517, 551, 418, 516, 404, 489, 505: return true; } } case 1003: { switch( model ) { case 496, 401, 518, 415, 585, 517, 410, 551, 426, 436, 547, 439, 550, 549, 420, 491, 529: return true; } } case 1004: { switch( model ) { case 401, 589, 492, 546, 516, 600, 426, 489, 505, 550, 420, 540, 478: return true; } } case 1005: { switch( model ) { case 401, 518, 589, 492, 551, 600, 426, 489, 505, 550, 420, 478: return true; } } case 1006: { switch( model ) { case 496, 401, 518, 589, 585, 492, 546, 551, 418, 603, 600, 426, 436, 489, 505, 580, 550, 540, 529, 477: return true; } } case 1007, 1017: { switch( model ) { case 496, 422, 401, 518, 527, 415, 589, 585, 546, 517, 410, 516, 404, 603, 600, 436, 580, 439, 549, 540, 491, 529, 477: return true; } } case 1011: { switch( model ) { case 496, 549, 529: return true; } } case 1012: { switch( model ) { case 549, 478, 529: return true; } } case 1013: { switch( model ) { case 422, 401, 518, 589, 585, 400, 410, 500, 404, 600, 436, 489, 505, 478, 439: return true; } } case 1014: { switch( model ) { case 527, 542, 405, 491, 421: return true; } } case 1015: { switch( model ) { case 527, 542, 516: return true; } } case 1016: { switch( model ) { case 589, 492, 517, 551, 418, 516, 404, 547, 489, 505, 421: return true; } } case 1018: { switch( model ) { case 518, 527, 415, 542, 589, 585, 546, 400, 517, 551, 516, 603, 600, 547, 489, 505, 405, 580, 550, 549, 540, 491, 421, 529, 477: return 1; } } case 1019: { switch( model ) { case 496, 422, 401, 415, 542, 585, 546, 400, 517, 410, 551, 500, 516, 404, 603, 426, 436, 547, 489, 505, 405, 550, 549, 420, 540, 491, 421, 529, 477: return true; } } case 1020: { switch( model ) { case 496, 422, 401, 518, 527, 542, 589, 585, 400, 517, 410, 551, 500, 418, 516, 404, 603, 600, 436, 547, 489, 505, 405, 580, 550, 549, 540, 491, 478, 421, 529, 477: return true; } } case 1021: { switch( model ) { case 422, 527, 542, 400, 410, 551, 500, 418, 516, 404, 426, 436, 547, 405, 420, 491, 478, 421, 477: return true; } } case 1022: { switch( model ) { case 600, 436, 478: return true; } } case 1023: { switch( model ) { case 496, 518, 415, 585, 546, 517, 410, 551, 603, 405, 580, 439, 550, 549, 540, 491, 421, 529: return true; } } case 1024: { switch( model ) { case 589, 546, 400, 410, 500, 603, 489, 505, 540, 478: return true; } } case 1008..1010, 1025, 1073..1087, 1096..1098: { if( IsTransfenderVehicle( model ) || IsLocolowVehicle( model ) || IsWAAVehicle( model ) ) return true; } case 1190..1193, 1134..1137: { if( model == 576 ) return true; } case 1186..1189, 1129..1133, 1102: { if( model == 567 ) return true; } case 1181..1184, 1128, 1107..1108, 1103..1105: { if( model == 536 ) return true; } case 1185, 1178..1180, 1122..1127, 1106, 1100..1101: { if( model == 534 ) return true; } case 1174..1177, 1099, 1042..1044: { if( model == 575 ) return true; } case 1173, 1158..1162, 1065..1072: { if( model == 559 ) return true; } case 1171..1172, 1146..1149, 1034..1041: { if( model == 562 ) return true; } case 1169..1170, 1138..1141, 1026..1033: { if( model == 560 ) return true; } case 1163..1168, 1088..1095: { if( model == 558 ) return true; } case 1154..1157, 1055..1064: { if( model == 561 ) return true; } case 1150..1153, 1045..1054: { if( model == 565 ) return true; } case 1109..1121: { if( model == 535 ) return true; } case 1142..1145: { switch( model ) { case 401, 518, 542, 589, 585, 546, 517, 603, 439, 550, 549, 540, 491: return true; } } }*/ return false; } //****************************************************************************** // Apraљytos funkcijos is callbackai //****************************************************************************** stock IsTransfenderVehicle( model ) { // Funkcija: IsTransfenderVehicle( model ) switch( model ) { case 400, 401, 402, 404, 405, 409, 410, 411, 415, 418, 419, 420, 421, 422, 424, 426, 436, 438, 439, 442, 445, 451, 458, 466, 467, 474, 475, 477, 478, 479, 480, 489, 491, 492, 496, 500, 505, 506, 507, 516, 517, 518, 527, 526, 529, 533, 540, 541, 542, 545, 546, 547, 549, 550, 551, 555, 575, 579, 580, 585, 587, 589, 600, 602, 603: return true; } return false; } stock IsLocolowVehicle( model ) { // Funkcija: IsLocolowVehicle( model ) switch( model ) { case 412, 534, 535, 536, 566, 567, 576: return true; } return false; } stock IsWAAVehicle( model ) { // Funkcija: IsWAAVehicle( model ) switch( model ) { case 558, 559, 560, 561, 562, 565: return true; } return false; } stock VehSync( vehid, playerid ) { // Funkcija: VehSync( vehid, playerid ) new slot = GetSlotOfCarID( playerid, vehid ); for ( new i = 0; i < MAX_TRUNK_SLOTS; i++ ) { VehInfo[ playerid ][ slot ][ vTrunkWep ][ i ] = vehTrunkWep [ vehid ][ i ]; VehInfo[ playerid ][ slot ][ vTrunkAmmo ][ i ] = vehTrunkAmmo[ vehid ][ i ]; } VehInfo[ playerid ][ slot ][ vTrunkArmor ] = vehTrunkArmor[ vehid ]; VehInfo[ playerid ][ slot ][ vGas ] = Gas [ vehid ]; for ( new i = 0; i < 14; i++ ) VehInfo[ playerid ][ slot ][ vMod ][ i ] = GetVehicleComponentInSlot( vehid, i ); } stock SetVehicleOwner( vehid, playerid ) { // Funkcija: SetVehicleOwner( vehid, playerid ) SVehInfo[ vehid ][ vOwner ] = PlayerInfo[ playerid ][ pSQLID ]; } stock GetFreeVehicleSlot( playerid ) { // Funkcija: GetFreeVehicleSlot( playerid ) for ( new i = 0; i < MAX_OWNABLE_VEHICLES; i++ ) if ( VehInfo[ playerid ][ i ][ vDBID ] == 0 ) return i; return MAX_OWNABLE_VEHICLES; } stock CheckIfPlayerHasSpawnedVehicle( playerid ) { // Funkcija: CheckIfPlayerHasSpawnedVehicle( playerid ) for ( new i = 0; i < MAX_OWNABLE_VEHICLES; i++ ) if ( VehInfo[ playerid ][ i ][ vSpawned ] ) return true; return false; } stock CheckIfAnyVehIsSpawned( playerid ) { // Funkcija: CheckIfAnyVehIsSpawned( playerid ) for ( new b = totalstaticvehicles; b < MAX_VEHICLES; b++ ) { if ( PlayerInfo[ playerid ][ pSQLID ] == SVehInfo[ b ][ vOwner ] ) { // Dabar reikia susynchronizinti new slot = GetSlotOfCarByDBID( playerid, SVehInfo[ b ][ vDBID ] ); VehInfo[ playerid ][ slot ][ vSpawned ] = true; } } } stock GetSlotOfSpawnedVehicle( playerid ) { // Funkcija: GetSlotOfSpawnedVehicle( playerid ) for ( new i = 0; i < MAX_OWNABLE_VEHICLES; i++ ) if ( VehInfo[ playerid ][ i ][ vSpawned ] ) return i; return MAX_OWNABLE_VEHICLES; } stock GetVehIdBySlot( playerid, slot ) { // Funkcija: GetVehIdBySlot( playerid, slot ) for ( new i = totalstaticvehicles; i < MAX_VEHICLES; i++ ) { if ( SVehInfo[ i ][ vDBID ] == VehInfo[ playerid ][ slot ][ vDBID ] ) return i; } return MAX_VEHICLES; } stock AssignVehiclesToPlayerFromDB( playerid ) { // Funkcija: AssignVehiclesToPlayerFromDB( playerid ) // Priskirs kintamiesiems reikљmę MySQLCheckConnection( ); new idx = 0, row[ 256 ]; format( row, 256, "SELECT * FROM `ownablevehicles` WHERE `owner`=%d", PlayerInfo[ playerid ][ pSQLID ] ); mysql_query ( row ); mysql_store_result( ); while( mysql_fetch_row( row ) ) { new modstring[ 74 ]; sscanf( row, "p<|>d{d}dffffddddddddddddddds[7]dds[74]", VehInfo[ playerid ][ idx ][ vDBID ], VehInfo[ playerid ][ idx ][ vModel ], VehInfo[ playerid ][ idx ][ vPos_x ], VehInfo[ playerid ][ idx ][ vPos_y ], VehInfo[ playerid ][ idx ][ vPos_z ], VehInfo[ playerid ][ idx ][ vAngle ], VehInfo[ playerid ][ idx ][ vColor1 ], VehInfo[ playerid ][ idx ][ vColor2 ], VehInfo[ playerid ][ idx ][ vDestroys ], VehInfo[ playerid ][ idx ][ vTrunkWep ][ 0 ], VehInfo[ playerid ][ idx ][ vTrunkAmmo ][ 0 ], VehInfo[ playerid ][ idx ][ vTrunkWep ][ 1 ], VehInfo[ playerid ][ idx ][ vTrunkAmmo ][ 1 ], VehInfo[ playerid ][ idx ][ vTrunkWep ][ 2 ], VehInfo[ playerid ][ idx ][ vTrunkAmmo ][ 2 ], VehInfo[ playerid ][ idx ][ vTrunkWep ][ 3 ], VehInfo[ playerid ][ idx ][ vTrunkAmmo ][ 3 ], VehInfo[ playerid ][ idx ][ vTrunkArmor ], VehInfo[ playerid ][ idx ][ vLock ], VehInfo[ playerid ][ idx ][ vInsur ], VehInfo[ playerid ][ idx ][ vImmob ], VehInfo[ playerid ][ idx ][ vPlate ], VehInfo[ playerid ][ idx ][ vAlarm ], VehInfo[ playerid ][ idx ][ vGas ], modstring ); UnpackCarMod( modstring, VehInfo[ playerid ][ idx ][ vMod ] ); idx++; } mysql_free_result( ); CheckIfAnyVehIsSpawned( playerid ); } stock UnpackCarMod( const modstring[ ], modarray[ ] ) { // Funkcija: UnpackCarMod( modstring[ ], modarray[ ] ) sscanf( modstring, "p<->a<d>[14]", modarray ); } stock PackCarMod( const modarray[ ] ) { // Funkcija: PackCarMod( const modarray[ ] ) new modstring[ 74 ], pirmas = true; for ( new i = 0; i < 14; i++ ) { if ( modarray[ i ] > 999 && modarray[ i ] < 1194 ) { if ( pirmas ) pirmas = false; else format( modstring, 74, "%s-", modstring ); format( modstring, 74, "%s%d", modstring, modarray[ i ] ); } } return modstring; } stock SpawnOwnableVehicle( playerid, id ) { // Funkcija: SpawnOwnableVehicle( playerid, id ) new vehid = CreateVehicle( VehInfo[ playerid ][ id ][ vModel ], VehInfo[ playerid ][ id ][ vPos_x ], VehInfo[ playerid ][ id ][ vPos_y ], VehInfo[ playerid ][ id ][ vPos_z ], VehInfo[ playerid ][ id ][ vAngle ], VehInfo[ playerid ][ id ][ vColor1 ], VehInfo[ playerid ][ id ][ vColor2 ], 30000 ); VehInfo[ playerid ][ id ][ vSpawned ] = true; SVehInfo[ vehid ][ vDBID ] = VehInfo[ playerid ][ id ][ vDBID ]; SVehInfo[ vehid ][ vOwner ] = PlayerInfo[ playerid ][ pSQLID ]; SVehInfo[ vehid ][ vImmob ] = VehInfo[ playerid ][ id ][ vImmob ]; SVehInfo[ vehid ][ vAlarm ] = VehInfo[ playerid ][ id ][ vAlarm ]; if ( VehInfo[ playerid ][ id ][ vLock ] > 0 ) { LockVehicleForPlayers( vehid, true ); SVehInfo[ vehid ][ vLock ] = VehInfo[ playerid ][ id ][ vLock ]; } // Sutvarkom bagaћinę for ( new i = 0; i < MAX_TRUNK_SLOTS; i++ ) { vehTrunkWep [ vehid ][ i ] = VehInfo[ playerid ][ id ][ vTrunkWep ][ i ]; vehTrunkAmmo[ vehid ][ i ] = VehInfo[ playerid ][ id ][ vTrunkAmmo ][ i ]; } vehTrunkArmor[ vehid ] = VehInfo[ playerid ][ id ][ vTrunkArmor ]; //SetVehicleNumberPlate( vehid, VehInfo[ playerid ][ id ][ vPlate ] ); SetVehicleToRespawn ( vehid ); Gas[ vehid ] = VehInfo[ playerid ][ id ][ vGas ]; // Sutvarkom su tiuningu for ( new i = 0; i < 14; i++ ) { new comp = VehInfo[ playerid ][ id ][ vMod ][ i ]; if ( comp > 999 && comp < 1194 ) AddVehicleComponent( vehid, comp ); } totalownablevehicles++; } stock DespawnOwnableVehicle( vehid, bool:save = true ) { // Funkcija: DespawnOwnableVehicle( vehid ) new playerid = GetPlayerIDBySQLID( SVehInfo[ vehid ][ vOwner ] ); if ( playerid != INVALID_PLAYER_ID ) { new slot = GetSlotOfCarID( playerid, vehid ); VehSync( vehid, playerid ); VehInfo[ playerid ][ slot ][ vSpawned ] = false; } DestroyVehicle( vehid ); if ( save ) SaveOwnableVehInfo( SVehInfo[ vehid ][ vDBID ] ); NullSOVehicleVar ( vehid ); totalownablevehicles--; CheckIfPlayerHasSpawnedVehicle( playerid ); } stock DropVehicleRow( dbid ) { // Funkcija: DropVehicleRow( dbid ) for ( new i = totalstaticvehicles; i < MAX_VEHICLES; i++ ) { if ( SVehInfo[ i ][ vDBID ] == dbid ) { DespawnOwnableVehicle( i, false ); break; } } foreach (Player, playerid) { if ( !aLogged[ playerid ] ) continue; for ( new i = 0; i < MAX_OWNABLE_VEHICLES; i++ ) { if ( VehInfo[ playerid ][ i ][ vDBID ] == dbid ) { NullOwnableVehicleVariablesEx( playerid, i ); break; } } } new string[ 55 ]; format ( string, 55, "DELETE FROM `ownablevehicles` WHERE `id`=%d", dbid ); mysql_query( string ); } stock DespawnUnusedVehicle( ) { // Funkcija DespawnUnusedVehicle( ) new bool:InUse[ MAX_VEHICLES ]; foreach (Player, playerid) { if ( !aLogged[ playerid ] ) continue; InUse[ GetPlayerVehicleID( playerid ) ] = true; } for ( new vehid = totalstaticvehicles; vehid < MAX_VEHICLES; vehid++ ) { if ( SVehInfo[ vehid ][ vDBID ] < 1 ) continue; DespawnOwnableVehicle( vehid ); break; } } stock GetSlotOfCarID( playerid, carid ) { // Funkcija: GetSlotOfCarID( playerid, carid ) new dbid = SVehInfo[ carid ][ vDBID ]; for ( new i = 0; i < MAX_OWNABLE_VEHICLES; i++ ) { if ( dbid == VehInfo[ playerid ][ i ][ vDBID ] ) return i; } return MAX_OWNABLE_VEHICLES; } stock GetSlotOfCarByDBID( playerid, dbid ) { // Funkcija: GetSlotOfCarByDBID( playerid, dbid ) for ( new i = 0; i < MAX_OWNABLE_VEHICLES; i++ ) { if ( VehInfo[ playerid ][ i ][ vDBID ] == dbid ) return i; } return MAX_OWNABLE_VEHICLES; } stock SaveOwnableVehInfo( dbid ) { // Funkcija: SaveOwnableVehInfo( dbid ) MySQLCheckConnection( ); new fullstring[ 456 ]; fullstring = "UPDATE `ownablevehicles` SET "; new vehid = IsOwnableVehicleSpawned ( dbid ), playerid = IsOwnerOfSpawnedVehicleCncted( dbid ); if ( vehid < MAX_VEHICLES ) // Jeigu maљina yra iљspawninta format( fullstring, 456, "%s`owner`=%d", fullstring, SVehInfo[ vehid ][ vOwner ] ); else if ( playerid != INVALID_PLAYER_ID ) // Jeigu maљina nėra iљspawninta format( fullstring, 456, "%s`owner`=%d", fullstring, PlayerInfo[ playerid ][ pSQLID ] ); if ( playerid != INVALID_PLAYER_ID ) { new slot = GetSlotOfCarByDBID( playerid, dbid ); if ( slot < MAX_OWNABLE_VEHICLES ) { if ( strlen( fullstring ) > 29 ) format( fullstring, 456, "%s ,", fullstring ); format( fullstring, 456, "%s`modelid`=%d,`x`='%.3f',`y`='%.3f',`z`='%.3f',`angle`='%.3f',`color1`=%d,`color2`=%d,`destroys`=%d,`lock`=%d,`insur`=%d,`immob`=%d,`plate`='%s',`alarm`=%d,`gas`=%d,`mod`='%s'", fullstring, VehInfo[ playerid ][ slot ][ vModel ], VehInfo[ playerid ][ slot ][ vPos_x ], VehInfo[ playerid ][ slot ][ vPos_y ], VehInfo[ playerid ][ slot ][ vPos_z ], VehInfo[ playerid ][ slot ][ vAngle ], VehInfo[ playerid ][ slot ][ vColor1 ], VehInfo[ playerid ][ slot ][ vColor2 ], VehInfo[ playerid ][ slot ][ vDestroys ], VehInfo[ playerid ][ slot ][ vLock ], VehInfo[ playerid ][ slot ][ vInsur ], VehInfo[ playerid ][ slot ][ vImmob ], VehInfo[ playerid ][ slot ][ vPlate ], VehInfo[ playerid ][ slot ][ vAlarm ], VehInfo[ playerid ][ slot ][ vGas ], PackCarMod( VehInfo[ playerid ][ slot ][ vMod ] ) ); } } format ( fullstring, 456, "%s WHERE `id`=%d", fullstring, dbid ); mysql_query( fullstring ); } stock IsOwnableVehicleSpawned( dbid ) { // Funkcija: IsOwnableVehicleSpawned( dbid ) for ( new i = totalstaticvehicles; i < MAX_VEHICLES; i++ ) { if ( SVehInfo[ i ][ vDBID ] == dbid ) return i; } return MAX_VEHICLES; } stock IsOwnerOfSpawnedVehicleCncted( dbid ) { // Funkcija: IsOwnerOfSpawnedVehicleConnected( dbid ) new vehid = 0; for ( new z = totalstaticvehicles; z < MAX_VEHICLES; z++ ) { if ( SVehInfo[ z ][ vDBID ] == dbid ) { vehid = z; break; } } if ( vehid == 0 ) return INVALID_PLAYER_ID; foreach (Player, i) { if ( !aLogged[ i ] ) continue; if ( SVehInfo[ vehid ][ vOwner ] == PlayerInfo[ i ][ pSQLID ] ) return i; } return INVALID_PLAYER_ID; } stock IsOwnerCnnected( vehid ) { // Funkcija: IsOwnerCnnected( vehid ) if ( SVehInfo[ vehid ][ vOwner ] > 0 ) { foreach (Player, i) { if ( !aLogged[ i ] ) continue; if ( PlayerInfo[ i ][ pSQLID ] == SVehInfo[ vehid ][ vOwner ] ) return i; } } return INVALID_PLAYER_ID; } stock AddNewVehicleInDatabase( playerid, modelid, color1, color2 ) { new Float:x, Float:y, Float:z, Float:a; if ( IsABoat( modelid ) ) { new rand = random( 5 ); switch ( rand ) { case 0: { x = 2101.8335; y = -87.6438; z = -0.3240; a = 125.5961; } case 1: { x = 2114.9741; y = -106.2650; z = -0.2873; a = 217.9239; } case 2: { x = 2198.2292; y = -141.9779; z = -0.3606; a = 260.4826; } case 3: { x = 2173.5110; y = -139.3387; z = -0.3495; a = 253.1897; } default: { x = 2117.4365; y = -38.7790; z = -0.3562; a = 18.5849; } } } else { new rand = random( 4 ); switch ( rand ) { case 0: { x = 1351.1918; y = 356.1544; } case 1: { x = 1340.9075; y = 333.3767; } case 2: { x = 1337.6791; y = 325.3260; } default: { x = 1354.9025; y = 364.0695; } } z = 19.8785; a = 0; } NullOwnableVehicleVariables( playerid ); new string[ 205 ]; format( string, 205, "INSERT INTO `ownablevehicles` (`owner`,`modelid`,`x`,\ `y`,`z`,`angle`,`color1`,`color2`) VALUES (%d,%d,'%f','%f','%f','%f',%d,%d)", PlayerInfo[ playerid ][ pSQLID ], modelid, x, y, z, a, color1, color2 ); mysql_query( string ); } stock LoadVehicles( ) { // Funkcija: LoadVehicles( ) // Įkeliame stacionares transporto priemones mysql_query ( "SELECT * FROM `staticvehicles` ORDER BY `id`" ); mysql_store_result( ); new row[ 128 ]; totalstaticvehicles = 50; while ( mysql_fetch_row( row ) ) { totalstaticvehicles++; new svehinf[ 10 + ( 2 * MAX_TRUNK_SLOTS ) ][ 16 ]; split( row, svehinf, '|' ); AddStaticVehicleEx( strval ( svehinf[ 1 ] ), floatstr( svehinf[ 2 ] ), floatstr( svehinf[ 3 ] ), floatstr( svehinf[ 4 ] ), floatstr( svehinf[ 5 ] ), strval ( svehinf[ 6 ] ), strval ( svehinf[ 7 ] ), 30000 ); vehType[ totalstaticvehicles ] = strval( svehinf[ 8 ] ); for ( new slot = 0; slot < MAX_TRUNK_SLOTS; slot++ ) vehTrunkWep[ totalstaticvehicles ][ slot ] = strval( svehinf[ 9 + slot ] ); for ( new slot = 0; slot < MAX_TRUNK_SLOTS; slot++ ) vehTrunkAmmo[ totalstaticvehicles ][ slot ] = strval( svehinf[ 9 + MAX_TRUNK_SLOTS + slot ] ); vehTrunkArmor[ totalstaticvehicles ] = strval( svehinf[ 9 + ( 2 * MAX_TRUNK_SLOTS )] ); } mysql_free_result( ); printf( "\n- Įkelta %d stacionarių transporto priemonių", totalstaticvehicles ); } stock VehicleHasWindows( model ) { if ( IsVehicleBike( model ) || !VehicleHasEngine( model ) ) return false; switch ( model ) { case 424, 429, 430, 432, 439, 446, 452, 453, 454, 457, 471, 472, 473, 480, 484, 485, 486, 493, 530, 531, 533, 536, 539, 555, 567, 568, 571, 572, 575, 595: return false; } return true; } stock GetClosestVehicle( playerid ) { // Funkcija: GetClosestVehicle( playerid ) new Float:distance = 99980001, vehicleid = MAX_VEHICLES, Float:pX, Float:pY, Float:pZ; GetPlayerPos( playerid, pX, pY, pZ ); for ( new vehid = 1; vehid < MAX_VEHICLES; vehid++ ) { new Float:vX, Float:vY, Float:vZ; GetVehiclePos( vehid, vX, vY, vZ ); if ( vX == 0.000 && vY == 0.000 && vZ == 0.000 ) continue; else { new Float:newdistance; vX -= pX; vY -= pY; vZ -= vZ; newdistance = vX * vX + vY * vY + vZ * vZ; if ( newdistance < distance ) { vehicleid = vehid; distance = newdistance; } } } return vehicleid; } stock CheckPlayerDistanceToVehicle( Float:radi, playerid, vehicleid ) { // Funkcija: CheckPlayerDistanceToVehicle( Float:radi, playerid, vehicleid ) new Float:vX, Float:vY, Float:vZ; GetVehiclePos( vehicleid, vX, vY, vZ ); return IsPlayerInRangeOfPoint( playerid, radi, vX, vY, vZ ); } stock VehicleHasTrunk( model ) { // Funkcija: VehicleHasTrunk( model ) if ( IsVehicleBike( model ) || !VehicleHasEngine( model ) ) return false; switch ( model ) { case 403, 406, 407, 408, 417, 423, 424, 425, 430, 432, 434, 435, 441, 443, 446, 447, 449, 450, 452, 453, 454, 457, 460, 464, 465, 469, 471, 472, 473, 476, 484, 485, 486, 487, 488, 493, 497, 501, 511, 512, 513, 514, 515, 519, 520, 524, 525, 530, 531, 532, 537, 538, 539, 544, 548, 563, 564, 568, 569, 570..574, 577, 583, 584, 590, 591, 592, 593, 594, 595, 606, 607, 608, 610, 611: return false; } return true; } stock IsVehicleBike( model ) { // Funkcija: IsVehicleBike( model ) // Patikrins ar transporto priemonė yra dviratė priemonė switch ( model ) { case 581, 462, 521, 463, 522, 461, 448, 471, 468, 523, 586: return true; } return false; } stock RemoveAllPrayersFromVehicleEx( vehicleid ) { // Funkcija: RemoveAllPlayersFromVehicleEx( vehicleid ) foreach (Player, playerid) { if ( !aLogged[ playerid ] ) continue; if ( IsPlayerInVehicle( playerid, vehicleid ) ) { if ( !Seatbelt[ playerid ] ) { RemovePlayerFromVehicle( playerid ); SendActionMessage ( playerid, "iљkrenta iљ transporto priemonės." ); } else { SendActionMessage( playerid, "gelbsti saugos dirћai." ); if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) TogglePlayerControllable( playerid, false ); } } } } stock OnVehicleHealthChange( playerid, vehicleid, Float:oldhealth, Float:newhealth ) { // Callback: OnVehicleHealthChange( playerid, vehicleid, Float:oldhealth, Float:newhealth ) if ( oldhealth - newhealth > 150 ) { if ( Engine[ vehicleid ] ) { new name [ MAX_PLAYER_NAME ], string[ 62 ]; GetPlayerRPName ( playerid, name, MAX_PLAYER_NAME ); format ( string, 61, "* Transporto priemonė uћgęsta (( %s ))", name ); SendDistanceMessageEx( 30.0, playerid, string, COLOR_PURPLE ); print ( string ); Engine[ vehicleid ] = false; RemoveAllPrayersFromVehicleEx( vehicleid ); return true; } } return false; } stock VehicleHasEngine( model ) { // Funkcija: VehicleHasEngine( model ) // Patikrins ar maљinos modelis turi variklį switch ( model ) { case 509, 481, 510: return false; } return true; } stock AttemptToEngineVehicle( playerid, vehicleid ) { // Funkcija: AttemptToEngineVehicle( playerid, vehicleid ) if ( !Engine[ vehicleid ] && !AttemptingEngine[ playerid ] ) { if ( SVehInfo[ vehicleid ][ vDBID ] > 0 && SVehInfo[ vehicleid ][ vOwner ] != PlayerInfo[ playerid ][ pSQLID ] ) SendClientMessage( playerid, COLOR_GREY, " Jūs neturite transporto priemonės raktelių." ); else if ( IsFilling[ playerid ] ) SendClientMessage( playerid, COLOR_GREY, " Jūs negalite uћkurti variklio, kol pilatės degalus." ); else { new name [ MAX_PLAYER_NAME ], string[ 89 ]; GetPlayerRPName ( playerid, name, MAX_PLAYER_NAME ); format ( string, 88, "* %s pasuka raktelį ir bando uћkurti transporto priemonės variklį.", name ); SendDistanceMessageEx( 30.0, playerid, string, COLOR_PURPLE ); print ( string ); AttemptingEngine[ playerid ] = true; SetTimerEx( "EngineAttempt", 3500, false, "dd", playerid, vehicleid ); } } } public EngineAttempt( playerid, vehicleid ) { // Funkcija: EngineAttempt( playerid, vehicleid ) if ( !Engine[ vehicleid ] && AttemptingEngine[ playerid ] ) { new Float:vaHealth, bool:success; GetVehicleHealth( vehicleid, vaHealth ); if ( Gas[ vehicleid ] < 1 ) success = false; else if ( vaHealth < 500 ) success = false; else { new randomize = random( 4 ); switch ( randomize ) { case 0..2: success = true; default: success = false; } } new name [ MAX_PLAYER_NAME ], string[ 83 ]; GetPlayerRPName( playerid, name, MAX_PLAYER_NAME ); if ( success ) { Engine[ vehicleid ] = true; if ( CheckIfCanBeUnfrozen( playerid ) ) TogglePlayerControllable( playerid, true ); format( string, 82, "* Transporto priemonės variklis uћsikuria sėkmingai (( %s ))", name ); } else format( string, 82, "* Transporto priemonės variklis neuћsikuria (( %s ))", name ); SendDistanceMessageEx( 30.0, playerid, string, COLOR_PURPLE ); print ( string ); } AttemptingEngine[ playerid ] = false; } stock TurnOffEngine( playerid, vehicleid ) { // Funkcija: TurnOffEngine( playerid, vehicleid ) if ( Engine[ vehicleid ] ) { if ( SVehInfo[ vehicleid ][ vDBID ] > 0 && SVehInfo[ vehicleid ][ vOwner ] != PlayerInfo[ playerid ][ pSQLID ] ) SendClientMessage( playerid, COLOR_GREY, " Jūs neturite trasnporto priemonės raktelių." ); else { new name [ MAX_PLAYER_NAME ], string[ 85 ]; GetPlayerRPName ( playerid, name, MAX_PLAYER_NAME ); format ( string, 84, "* %s pasuka raktelį ir iљjungia transporto priemonės variklį.", name ); SendDistanceMessageEx( 30.0, playerid, string, COLOR_PURPLE ); print ( string ); Engine[ vehicleid ] = false; TogglePlayerControllable( playerid, false ); } } } stock IsVehicleSpawned( vehid ) { // Funkcija: IsVehicleSpawned( vehid ) // Patikrins ar maљina yra iљspawninta new Float:x, Float:y, Float:z; GetVehiclePos( vehid, x, y, z ); if ( x == 0 && y == 0 && z == 0 ) return false; return true; } public Fillup( playerid ) { // Funkcija: Fillup( playerid ) if ( IsPlayerConnected( playerid ) && GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) { if ( IsFilling[ playerid ] ) { new vehid = GetPlayerVehicleID( playerid ); if ( Gas[ vehid ] + FuelFilled[ playerid ] >= 100 ) ShowPlayerDialog( playerid, 1002, DIALOG_STYLE_MSGBOX, "Degalinės darbuotojas klausia", "Kaip atsiskaitysite?", "Grynais", "Banku" ); else { FuelFilled[ playerid ]++; new string[ 128 ]; format( string, 127, "~g~ Degaline~n~_~n~~p~Moketi: ~g~%d LT~n~~p~Degalai: ~g~%d procentai", FuelFilled[ playerid ], Gas[ vehid ] + FuelFilled[ playerid ] ); TextDrawSetString( InfoText[ playerid ], string ); SetTimerEx( "Fillup", 400, false, "d", playerid ); } } } } stock SaveVehicleTrunk( vehicleid ) { // Funkcija: SaveVehicleTrunk( vehicleid ) if ( vehicleid <= totalstaticvehicles ) { new query[ 255 ]; format( query, 255, "UPDATE `staticvehicles` SET " ); for ( new i = 0; i < MAX_TRUNK_SLOTS; i++ ) format( query, 255, "%s`Trunk%d_gun`=%d,`Trunk%d_ammo`=%d,", query, i, vehTrunkWep[ vehicleid ][ i ], i, vehTrunkAmmo[ vehicleid ][ i ] ); format( query, 255, "%s`Trunk_armor`=%d WHERE `id`=%d", query, vehTrunkArmor[ vehicleid ], vehicleid ); mysql_query( query ); } else if ( SVehInfo[ vehicleid ][ vDBID ] > 0 ) { new query[ 255 ]; query = "UPDATE `ownablevehicles` SET "; for ( new i = 0; i < MAX_TRUNK_SLOTS; i++ ) format( query, 255, "%s`Trunk%d_wep`=%d, `Trunk%d_ammo`=%d,", query, i, vehTrunkWep[ vehicleid ][ i ], i, vehTrunkAmmo[ vehicleid ][ i ] ); format( query, 255, "%s`Trunk_armor`=%d WHERE `id`=%d", query, vehTrunkArmor[ vehicleid ], SVehInfo[ vehicleid ][ vDBID ] ); mysql_query( query ); } } stock PlayerHasAccessToVehicle( playerid, vehid ) { switch ( vehType[ vehid ] ) { case TYPE_POLICE..TYPE_TV: { if ( PlayerInfo[ playerid ][ pFaction ] != vehType[ vehid ] - 1 ) return false; } case TYPE_INSTR: { if ( PlayerInfo[ playerid ][ pFaction ] != 3 && !TLesson[ playerid ] ) return false; } case TYPE_GOV: { if ( PlayerInfo[ playerid ][ pFaction ] != 4 ) return false; } case TYPE_FARM: { if ( PlayerInfo[ playerid ][ pJob ] != JOB_FARMER ) return false; } case TYPE_SWEEP: { if ( PlayerInfo[ playerid ][ pJob ] != JOB_SWEEPER ) return false; } case TYPE_BUS: { if ( PlayerInfo[ playerid ][ pJob ] != JOB_BUSDRIVER ) return false; } case TYPE_TAXI: { if ( PlayerInfo[ playerid ][ pFaction ] != 5 ) return false; } } if ( SVehInfo[ vehid ][ vLock ] > 0) return false; return true; } stock IsAPlane( model ) { switch ( model ) { case 592, 577, 511, 512, 593, 520, 553, 476, 519, 460, 513, 548, 425, 417, 487, 488, 497, 563, 447, 469: return true; } return false; } stock IsABoat( model ) { switch ( model ) { case 472, 473, 493, 595, 484, 430, 453, 452, 446, 454: return true; } return false; } stock GetVehicleName( model ) { // Funkcija: GetVehicleName( model ) // Returnins automobilio vardą new string[ 18 ]; switch ( model ) { case 400: string = "Landstalker"; case 401: string = "Bravura"; case 402: string = "Buffalo"; case 403: string = "Linerunner"; case 404: string = "Perennial"; case 405: string = "Sentinel"; case 406: string = "Dumper"; case 407: string = "Firetruck"; case 408: string = "Trashmaster"; case 409: string = "Stretch"; case 410: string = "Manana"; case 411: string = "Infernus"; case 412: string = "Voodoo"; case 413: string = "Pony"; case 414: string = "Mule"; case 415: string = "Cheetah"; case 416: string = "Ambulance"; case 417: string = "Leviathan"; case 418: string = "Moonbeam"; case 419: string = "Esperanto"; case 420: string = "Taxi"; case 421: string = "Washington"; case 422: string = "Bobcat"; case 423: string = "Mr Whoopee"; case 424: string = "BF Injection"; case 425: string = "Hunter"; case 426: string = "Premier"; case 427: string = "Enforcer"; case 428: string = "Securicar"; case 429: string = "Banshee"; case 430: string = "Predator"; case 431: string = "Bus"; case 432: string = "Rhino"; case 433: string = "Barracks"; case 434: string = "Hotknife"; case 435: string = "Trailer"; case 436: string = "Previon"; case 437: string = "Coach"; case 438: string = "Cabbie"; case 439: string = "Stallion"; case 440: string = "Rumpo"; case 441: string = "RC Bandit"; case 442: string = "Romero"; case 443: string = "Packer"; case 444: string = "Monster"; case 445: string = "Admiral"; case 446: string = "Squalo"; case 447: string = "Seasparrow"; case 448: string = "Pizzaboy"; case 449: string = "Tram"; case 450: string = "Trailer"; case 451: string = "Turismo"; case 452: string = "Speeder"; case 453: string = "Reefer"; case 454: string = "Tropic"; case 455: string = "Flatbed"; case 456: string = "Yankee"; case 457: string = "Caddy"; case 458: string = "Solair"; case 459: string = "Berkley's RC Van"; case 460: string = "Skimmer"; case 461: string = "PCJ-600"; case 462: string = "Faggio"; case 463: string = "Freeway"; case 464: string = "RC Baron"; case 465: string = "RC Raider"; case 466: string = "Glendale"; case 467: string = "Oceanic"; case 468: string = "Sanchez"; case 469: string = "Sparrow"; case 470: string = "Patriot"; case 471: string = "Quad"; case 472: string = "Coastguard"; case 473: string = "Dinghy"; case 474: string = "Hermes"; case 475: string = "Sabre"; case 476: string = "Rustler"; case 477: string = "ZR-350"; case 478: string = "Walton"; case 479: string = "Regina"; case 480: string = "Comet"; case 481: string = "BMX"; case 482: string = "Burrito"; case 483: string = "Camper"; case 484: string = "Marquis"; case 485: string = "Baggage"; case 486: string = "Dozer"; case 487: string = "Maverick"; case 488: string = "News Chopper"; case 489: string = "Rancher"; case 490: string = "FBI Rancher"; case 491: string = "Virgo"; case 492: string = "Greenwood"; case 493: string = "Jetmax"; case 494: string = "Hotring"; case 495: string = "Sandking"; case 496: string = "Blista Compact"; case 497: string = "Police Maverick"; case 498: string = "Boxville"; case 499: string = "Benson"; case 500: string = "Mesa"; case 501: string = "RC Goblin"; case 502: string = "Hotring Racer"; case 503: string = "Hotring Racer"; case 504: string = "Bloodring Banger"; case 505: string = "Rancher"; case 506: string = "Super GT"; case 507: string = "Elegant"; case 508: string = "Journey"; case 509: string = "Bike"; case 510: string = "Mountain Bike"; case 511: string = "Beagle"; case 512: string = "Cropdust"; case 513: string = "Stunt"; case 514: string = "Tanker"; case 515: string = "RoadTrain"; case 516: string = "Nebula"; case 517: string = "Majestic"; case 518: string = "Buccaneer"; case 519: string = "Shamal"; case 520: string = "Hydra"; case 521: string = "FCR-900"; case 522: string = "NRG-500"; case 523: string = "HPV1000"; case 524: string = "Cement Truck"; case 525: string = "Tow Truck"; case 526: string = "Fortune"; case 527: string = "Cadrona"; case 528: string = "FBI Truck"; case 529: string = "Willard"; case 530: string = "Forklift"; case 531: string = "Tractor"; case 532: string = "Combine"; case 533: string = "Feltzer"; case 534: string = "Remington"; case 535: string = "Slamvan"; case 536: string = "Blade"; case 537: string = "Freight"; case 538: string = "Streak"; case 539: string = "Vortex"; case 540: string = "Vincent"; case 541: string = "Bullet"; case 542: string = "Clover"; case 543: string = "Sadler"; case 544: string = "Firetruck"; case 545: string = "Hustler"; case 546: string = "Intruder"; case 547: string = "Primo"; case 548: string = "Cargobob"; case 549: string = "Tampa"; case 550: string = "Sunrise"; case 551: string = "Merit"; case 552: string = "Utility Truck"; case 553: string = "Nevada"; case 554: string = "Yosemite"; case 555: string = "Windsor"; case 556: string = "Monster"; case 557: string = "Monster"; case 558: string = "Uranus"; case 559: string = "Jester"; case 560: string = "Sultan"; case 561: string = "Stratum"; case 562: string = "Elegy"; case 563: string = "Raindance"; case 564: string = "RCTiger"; case 565: string = "Flash"; case 566: string = "Tahoma"; case 567: string = "Savanna"; case 568: string = "Bandito"; case 569: string = "Freight"; case 570: string = "Trailer"; case 571: string = "Kart"; case 572: string = "Mover"; case 573: string = "Dune"; case 574: string = "Sweeper"; case 575: string = "Broadway"; case 576: string = "Tornado"; case 577: string = "AT-400"; case 578: string = "DFT-30"; case 579: string = "Huntley"; case 580: string = "Stafford"; case 581: string = "BF-400"; case 582: string = "Newsvan"; case 583: string = "Tug"; case 584: string = "Trailer"; case 585: string = "Emperor"; case 586: string = "Wayfarer"; case 587: string = "Euros"; case 588: string = "Hotdog"; case 589: string = "Club"; case 590: string = "Trailer"; case 591: string = "Trailer"; case 592: string = "Andromada"; case 593: string = "Dodo"; case 594: string = "RC Cam"; case 595: string = "Launch"; case 596: string = "Police Car (LSPD)"; case 597: string = "Police Car (SFPD)"; case 598: string = "Police Car (LVPD)"; case 599: string = "Police Ranger"; case 600: string = "Picador"; case 601: string = "S.W.A.T. Van"; case 602: string = "Alpha"; case 603: string = "Phoenix"; case 604: string = "Glendale"; case 605: string = "Sadler"; case 606: string = "Luggage Trailer"; case 607: string = "Luggage Trailer"; case 608: string = "Stair Trailer"; case 609: string = "Boxville"; case 610: string = "Farm Plow"; case 611: string = "Utility Trailer"; default : string = "None"; } return string; } stock LockVehicleForPlayers( vehicleid, bool:lock ) { // Funkcija: LockVehicleForPlayers( vehicleid, bool:lock ) foreach (Player, i) SetVehicleParamsForPlayer( vehicleid, i, 0, lock ); } stock GetVehicleSeats( model ) { // Funkcija: GetVehicleSeats( model ) switch ( model ) { case 400, 404, 405, 409, 416, 418, 420, 421, 426, 427, 431, 437, 438, 445, 470, 479, 483, 487, 490, 492, 497, 505, 507, 516, 529, 540, 546, 547, 550, 551, 560, 561, 566, 567, 579, 580, 585, 596..598, 604: return 4; case 401..403, 406..408, 410..415, 417, 419, 422..425, 428, 429, 433, 436, 439, 440, 442..444, 451, 455, 456, 458, 459, 461..463, 466..468, 471, 474, 475, 477, 478, 480, 482, 488, 489, 491, 494..496, 498..500, 502..504, 506, 508, 514, 515, 517, 518, 521..528, 533..536, 541..545, 548, 549, 552, 554..559, 562, 565, 573, 575, 576, 578, 581, 582, 586..589, 599, 600, 602, 603, 605, 609: return 2; } return 1; } //****************************************************************************** // Komandos //****************************************************************************** COMMAND:ismesti( playerid, params[ ] ) { new id; if ( GetPlayerState( playerid ) != PLAYER_STATE_DRIVER ) SendClientMessage( playerid, COLOR_GREY, " Jūs turite būti transporto priemonės vairuotojas, kad galėtumėte iљmesti iљ jos ћmogų." ); else if ( sscanf( params, "u", id ) ) SendUsage ( playerid, "/ismesti [ћaidėjo id/dalis vardo]" ); else if ( id == INVALID_PLAYER_ID ) SendClientMessage( playerid, COLOR_GREY, " ID nerastas !" ); else if ( !aLogged[ id ] ) SendClientMessage( playerid, COLOR_GREY, " Ћaidėjas neprisijungęs." ); else if ( id == playerid ) SendClientMessage( playerid, COLOR_GREY, " Negali savęs iљmesti iљ transporto priemonės." ); else if ( !IsPlayerInVehicle( id, GetPlayerVehicleID( playerid ) ) ) SendClientMessage( playerid, COLOR_GREY, " Ћaidėjas nėra Jūsų transporto priemonėje." ); else { new sendername[ MAX_PLAYER_NAME ], giveplayer[ MAX_PLAYER_NAME ], string [ 84 ]; GetPlayerRPName( playerid, sendername, MAX_PLAYER_NAME ); GetPlayerRPName( id, giveplayer, MAX_PLAYER_NAME ); format ( string, 83, "* %s iљmetė %s iљ transporto priemonės.", sendername, giveplayer ); SendDistanceMessageEx( 30.0, playerid, string, COLOR_PURPLE ); print ( string ); format ( string, 83, "* Tave %s iљmetė iљ transporto priemonės.", sendername ); SendClientMessage( id, COLOR_WHITE, string ); format ( string, 83, "* Tu iљmetiai %s iљ transporto priemonės.", giveplayer ); SendClientMessage( playerid, COLOR_WHITE, string ); RemovePlayerFromVehicle( id ); } return true; } COMMAND:variklis( playerid, params[ ] ) { #pragma unused params if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) { new vehid = GetPlayerVehicleID( playerid ); if ( VehicleHasEngine( vehid ) ) { if ( !Engine[ vehid ] ) AttemptToEngineVehicle( playerid, vehid ); else TurnOffEngine( playerid, vehid ); } } return true; } COMMAND:dirzai( playerid, params[ ] ) { #pragma unused params if ( IsPlayerInAnyVehicle( playerid ) ) { new vehid = GetPlayerVehicleID( playerid ), model = GetVehicleModel( vehid ); if ( VehicleHasEngine( model ) && !IsVehicleBike( model ) ) { switch ( Seatbelt[ playerid ] ) { case false: { Seatbelt[ playerid ] = true; SendActionMessage( playerid, "prisisega saugos dirћus." ); SendClientMessage( playerid, COLOR_WHITE, " Saugos dirћai prisegti." ); } case true: { Seatbelt[ playerid ] = false; SendActionMessage( playerid, "atsisega saugos dirћus." ); SendClientMessage( playerid, COLOR_WHITE, " Saugos dirћai atsegti." ); } } } } else SendClientMessage( playerid, COLOR_GREY, " Jūs neesate transporto priemonėje." ); return true; } COMMAND:pilti( playerid, params[ ] ) { #pragma unused params if ( !IsPlayerAtGasStation( playerid ) ) return SendClientMessage( playerid, COLOR_GREY, " Jūs neesate degalinėje." ); if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) { new vehid = GetPlayerVehicleID( playerid ); if ( VehicleHasEngine( GetVehicleModel( vehid ) ) ) { if ( Engine[ vehid ] || AttemptingEngine[ playerid ] ) return SendClientMessage( playerid, COLOR_GREY, " Kai pilatės degalus, jūsų automobilio variklis turi būti uћgesintas." ); if ( IsFilling[ playerid ] ) return SendClientMessage( playerid, COLOR_GREY, " Jūs jau pilatės degalus, kantrybės." ); if ( Gas[ vehid ] < 100 ) { IsFilling[ playerid ] = true; TogglePlayerControllable( playerid, false ); ShowPlayerDialog( playerid, 1001, DIALOG_STYLE_MSGBOX, "Degalinės darbuotojas klausia", "Ar tikrai norite uћsipilti degalų?", "Taip", "Ne" ); } else ShowInfoText( playerid, "~w~Transporto priemones degalu bakas yra ~r~pilnas", 3000 ); } else SendClientMessage( playerid, COLOR_GREY, " Љi transporto priemonė neturi variklio, todėl nereikia degalų." ); } else SendClientMessage( playerid, COLOR_GREY, " Jūs neesate transporto priemonės vairuotojas." ); return true; } COMMAND:langas( playerid, params[ ] ) { #pragma unused params if ( IsPlayerInAnyVehicle( playerid ) ) { new vehid = GetPlayerVehicleID( playerid ); if ( VehicleHasWindows( GetVehicleModel( vehid ) ) ) { if ( Window[ vehid ] ) { Window[ vehid ] = false; SendActionMessage( playerid, "uћdaro langą." ); } else { Window[ vehid ] = true; SendActionMessage( playerid, "atidaro langą." ); } } else SendClientMessage( playerid, COLOR_GREY, " Љi transporto priemonė neturi lango." ); } else SendClientMessage( playerid, COLOR_GREY, " Jūs neesate automobilyje." ); return true; } COMMAND:bagazine( playerid, params[ ] ) { #pragma unused params new vehid = GetClosestVehicle( playerid ), vid = GetPlayerVehicleID( playerid ); if ( vehid < MAX_PLAYERS ) { if ( !CheckPlayerDistanceToVehicle( 3.5, playerid, vehid ) ) SendClientMessage( playerid, COLOR_GREY, " Nėra transporto priemonės љalia Jūsų." ); else if ( !VehicleHasTrunk( GetVehicleModel( vehid ) ) ) SendClientMessage( playerid, COLOR_GREY, " Љi transporto priemonė neturi bagaћinės." ); else if ( !PlayerHasAccessToVehicle( playerid, vehid ) ) SendClientMessage( playerid, COLOR_GREY, " Bagaћinė yra uћrakinta." ); else if ( vid ) SendClientMessage( playerid, COLOR_GREY, " Transporto priemones viduje naudotis bagazine negalima." ); else ShowPlayerMenu( playerid, MENU_TRUNK, vehid ); } else SendClientMessage( playerid, COLOR_GREY, " Nėra transporto priemonės љalia Jūsų." ); return true; } COMMAND:t( playerid, params[ ] ) { new idx, result[ 128 ]; result = strtok( params, idx ); if ( !result[ 0 ] ) { SendClientMessage( playerid, COLOR_DBLUE, "_________________________________________________________" ); SendUsage ( playerid, "/t [veiksmas]" ); SendClientMessage( playerid, COLOR_WHITE, "GALIMI VEIKSMAI: sarasas, gauti, parkuoti, ieskoti, parduoti, rakinti" ); SendClientMessage( playerid, COLOR_WHITE, "GALIMI VEIKSMAI: registruoti, pirktivieta, atnaujinti, pirkti, dokumentai" ); SendClientMessage( playerid, COLOR_WHITE, "naikinti - Įspėjimas! Sunaikins Jūsų transporto priemonę." ); SendClientMessage( playerid, COLOR_DBLUE, "_________________________________________________________" ); } else { if ( !strcmp( result, "sarasas", true ) ) { new bool:count = false; SendClientMessage( playerid, COLOR_DBLUE, "|________________ Jūsų transporto priemonės ________________|" ); for ( new i = 0; i < MAX_OWNABLE_VEHICLES; i++ ) { if ( VehInfo[ playerid ][ i ][ vDBID ] > 0 ) { new tmpstr [ 112 ], tempalar[ 5 ]; if ( VehInfo[ playerid ][ i ][ vAlarm ] ) tempalar = "taip"; else tempalar = "ne"; format( tmpstr, 111, " [%d]%s, sunaikinimai:[%d], draudimas:[%d], uzraktas:[%d], apsaugos sis.:[%d], signalizacija:[%s]", i + 1, GetVehicleName( VehInfo[ playerid ][ i ][ vModel ] ), VehInfo[ playerid ][ i ][ vDestroys ], VehInfo[ playerid ][ i ][ vInsur ], VehInfo[ playerid ][ i ][ vLock ], VehInfo[ playerid ][ i ][ vImmob ], tempalar ); SendClientMessage( playerid, COLOR_WHITE, tmpstr ); count = true; } } if ( !count ) SendClientMessage( playerid, COLOR_GREY, " Jūs neturite transporto priemonių." ); } else if ( !strcmp( result, "gauti", true ) ) { result = strtok( params, idx ); new id = strval( result ); if ( id > MAX_OWNABLE_VEHICLES || id < 1 ) SendClientMessage( playerid, COLOR_GREY, " Blogas maљinos id." ); else if ( VehInfo[ playerid ][ id - 1 ][ vDBID ] < 1 ) SendClientMessage( playerid, COLOR_GREY, " Jūs neturite transporto priemonės љioje vietoje." ); else if ( CheckIfPlayerHasSpawnedVehicle( playerid ) ) SendClientMessage( playerid, COLOR_GREY, " Jūs jau turite pasiėmę transporto priemonę." ); else { if ( totalownablevehicles + totalstaticvehicles >= MAX_VEHICLES ) DespawnUnusedVehicle( ); id--; SpawnOwnableVehicle ( playerid, id ); SetPlayerCheckpointEx( playerid, CHECKPOINT_VEHICLE, VehInfo[ playerid ][ id ][ vPos_x ], VehInfo[ playerid ][ id ][ vPos_y ], VehInfo[ playerid ][ id ][ vPos_z ], 5.0 ); SendClientMessage( playerid, COLOR_WHITE, " Transporto priemonė atsirado raudoname taљke." ); } } else if ( !strcmp( result, "parkuoti", true ) ) { if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) { new vehid = GetPlayerVehicleID( playerid ); if ( SVehInfo[ vehid ][ vOwner ] == PlayerInfo[ playerid ][ pSQLID ] ) { new slot = GetSlotOfCarByDBID( playerid, SVehInfo[ vehid ][ vDBID ] ); if ( !IsPlayerInRangeOfPoint( playerid, 30.0, VehInfo[ playerid ][ slot ][ vPos_x ], VehInfo[ playerid ][ slot ][ vPos_y ], VehInfo[ playerid ][ slot ][ vPos_z ] ) ) return SendClientMessage( playerid, COLOR_GREY, " Jūs neesate pakankamai arti stovėjimo aikљtelės." ); DespawnOwnableVehicle ( vehid ); TogglePlayerControllable( playerid, true ); } else SendClientMessage( playerid, COLOR_GREY, " Jūs neesate transporto priemonės savininkas." ); } else SendClientMessage( playerid, COLOR_GREY, " Jūs neesate vairuotojas." ); } else if ( !strcmp( result, "ieskoti", true ) ) { new slot = GetSlotOfSpawnedVehicle( playerid ); if ( slot < MAX_OWNABLE_VEHICLES ) { new vehid = GetVehIdBySlot( playerid, slot ); if ( vehid != MAX_VEHICLES ) { new Float:vX, Float:vY, Float:vZ; GetVehiclePos ( vehid, vX, vY, vZ ); SetPlayerCheckpointEx( playerid, CHECKPOINT_VEHICLE, vX, vY, vZ, 3.5 ); SendClientMessage ( playerid, COLOR_WHITE, " Jūsų automobilio koordinatės paћymėtos raudonai." ); } } else SendClientMessage( playerid, COLOR_GREY, " Jūs neturite iљsispawninę transporto priemonės." ); } else if ( !strcmp( result, "naikinti", true ) ) { new slot = GetSlotOfSpawnedVehicle( playerid ); if ( slot < MAX_OWNABLE_VEHICLES ) { DropVehicleRow( VehInfo[ playerid ][ slot ][ vDBID ] ); ShowInfoText ( playerid, "~w~Jusu transporto priemone ~r~sunaikinta", 4000 ); TogglePlayerControllable( playerid, true ); } else SendClientMessage( playerid, COLOR_GREY, " Jūs neturite iљsispawninę transporto priemonės." ); } else if ( !strcmp( result, "parduoti", true ) ) { result = strtok( params, idx ); if ( !result[ 0 ] ) return SendUsage( playerid, "/t parduoti [ћaidėjo id] [kaina]" ); new id = strval( result ); result = strtok( params, idx ); if ( !result[ 0 ] ) return SendUsage( playerid, "/t parduoti [ћaidėjo id] [kaina]" ); new money = strval( result ); if ( id == INVALID_PLAYER_ID ) SendClientMessage( playerid, COLOR_GREY, " ID nerastas !" ); else if ( !aLogged[ id ] ) SendClientMessage( playerid, COLOR_GREY, " Ћaidėjas neprisijungęs." ); else if ( id == playerid ) SendClientMessage( playerid, COLOR_GREY, " Negali sau parduoti transporto priemonės." ); else if ( !IsPlayerToPlayer( 10.0, playerid, id ) ) SendClientMessage( playerid, COLOR_GREY, " Ћaidėjas nėra љalia tavęs." ); else if ( money < 1 || money > 99999999 ) SendClientMessage( playerid, COLOR_GREY, " Įraљėtę perdidelę arba permaћą pinigų sumą." ); else { new slot = GetSlotOfSpawnedVehicle( playerid ); if ( slot < MAX_OWNABLE_VEHICLES ) { new vehid = GetVehIdBySlot( playerid, slot ); PlaceOfferForPlayer( id, VEHICLE_OFFER, playerid, money, vehid ); } else SendClientMessage( playerid, COLOR_GREY, " Jūs neturite iљsispawninę transporto priemonės." ); } } else if ( !strcmp( result, "registruoti", true ) ) { if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) { new vehid = GetPlayerVehicleID( playerid ); if ( SVehInfo[ vehid ][ vOwner ] == PlayerInfo[ playerid ][ pSQLID ] ) { new slot = GetSlotOfCarByDBID( playerid, SVehInfo[ vehid ][ vDBID ] ); if ( slot == MAX_OWNABLE_VEHICLES ) return SendClientMessage( playerid, COLOR_RED, "KLAIDA" ); if ( strcmp( VehInfo[ playerid ][ slot ][ vPlate ], "NERA", true ) ) return SendClientMessage( playerid, COLOR_GREY, " Jūsų transporto priemonė jau yra priregistruota." ); new numplate[ 4 ], name [ MAX_PLAYER_NAME ], pos; GetPlayerName( playerid, name, MAX_PLAYER_NAME ); pos = strfind( name, "_", true ); if ( pos != 1 ) { strdel( name, 1, pos + 1 ); strdel( name, 2, 24 ); } else strdel( name, 1, 24 ); valstr( numplate, 1000 + random( 8999 ) ); format( VehInfo[ playerid ][ slot ][ vPlate ], 7, "%s%s", name, numplate ); //SetVehicleNumberPlate( vehid, VehInfo[ playerid ][ slot ][ vPlate ] ); SendClientMessage ( playerid, COLOR_WHITE, " Transporto priemonė priregistruota sėkmingai." ); new string[ 75 ]; format ( string, 75, " Jūsų transporto priemonės numeriai yra [%s]", VehInfo[ playerid ][ slot ][ vPlate ] ); SendClientMessage ( playerid, COLOR_WHITE, string ); //SaveOwnableVehInfo( SVehInfo[ vehid ][ vDBID ] ); format ( string, 75, "UPDATE `ownablevehicles` SET `plate`='%s' WHERE `id`=%d", VehInfo[ playerid ][ slot ][ vPlate ], SVehInfo[ vehid ][ vDBID ] ); mysql_query ( string ); AssignVehiclesToPlayerFromDB( playerid ); SetVehicleToRespawn ( vehid ); TogglePlayerControllable( playerid, true ); } else SendClientMessage( playerid, COLOR_GREY, " Jūs neesate transporto priemonės savininkas." ); } else SendClientMessage( playerid, COLOR_GREY, " Jūs neesate vairuotojas." ); } else if ( !strcmp( result, "rakinti", true ) ) { new slot = GetSlotOfSpawnedVehicle( playerid ); if ( slot < MAX_OWNABLE_VEHICLES ) { new vehid = GetVehIdBySlot( playerid, slot ); if ( vehid < MAX_VEHICLES ) { if ( CheckPlayerDistanceToVehicle( 5.0, playerid, vehid ) ) { if ( VehInfo[ playerid ][ slot ][ vLock ] < 1 ) return SendClientMessage( playerid, COLOR_GREY, " Jūs neturite uћrakto." ); if ( SVehInfo[ vehid ][ vLock ] > 0 ) { // Transporto priemonė yra uћrakinta SVehInfo[ vehid ][ vLock ] = 0; LockVehicleForPlayers( vehid, false ); ShowInfoText ( playerid, "~g~Transporto priemone atrakinta", 3000 ); } else { // Transporto priemonė yra atrakinta SVehInfo[ vehid ][ vLock ] = VehInfo[ playerid ][ slot ][ vLock ]; LockVehicleForPlayers( vehid, true ); ShowInfoText ( playerid, "~r~Transporto priemone uzrakinta", 3000 ); } } else SendClientMessage( playerid, COLOR_GREY, " Jūs neesate љalia savo transporto priemonės." ); } else SendClientMessage( playerid, COLOR_RED, "KLAIDA" ); } else SendClientMessage( playerid, COLOR_GREY, " Jūs neturite iљsispawninę transporto priemonės." ); } else if ( !strcmp( result, "pirktivieta", true ) ) { if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) { new vehid = GetPlayerVehicleID( playerid ); if ( SVehInfo[ vehid ][ vOwner ] == PlayerInfo[ playerid ][ pSQLID ] ) { new slot = GetSlotOfCarByDBID( playerid, SVehInfo[ vehid ][ vDBID ] ); if ( slot < MAX_VEHICLES ) { if ( GetScriptMoney( playerid ) < 99 ) return SendClientMessage( playerid, COLOR_GREY, " Parkavimo vieta kainuoja 100 Lt." ); GivePlayerMoney ( playerid, -100 ); ShowInfoText ( playerid, "~w~Parkavimo vieta nupirkta sekmingai.", 3000 ); GetVehiclePos ( vehid, VehInfo[ playerid ][ slot ][ vPos_x ], VehInfo[ playerid ][ slot ][ vPos_y ], VehInfo[ playerid ][ slot ][ vPos_z ] ); GetVehicleZAngle ( vehid, VehInfo[ playerid ][ slot ][ vAngle ] ); SaveOwnableVehInfo ( SVehInfo[ vehid ][ vDBID ] ); } } else SendClientMessage( playerid, COLOR_GREY, " Jūs neesate transporto priemonės savininkas." ); } else SendClientMessage( playerid, COLOR_GREY, " Jūs neesate vairuotojas." ); } else if ( !strcmp( result, "atnaujinti", true ) ) { if ( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER ) { new vehid = GetPlayerVehicleID( playerid ); if ( SVehInfo[ vehid ][ vOwner ] == PlayerInfo[ playerid ][ pSQLID ] ) { new slot = GetSlotOfCarByDBID( playerid, SVehInfo[ vehid ][ vDBID ] ); if ( slot < MAX_VEHICLES ) { ShowPlayerMenu( playerid, MENU_UPGRADE, vehid ); } } else SendClientMessage( playerid, COLOR_GREY, " Jūs neesate transporto priemonės savininkas." ); } else SendClientMessage( playerid, COLOR_GREY, " Jūs neesate vairuotojas." ); } else if ( !strcmp( result, "pirkti", true ) ) { if ( GetPlayerState( playerid ) == PLAYER_STATE_ONFOOT ) { if ( IsPlayerInRangeOfPoint( playerid, 6.0, bData[ 6 ][ bEntrance_x ], bData[ 6 ][ bEntrance_y ], bData[ 6 ][ bEntrance_z ] ) ) { new string[ 30 * VEHICLES_FORSALE ]; for ( new i = 0; i < VEHICLES_FORSALE; i++ ) format( string, 33 * VEHICLES_FORSALE, "%s%s %d Lt\n", string, GetVehicleName( VehiclesForSale[ i ][ 0 ] ), VehiclesForSale[ i ][ 1 ] ); ShowPlayerDialog( playerid, 1012, DIALOG_STYLE_LIST, "Maљinų turgus", string, "Pirkti", "Atљaukti" ); } else if ( IsPlayerInRangeOfPoint( playerid, 6, bData[ 20 ][ bEntrance_x ], bData[ 20 ][ bEntrance_y ], bData[ 20 ][ bEntrance_z ] ) ) ShowPlayerMenu( playerid, MENU_BOATSHOP ); else SendClientMessage( playerid, COLOR_GREY, " Jūs neesate prie transporto priemonių parduotuvės." ); } } else if ( !strcmp( result, "dokumentai", true ) ) { new slot = GetSlotOfSpawnedVehicle( playerid ); if ( slot < MAX_OWNABLE_VEHICLES ) { result = strtok( params, idx ); if ( !result[ 0 ] ) SendUsage( playerid, "/t dokumentai [ћaidėjo id]" ); else { new id = strval( result ); if ( !IsPlayerConnected( id ) || !aLogged[ id ] ) SendClientMessage( playerid, COLOR_GREY, " Ћaidėjas neprisijungęs." ); else if ( !IsPlayerToPlayer( 4.0, playerid, id ) ) SendClientMessage( playerid, COLOR_GREY, " Ћaidėjas nėra љalia tavęs." ); else { new vehid = GetVehIdBySlot( playerid, slot ); if ( vehid < MAX_VEHICLES ) { new string[ 79 ], name [ MAX_PLAYER_NAME ]; GetPlayerName( playerid, name, MAX_PLAYER_NAME ); SendClientMessage( id, COLOR_DBLUE, "|___Transporto priemonės dokumentai___|" ); format ( string, 78, "| Savininkas: %s", name ); SendClientMessage( id, COLOR_WHITE, string ); format ( string, 78, "| Modelis: %s", GetVehicleName( GetVehicleModel( vehid ) ) ); SendClientMessage( id, COLOR_WHITE, string ); format ( string, 78, "| Numeris: [%s]", VehInfo[ playerid ][ slot ][ vPlate ] ); SendClientMessage( id, COLOR_WHITE, string ); format ( string, 78, "| Draudimas:[%d], apsaugos sis.:[%d]", VehInfo[ playerid ][ slot ][ vInsur ], VehInfo[ playerid ][ slot ][ vImmob ] ); SendClientMessage( id, COLOR_WHITE, string ); format ( string, 78, "| Signalizacija:[%d], uћraktas:[%d], dauћta:[%d]", VehInfo[ playerid ][ slot ][ vAlarm ], VehInfo[ playerid ][ slot ][ vLock ], VehInfo[ playerid ][ slot ][ vDestroys ] ); SendClientMessage( id, COLOR_WHITE, string ); SendClientMessage( id, COLOR_DBLUE, "|_____________________________________|" ); if ( id != playerid ) { format ( string, 78, " %s Jums parodė transporto priemonės dokumentus.", name ); SendClientMessage( id, COLOR_WHITE, string ); GetPlayerName ( id, name, MAX_PLAYER_NAME ); format ( string, 78, " Jūs parodėte %s savo transporto priemonės dokumentus.", name ); SendClientMessage( playerid, COLOR_WHITE, string ); } } } } } else SendClientMessage( playerid, COLOR_GREY, " Jūs neesate iљsispawninę transporto priemonės." ); } else CallLocalFunction( "cmd_transportas", "ds", playerid, " " ); } return true; } COMMAND:nustatytisunaik( playerid, params[ ] ) { if ( PlayerInfo[ playerid ][ pAdmin ] > 2 ) { new vehid = GetPlayerVehicleID( playerid ); if ( SVehInfo[ vehid ][ vDBID ] > 0 ) { new ownersql = SVehInfo[ vehid ][ vOwner ], owner = INVALID_PLAYER_ID; foreach (Player, i) { if ( !aLogged[ i ] ) continue; if ( PlayerInfo[ i ][ pSQLID ] == ownersql ) { owner = i; break; } } if ( owner != INVALID_PLAYER_ID ) { new slot = GetSlotOfCarID( owner, vehid ); if ( slot < MAX_OWNABLE_VEHICLES ) { new destroys; if ( sscanf( params, "d", destroys ) ) SendUsage( playerid, "/nustatytisunaik [sunaikinimų skaičius]" ); else if ( destroys < 0 || destroys > 4 ) SendClientMessage( playerid, COLOR_GREY, " Sunaikinimų skaičius negali būti maћiau nei 0 ir daugiau nei 4" ); else { VehInfo[ owner ][ slot ][ vDestroys ] = destroys; SendClientMessage( playerid, COLOR_GREY, " Transporto priemonės sunaikinimo taљkai redaguoti sėkmingai." ); } } else SendClientMessage( playerid, COLOR_GREY, " KLAIDA" ); } else SendClientMessage( playerid, COLOR_GREY, " Transporto priemonės savininkas nėra prisijungęs." ); } else SendClientMessage( playerid, COLOR_GREY, " Љi transporto priemonė niekam nepriklauso." ); } else SendUnauthorized( playerid ); return true; }