08.03.2012, 20:54
(
Последний раз редактировалось clavador; 16.03.2012 в 16:08.
)
Yeah! Finally!
I waited so long for a good camera control in SAMP to get this to work and now finally it's here.
I took Blantas function posted on https://sampforum.blast.hk/showthread.php?tid=323271&page=21, so some credits go to him. The function itself does what it has to do, so I didn't have to make one of my own.
What I did is center the camera in most of the cars, but not all of them. I'm not planning to expand it right now, but you will see that is very easy to customize.
Known bugs:
- Checkpoints can't be seen through the windshield or side windows (this is a GTA thing, nothing to do with the script itself).
SAMP version: 0.3e
First of all, you need this:
Then just add this to your OnPlayerStateChange or copy the whole function as you need:
And you're done!
Pics:
http://i.imgur.com/HYCk9.jpg
http://i.imgur.com/B9KV1.jpg
http://i.imgur.com/NTIe0.jpg
If you want it wth a command only:
Inside public OnPlayerCommandText(playerid,cmdtext[])
Edit: I forgot to paste some code. Added now!
I waited so long for a good camera control in SAMP to get this to work and now finally it's here.
I took Blantas function posted on https://sampforum.blast.hk/showthread.php?tid=323271&page=21, so some credits go to him. The function itself does what it has to do, so I didn't have to make one of my own.
What I did is center the camera in most of the cars, but not all of them. I'm not planning to expand it right now, but you will see that is very easy to customize.
Known bugs:
- Checkpoints can't be seen through the windshield or side windows (this is a GTA thing, nothing to do with the script itself).
SAMP version: 0.3e
First of all, you need this:
pawn Код:
enum CameraObjects
{
camobj
};
new Player[MAX_PLAYERS][CameraObjects];
enum DashBoardEnum
{
modelid,
Float:cam_x,
Float:cam_y,
Float:cam_z
};
new DashBoards[][DashBoardEnum] =
{
{ 410, -0.30, -0.25, 0.55 }, // Manana
{ 404, -0.35, -0.15, 0.68 }, // Perreniel
{ 575, -0.35, -0.15, 0.68 }, // Broadway
{ 466, -0.38, -0.15, 0.60 }, // Glendale
{ 401, -0.40, -0.15, 0.52 }, // Bravura
{ 419, -0.40, -0.25, 0.40 }, // Esperanto
{ 474, -0.47, -0.30, 0.52 }, // Hermes
{ 518, -0.53, -0.22, 0.43 }, // Buccaneer
{ 516, -0.47, -0.15, 0.55 }, // Nebula
{ 491, -0.40, -0.25, 0.44 }, // Virgo
{ 479, -0.35, -0.30, 0.65 }, // Regina
{ 566, -0.45, -0.25, 0.55 }, // Tahoma
{ 535, -0.35, -0.15, 0.62 }, // Slamvan
{ 467, -0.45, -0.25, 0.54 }, // Oceanic
{ 492, -0.45, -0.25, 0.54 }, // Greenwood
{ 426, -0.45, -0.25, 0.54 }, // Premier
{ 505, -0.45, -0.35, 0.68 }, // Rancher
{ 546, -0.45, -0.33, 0.56 }, // Intruder
{ 533, -0.45, -0.33, 0.56 }, // Feltzer
{ 496, -0.45, -0.37, 0.51 }, // Blista
{ 542, -0.45, -0.37, 0.51 }, // Clover
{ 589, -0.45, -0.31, 0.73 }, // Club
{ 565, -0.45, -0.25, 0.42 }, // Flash
{ 587, -0.45, -0.38, 0.44 }, // Euros
{ 412, -0.45, -0.27, 0.44 }, // Voodoo
{ 439, -0.45, -0.47, 0.45 }, // Stallion
{ 534, -0.50, -0.2, 0.42 }, // Remington
{ 602, -0.45, -0.25, 0.40 }, // Alpha
{ 536, -0.45, -0.25, 0.42 }, // Blade
{ 475, -0.45, -0.25, 0.44 }, // Sabre
{ 436, -0.34, -0.35, 0.52 }, // Previon
{ 585, -0.45, -0.26, 0.66 }, // Emperor
{ 600, -0.45, -0.18, 0.51 }, // Picador
{ 421, -0.38, -0.07, 0.45 }, // Washington
{ 580, -0.45, -0.26, 0.69 }, // Stafford
{ 458, -0.45, -0.12, 0.43 }, // Solair
{ 561, -0.37, -0.08, 0.52 }, // Stratum
{ 517, -0.45, -0.26, 0.54 }, // Majestic
{ 526, -0.40, -0.25, 0.37 }, // Fortune
{ 576, -0.35, -0.30, 0.58 }, // Tornado
{ 579, -0.45, -0.33, 0.85 }, // Huntley
{ 558, -0.37, -0.34, 0.59 }, // Uranus
{ 603, -0.47, -0.44, 0.35 }, // Phoenix
{ 560, -0.37, -0.20, 0.58 }, // Sultan
{ 559, -0.40, -0.40, 0.50 }, // Jester
{ 506, -0.39, -0.43, 0.37 }, // Super GT
{ 562, -0.36, -0.34, 0.53 }, // Elegy
{ 477, -0.40, -0.35, 0.47 }, // ZR-350
{ 402, -0.44, -0.49, 0.50 }, // Buffalo
{ 415, -0.36, -0.32, 0.32 }, // Cheetah
{ 451, -0.36, -0.32, 0.32 }, // Turismo
{ 541, -0.36, -0.20, 0.40 }, // Bullet
{ 429, -0.40, -0.65, 0.45 }, // Banshee
{ 411, -0.39, -0.21, 0.40 } // Infernus
};
pawn Код:
public OnPlayerStateChange( playerid, newstate, oldstate )
{
if( IsPlayerNPC( playerid ) ) return 1;
switch( newstate )
{
case PLAYER_STATE_DRIVER:
{
new Float:x, Float:y, Float:z, vehicleid = GetPlayerVehicleID(playerid), vehmodel = GetVehicleModel(vehicleid), bool:found;
for( new i;i<sizeof(DashBoards);i++ )
{
if( vehmodel == DashBoards[i][modelid] )
{
x = DashBoards[i][cam_x];
y = DashBoards[i][cam_y];
z = DashBoards[i][cam_z];
found = true;
break;
}
}
if( found )
{
Player[playerid][camobj] = CreateObject(19254,x,y,z,0.0,0.0,0.0,200.0);
AttachObjectToVehicle( Player[playerid][camobj], vehicleid, x,y,z, 0, 0, 0);
AttachCameraToObject(playerid, Player[playerid][camobj]);
}
}
case PLAYER_STATE_ONFOOT:
{
if(IsValidObject( Player[playerid][camobj] ) )
{
SetCameraBehindPlayer( playerid );
DestroyObject( Player[playerid][camobj] );
}
}
}
return 1;
}
Pics:
http://i.imgur.com/HYCk9.jpg
http://i.imgur.com/B9KV1.jpg
http://i.imgur.com/NTIe0.jpg
If you want it wth a command only:
pawn Код:
public OnPlayerStateChange( playerid, newstate, oldstate )
{
if( IsPlayerNPC( playerid ) ) return 1;
switch( newstate )
{
case PLAYER_STATE_ONFOOT:
{
if(IsValidObject( Player[playerid][camobj] ) )
{
SetCameraBehindPlayer( playerid );
DestroyObject( Player[playerid][camobj] );
}
}
}
return 1;
}
pawn Код:
if(!strcmp(cmdtext,"/dashboard",true) )
{
new Float:x, Float:y, Float:z, vehicleid = GetPlayerVehicleID(playerid), vehmodel = GetVehicleModel(vehicleid), bool:found;
for( new i;i<sizeof(DashBoards);i++ )
{
if( vehmodel == DashBoards[i][modelid] )
{
x = DashBoards[i][cam_x];
y = DashBoards[i][cam_y];
z = DashBoards[i][cam_z];
found = true;
break;
}
}
if( found )
{
Player[playerid][camobj] = CreateObject(19254,x,y,z,0.0,0.0,0.0,200.0);
AttachObjectToVehicle( Player[playerid][camobj], vehicleid, x,y,z, 0, 0, 0);
AttachCameraToObject(playerid, Player[playerid][camobj]);
}
return 1;
}