23.07.2012, 14:45
Try This:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_SECONDARY_ATTACK)
{
if(!IsPlayerInAnyVehicle(playerid))
{
new Float:x, Float:y, Float:z, vehicle;
GetPlayerPos(playerid, x, y, z);
GetVehicleWithinDistance(playerid, x, y, z, 20.0, vehicle);
if(IsVehicleRc(vehicle))
{
PutPlayerInVehicle(playerid, vehicle, 0);
}
}
else
{
new vehicleID = GetPlayerVehicleID(playerid);
if(IsVehicleRc(vehicleID) || GetVehicleModel(vehicleID) == RC_CAM)
{
if(GetVehicleModel(vehicleID) != D_TRAM)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x+0.5, y, z+1.0);
}
}
}
}
if(!gPlayerUsingLoopingAnim[playerid]) return 1;
if(IsKeyJustDown(KEY_SECONDARY_ATTACK,newkeys,oldkeys))
{
StopLoopingAnim(playerid);
TextDrawHideForPlayer(playerid,txtAnimHelper);
}
if(PRESSED(KEY_FIRE)) AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
if(newkeys & KEY_SUBMISSION)
{
if(IsPlayerInAnyVehicle(playerid))
{
if((GetPlayerVehicleID(playerid) == 520) || (GetPlayerVehicleID(playerid) == 425) || (GetPlayerVehicleID(playerid) == 464)) return 1;
else
{
new Float:vx, Float:vy, Float:vz;
GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
SetVehicleVelocity(GetPlayerVehicleID(playerid) ,vx*2,vy*2 ,vz*2);
}
}
}
return 1;
}